#linux #nginx #ubuntu-12.04 #gitlab #unicorn
#linux #nginx #ubuntu-12.04 #gitlab #единорог
Вопрос:
Я установил gitlab с помощью этих команд:
sudo apt-get install curl openssh-server ca-certificates postfix
Я выбрал Internet Site
во время установки postfix. Затем я выполнил эту команду:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash amp;amp; sudo apt-get install gitlab-ce
После успешной установки gitlab-ctl я настроил gitlab-ctl
sudo gitlab-ctl reconfigure
В то время URL-адрес gitlab был localhost
. Но apache также использовал тот же URL-адрес. Поэтому я изменил порт и URL-адрес gitlab:
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)
Я обнаружил, что unicorn указывает на 127.0.0.1:8080
вместо 127.0.0.1:6006
. Как я могу изменить порт unicorn?
Ответ №1:
Откройте gitlab_ ***.rb, который является файлом конфигурации gitlab,
- Перейдите к настройкам GitLab Unicorn в этом файле.
- Обновите unicorn[‘port’] на **** другой порт.
- Обновите nginx [‘port’] на **** другой порт.
- также обновите имя пользователя web_server и группу web_server в этом файле и установите для него имя пользователя и группу apache
Комментарии:
1. Путь к файлу для
gitlab_***.rb
?2. Обычно он хранится в /etc/gitlab/gitlab.rb
3. Я сделал, как вы сказали… После изменения
unicorn
настроек я запустилgitlab-ctl reconfigure
gitlab-ctl restart
и получил эту ошибку:==> /var/log/gitlab/unicorn/unicorn_stderr.log <== Errno::EADDRINUSE: Address already in use - bind(2) for 127.0.0.1:6006
4. Тогда есть несколько возможностей: 1. Обновите порт unicorn на другой порт, а не на 6006, потому что он уже используется. 2. Обновите порт nginx (nginx[‘listen_port’]) в том же файле.
5. Я сделал, как вы сказали, получил ту же ошибку:
==> /var/log/gitlab/unicorn/unicorn_stderr.log <== Errno::EADDRINUSE: Address already in use - bind(2) for 127.0.0.1:1122