I have difficulties to get GitLab CI (version 8.8.5) running with separate nginx (nginx/1.10.0, Ubuntu 14.04) configuration. My GitLab instance is running well and all works fine. What is the correct path to the gitlab-ci socket which I can refer in my nginx configuration file? I did not find anything in the gitlab directory.
Here is what I set up (I replaced my real domain with example.com) :
GitLab settings /etc/gitlab/gitlab.rb
:
external_url 'http://git.example.com'
ci_external_url 'https://ci.example.com'
gitlab_rails['time_zone'] = 'Europe/Berlin'
web_server['external_users'] = ['www-data']
nginx['enable'] = false
ci_nginx['enable'] = false
GitLab nginx configuration file /etc/nginx/sites-enabled/gitlab
:
upstream gitlab-workhorse {
server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fail_timeout=0;
}
server {
listen *:443;
ssl on;
ssl_certificate /etc/letsencrypt/live/git.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.example.com/privkey.pem;
server_name git.example.com;
server_tokens off;
root /opt/gitlab/embedded/service/gitlab-rails/public;
access_log /var/log/nginx/git.example.com/access.log;
error_log /var/log/nginx/git.example.com/error.log;
location / {
client_max_body_size 0;
gzip off;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://gitlab-workhorse;
}
}
server {
listen 80;
server_name git.example.com;
return 301 https://$host$request_uri;
}
GitLab CI nginx configuration file /etc/nginx/sites-enabled/gitlab-ci
:
upstream gitlab_ci {
server unix:/var/opt/gitlab/gitlab-ci/sockets/gitlab.socket;
}
server {
listen *:443;
server_name ci.example.com;
server_tokens off;
ssl on;
ssl_certificate /etc/letsencrypt/live/git.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.example.com/privkey.pem;
root /opt/gitlab/embedded/service/gitlab-ci/public;
client_max_body_size 250m;
access_log /var/log/nginx/ci.example.com/access.log;
error_log /var/log/nginx/ci.example.com/error.log;
location / {
try_files $uri $uri/index.html $uri.html @gitlab_ci;
}
location @gitlab_ci {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://gitlab_ci;
}
}
server {
listen 80;
server_name ci.example.com;
return 301 https://$host$request_uri;
}
The nginx error log will print the following:
tail -f /var/log/nginx/ci.example.com/error.log
2016/06/17 11:07:31 [crit] 6192#0: *30 connect() to unix:/var/opt/gitlab/gitlab-ci/sockets/gitlab.socket failed (2: No such file or directory) while connecting to upstream, client: XX.XX.XX.XX, server: ci.example.com, request: "GET /robots.txt HTTP/1.1", upstream: "http://unix:/var/opt/gitlab/gitlab-ci/sockets/gitlab.socket:/robots.txt", host: "XX.XX.XX.XX"
When checking the GitLab directory I do not found any socket which I can refer in my configuration:
/var/opt/gitlab # ls -lF *
-rw------- 1 root root 38 Jan 19 14:57 bootstrapped
git-data:
drwxrws--- 11 git git 4096 Feb 24 16:26 repositories/
gitlab-ci:
drwx------ 2 git root 4096 Jan 19 14:56 builds/
gitlab-rails:
drwx------ 2 git root 4096 Jun 17 11:00 etc/
-rw-r--r-- 1 root root 8 Jun 15 16:42 REVISION
-rw-r--r-- 1 root root 58 Mar 22 16:41 RUBY_VERSION
drwxr-x--x 5 git gitlab-www 4096 Jan 19 14:56 shared/
drwxr-x--- 2 git gitlab-www 4096 Jun 15 16:42 sockets/
drwx------ 3 git root 4096 Jan 19 16:19 tmp/
drwx------ 2 git root 4096 Jun 15 16:42 upgrade-status/
drwx------ 7 git gitlab-www 4096 Feb 9 12:57 uploads/
-rw-r--r-- 1 root root 6 Jun 15 16:42 VERSION
drwx------ 2 git root 4096 Jan 19 14:56 working/
gitlab-shell:
-rw-r--r-- 1 root root 1823 Jun 17 10:51 config.yml
-rw-r--r-- 1 root root 129 Jan 19 14:56 gitlab_shell_secret
gitlab-workhorse:
srwxrwxrwx 1 git git 0 Jun 15 16:42 socket=
-rw-r--r-- 1 root root 40 Jun 15 16:42 VERSION
logrotate:
-rw-r--r-- 1 root root 425 Feb 24 22:18 logrotate.conf
drwx------ 2 root root 4096 Jun 17 11:00 logrotate.d/
-rw-r--r-- 1 root root 880 Jun 17 10:52 logrotate.status
nginx:
drwx------ 2 gitlab-www root 4096 Jan 19 14:57 client_body_temp/
drwxr-x--- 2 root gitlab-www 4096 Jun 17 11:00 conf/
drwx------ 2 gitlab-www root 4096 Jan 19 14:57 fastcgi_temp/
lrwxrwxrwx 1 root root 21 Jan 19 14:57 logs -> /var/log/gitlab/nginx/
drwx------ 8 gitlab-www root 4096 Jan 19 15:49 proxy_temp/
drwx------ 2 gitlab-www root 4096 Jan 19 14:57 scgi_temp/
drwx------ 2 gitlab-www root 4096 Jan 19 14:57 uwsgi_temp/
postgresql:
drwx------ 14 gitlab-psql root 4096 Jun 17 11:00 data/
redis:
-rw------- 1 gitlab-redis gitlab-redis 201024 Jun 17 11:10 dump.rdb
-rw-r--r-- 1 gitlab-redis root 29778 Mar 3 16:16 redis.conf
srwxrwxrwx 1 gitlab-redis gitlab-redis 0 Jun 15 16:41 redis.socket=
What am I missing? Is there anyone who can give me a hint how to set up my GitLab CI properly? Thank you for your help in advance.
Starting from version 8.0 GitLab CI is fully integrated into GitLab. This actually means that no specific CI configuration is necessary, just a general GitLab nginx file.
If your external_url
is http://gitlab.example.com
then your CI is already available for runners on http://gitlab.example.com/ci
. Use this URL to register your runner for the GitLab CI.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.