全新安装后gitlab无法运行

时间:2016-10-05 06:11:38

标签: linux nginx ubuntu-12.04 gitlab unicorn

我使用以下命令安装了gitlab:

sudo apt-get install curl openssh-server ca-certificates postfix  

我在后缀设置期间选择了Internet Site。然后我运行了这个命令:

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash && sudo apt-get install gitlab-ce  

成功安装gitlab-ctl后,我配置了gitlab-ctl

sudo gitlab-ctl reconfigure  

那时,gitlab网址为localhost。但是apache也在使用相同的URL。所以我改变了gitlab的端口和URL:

vim /opt/gitlab/embedded/conf/nginx.conf

server {
        listen       6006;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

然后我修改了conig.yml

gitlab-shell
vim /opt/gitlab/embedded/service/gitlab-shell/config.yml
# GitLab user. git by default
user: git

# Url to gitlab instance. Used for api calls. Should end with a slash.
gitlab_url: "http://127.0.0.1:6006"  

然后我在浏览器中访问http://127.0.0.1:6006并收到此错误:

502
Whoops, GitLab is taking too much time to respond.  

我很困惑,所以我跑了gitlab-ctl tail并得到了这个错误日志:

==> /var/log/gitlab/sidekiq/current <==
2016-10-05_05:29:08.92709 2016-10-05T05:29:08.927Z 12187 TID-4m720 INFO: Starting processing, hit Ctrl-C to stop
2016-10-05_05:30:09.52907 2016-10-05T05:30:09.528Z 12187 TID-bem9o RepositoryArchiveCacheWorker JID-20b243822dd0cd87b47469c3 INFO: start
2016-10-05_05:30:09.53281 2016-10-05T05:30:09.532Z 12187 TID-yq8t8 INFO: Cron Jobs - add job with name: repository_archive_cache_worker
2016-10-05_05:30:09.54292 2016-10-05T05:30:09.542Z 12187 TID-bem9o RepositoryArchiveCacheWorker JID-20b243822dd0cd87b47469c3 INFO: done: 0.014 sec
2016-10-05_05:30:09.54586 2016-10-05T05:30:09.545Z 12187 TID-ben0w ImportExportProjectCleanupWorker JID-8dc980a47718b4aed29c5099 INFO: start
2016-10-05_05:30:09.54741 2016-10-05T05:30:09.547Z 12187 TID-yq8t8 INFO: Cron Jobs - add job with name: import_export_project_cleanup_worker
2016-10-05_05:30:09.55651 2016-10-05T05:30:09.556Z 12187 TID-ben0w ImportExportProjectCleanupWorker JID-8dc980a47718b4aed29c5099 INFO: done: 0.011 sec
2016-10-05_05:50:17.22381 2016-10-05T05:50:17.221Z 12187 TID-yq9mo RepositoryCheck::BatchWorker JID-ff7901db23ce23819797916a INFO: start
2016-10-05_05:50:17.22648 2016-10-05T05:50:17.226Z 12187 TID-yq8t8 INFO: Cron Jobs - add job with name: repository_check_worker
2016-10-05_05:50:17.28489 2016-10-05T05:50:17.284Z 12187 TID-yq9mo RepositoryCheck::BatchWorker JID-ff7901db23ce23819797916a INFO: done: 0.063 sec

==> /var/log/gitlab/unicorn/current <==
2016-10-05_06:05:12.70595 starting new unicorn master
2016-10-05_06:05:57.78182 master failed to start, check stderr log for details
2016-10-05_06:05:58.79527 failed to start a new unicorn master
2016-10-05_06:05:58.82317 starting new unicorn master
2016-10-05_06:06:44.26782 master failed to start, check stderr log for details
2016-10-05_06:06:45.28512 failed to start a new unicorn master
2016-10-05_06:06:45.31501 starting new unicorn master
2016-10-05_06:07:29.39832 master failed to start, check stderr log for details
2016-10-05_06:07:30.41097 failed to start a new unicorn master
2016-10-05_06:07:30.43896 starting new unicorn master

==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)
bundler: failed to load command: unicorn (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn)

