Build gitlab and deploy gitlab runner

Posted by Lashiec on Sat, 09 Nov 2019 16:11:42 +0100

1. Build gitlab. Before installing gitlab from yum, 502 errors were reported all the time after installation. Baidu tried online but still couldn't use it;

So this time, it is deployed in docker, as follows:


docker run --detach --hostname gitlab.forebix.com --publish 4433:443 --publish 10080:80 --publish 8022:22     --name gitlab     --restart always     --volume /srv/gitlab/config:/etc/gitlab     --volume /srv/gitlab/logs:/var/log/gitlab     --volume /srv/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest

--hostname indicates the host name, or IP or domain name;

--publish  insidious port  https  https  sshd, etc.; the left side is the host, the right side is the container port;

--Name name

--On the left side of volume implicit directory is the host directory and on the right side is the directory inside the container;

After downloading, the image will start automatically and use ps to view;

[root@fenye2019 ~]# docker ps
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                             PORTS                                                                NAMES
193cb075060e        gitlab/gitlab-ce:latest   "/assets/wrapper"   41 seconds ago      Up 36 seconds (health: starting)   0.0.0.0:8022->22/tcp, 0.0.0.0:10080->80/tcp, 0.0.0.0:4433->443/tcp   gitlab
[root@fenye2019 ~]# docker restart gitlab
gitlab

You can also test whether the local port is reachable; - tenet < 127.0.0.1 < 10080

http://gitlab.forebix.com:10080/ Enter domain name to access: but it needs to add port, which is troublesome

You can add nginx, and then forward it to port 80 of the domain name gitlab.forebix.com;

The configuration is as follows: load balancing pool can write multiple;

[root@fenye2019 vhost]# cat gitlab.conf 
#Configure load balancing pool
#jenkins load balancing pool
#upstream jenk_pool{
#    server 127.0.0.1:8181;
#}
#jenkins forwarding
#server {
#    listen       80;
#    server_name  jenkins.forebix.com;
#    access_log /tmp/jenkins.log;
#    error_log /tmp/jenkins.error;
    
    #Forward all requests to the application processing of jenk'u pool
#    location / {
#        proxy_set_header Host $host;
#        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#        proxy_pass http://jenk_pool;
#    }
#}
upstream gitlab_pool{
        server 127.0.0.1:10080;
}
server {
      listen       80;
      server_name  gitlab.forebix.com;
      access_log /tmp/gitlab.log;
       error_log /tmp/gitlab.error;

    location / {
       proxy_set_header Host $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_pass http://gitlab_pool;
    }
    }

Topics: Operation & Maintenance GitLab jenkins Docker yum