[英]Difficulties setting up GitLab CI in 8.8.5 from scratch
我很難讓GitLab CI(版本8.8.5)與單獨的nginx(nginx / 1.10.0,Ubuntu 14.04)配置一起運行。 我的GitLab實例運行良好,並且一切正常。 我可以在我的nginx配置文件中引用的gitlab-ci套接字的正確路徑是什么? 我沒有在gitlab目錄中找到任何東西。
這是我設置的內容(我用example.com替換了我的真實域) :
GitLab設置/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配置文件/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配置文件/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;
}
Nginx錯誤日志將顯示以下內容:
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"
當檢查GitLab目錄時,我沒有找到可以在配置中引用的套接字:
/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=
我想念什么? 有誰可以給我提示如何正確設置我的GitLab CI? 提前謝謝你的幫助。
從8.0版本開始,GitLab CI已完全集成到GitLab中。 實際上,這意味着不需要特定的CI配置,只需一個通用的GitLab nginx文件。
如果您的external_url
是http://gitlab.example.com
則您的CI已在http://gitlab.example.com/ci
上可供跑步者使用。 使用此URL為GitLab CI注冊跑步者。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.