==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:165:in `bind_listen'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:242:in `listen'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `block in bind_new_listeners!'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `each'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `bind_new_listeners!'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:138:in `start'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/unicorn-4.9.0/bin/unicorn:126:in `<top (required)>'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn:22:in `load'
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/unicorn:22:in `<top (required)>'
I, [2016-10-05T11:37:32.611698 #16317]  INFO -- : Refreshing Gem list

==> /var/log/gitlab/gitlab-shell/gitlab-shell.log <==

==> /var/log/gitlab/gitlab-workhorse/current <==
2016-10-05_05:42:56.86507 localhost:6006 @ - - [2016-10-05 11:12:56.864201851 +0530 IST] "GET / HTTP/1.1" 502 2422 "" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0" 0.000760
2016-10-05_05:42:58.76142 2016/10/05 11:12:58 error: badgateway: GET "/" failed after 0.000s: dial unix /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket: connect: no such file or directory
2016-10-05_05:42:58.76161 2016/10/05 11:12:58 ErrorPage: serving predefined error page: 502
2016-10-05_05:42:58.76162 localhost:6006 @ - - [2016-10-05 11:12:58.760901834 +0530 IST] "GET / HTTP/1.1" 502 2422 "" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0" 0.000630
2016-10-05_06:05:14.12478 2016/10/05 11:35:14 error: badgateway: GET "/" failed after 0.000s: dial unix /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket: connect: no such file or directory
2016-10-05_06:05:14.12483 2016/10/05 11:35:14 ErrorPage: serving predefined error page: 502
2016-10-05_06:05:14.12487 localhost:6006 @ - - [2016-10-05 11:35:14.12284215 +0530 IST] "GET / HTTP/1.1" 502 2422 "" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0" 0.001764
2016-10-05_06:05:26.36058 2016/10/05 11:35:26 error: badgateway: GET "/" failed after 0.000s: dial unix /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket: connect: no such file or directory
2016-10-05_06:05:26.36101 2016/10/05 11:35:26 ErrorPage: serving predefined error page: 502
2016-10-05_06:05:26.36148 127.0.0.1:6006 @ - - [2016-10-05 11:35:26.357890331 +0530 IST] "GET / HTTP/1.1" 502 2422 "" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0" 0.003415

==> /var/log/gitlab/gitlab-rails/production.log <==
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.
** [Raven] Raven 1.1.0 configured not to send errors.

==> /var/log/gitlab/gitlab-rails/application.log <==

==> /var/log/gitlab/redis/current <==
2016-10-05_05:58:54.07064 12168:M 05 Oct 11:28:54.070 * 10 changes in 300 seconds. Saving...
2016-10-05_05:58:54.07303 12168:M 05 Oct 11:28:54.072 * Background saving started by pid 15493
2016-10-05_05:58:54.11033 15493:C 05 Oct 11:28:54.110 * DB saved on disk
2016-10-05_05:58:54.11120 15493:C 05 Oct 11:28:54.111 * RDB: 4 MB of memory used by copy-on-write
2016-10-05_05:58:54.17268 12168:M 05 Oct 11:28:54.172 * Background saving terminated with success
2016-10-05_06:03:55.01652 12168:M 05 Oct 11:33:55.016 * 10 changes in 300 seconds. Saving...
2016-10-05_06:03:55.01895 12168:M 05 Oct 11:33:55.018 * Background saving started by pid 15710
2016-10-05_06:03:55.07398 15710:C 05 Oct 11:33:55.073 * DB saved on disk
2016-10-05_06:03:55.07539 15710:C 05 Oct 11:33:55.075 * RDB: 4 MB of memory used by copy-on-write
2016-10-05_06:03:55.11962 12168:M 05 Oct 11:33:55.119 * Background saving terminated with success

==> /var/log/gitlab/postgresql/current <==
2016-10-05_05:28:47.64377 LOG:  received fast shutdown request
2016-10-05_05:28:47.64385 LOG:  aborting any active transactions
2016-10-05_05:28:47.64401 FATAL:  terminating connection due to administrator command
2016-10-05_05:28:47.64578 FATAL:  terminating connection due to administrator command
2016-10-05_05:28:47.64652 LOG:  autovacuum launcher shutting down
2016-10-05_05:28:47.64756 LOG:  shutting down
2016-10-05_05:28:47.80242 LOG:  database system is shut down
2016-10-05_05:28:48.02021 LOG:  database system was shut down at 2016-10-05 05:28:47 GMT
2016-10-05_05:28:48.06326 LOG:  database system is ready to accept connections
2016-10-05_05:28:48.06384 LOG:  autovacuum launcher started

==> /var/log/gitlab/logrotate/current <==
2016-10-05_04:58:03.04915 Received TERM from runit, sending to process group (-PID)
2016-10-05_05:16:33.78849 Received TERM from runit, sending to process group (-PID)
2016-10-05_05:28:46.79447 Received TERM from runit, sending to process group (-PID)

==> /var/log/gitlab/nginx/gitlab_access.log <==
127.0.0.1 - - [05/Oct/2016:11:12:26 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:12:27 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:12:28 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:12:30 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:12:54 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:12:55 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:12:56 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:12:58 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:35:14 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
127.0.0.1 - - [05/Oct/2016:11:35:26 +0530] "GET / HTTP/1.1" 502 2434 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"

==> /var/log/gitlab/nginx/current <==

==> /var/log/gitlab/nginx/gitlab_error.log <==

==> /var/log/gitlab/nginx/error.log <==

==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
E, [2016-10-05T11:38:10.975557 #16317] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2016-10-05T11:38:10.975856 #16317] ERROR -- : retrying in 0.5 seconds (4 tries left)  

我发现独角兽指的是127.0.0.1:8080而不是127.0.0.1:6006。我怎样才能更改独角兽端口?

1 个答案:

答案 0 :(得分:1)

打开gitlab _ ***。rb这是gitlab配置文件,

  1. 导航到此文件中的GitLab Unicorn设置。
  2. 将unicorn ['port']更新为****其他端口。
  3. 将nginx ['port']更新为****其他端口。
  4. 同时更新此文件中的web_server用户名和web_server组,并将其设置为apache的用户名和组