The solution to the Gitlab 502 problem I have encountered

Source: Internet
Author: User
Tags commit socket

Today, Gitlab is configured on Alibaba cloud, but the error 502 error has always occurred.

502
GitLab is not responding.
Your GITLAB administrator if this problem persists.

After an afternoon of search finally found the error, the original is on the server also opened a Tomcat service, occupied 8080 ports, so that the Gitlab unicorn service can not be opened.
Finally, make the following changes in/ETC/GITLAB/GITLAB.RB

<code class= "Hljs bash has-numbering" style= "display:block; padding:0px; Color:inherit; Box-sizing:border-box; font-family: ' Source Code Pro ', monospace;font-size:undefined; White-space:pre; border-radius:0px; Word-wrap:normal; background:transparent; " >unicorn[<span class= "hljs-string" style= "Color:rgb (0, 136, 0); box-sizing:border-box;" > ' Port ' </span>] = <span class= "Hljs-number" style= "Color:rgb (0, 102, 102); Box-sizing:border-box; " >9090</span></code><ul class= "pre-numbering" style= "Box-sizing:border-box; Position:absolute; width:50px; top:0px; left:0px; margin:0px; padding:6px 0px 40px; border-right-width:1px; Border-right-style:solid; Border-right-color:rgb (221, 221, 221); List-style:none; Text-align:right; Background-color:rgb (238, 238, 238); " ><li style= "Box-sizing:border-box; padding:0px 5px; " >1</li></ul>

Then Gitlab-ctl reconfigure restart the configuration so that the Gitlab server can function properly.

Here is a record of the approximate resolution of the problem, but also to their own long experience.
Install the Gitlab, open the service, found that there are 502 errors. This is the beginning to find a solution to all kinds of Baidu.
1. Locate the error log file in/var/log/gitlab/nginx and find the following error/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket failed (2:no such file or directory), and then use the NC command to create the socket file, with the final permission set to SRWXRWXRWX, the user and group set to Git:git, but found that this method does not work.

2. Then I ran to Gitlab's official website to find a solution, https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Ctrl+f 502 found the official tutorial that said 502 appeared in question

Note that on a single-core server it could take the up to a minute to restart Unicorn and Sidekiq. Your GitLab instance would give a 502 error until Unicorn is up again.

It is the also possible to start, the stop or restart individual components.

sudo gitlab-ctl restart Sidekiq
Unicorn supports Zero-downtime reloads. These can triggered as follows:

sudo gitlab-ctl hup Unicorn
Note that you cannot use a Unicorn reload to update the Ruby runtime.

Try to solve with the above two commands, found useless.
At this time I am angry, constant input gitlab-ctl status, found that unicorn PID has been growing. The PID of several other services has not changed.

3. At this point almost found the problem, it should be unicorn problem. Then see the official tutorial, you can use Gitlab-ctl tail unicorn to track the status of Unicorn, when the sad reminder of the original lack of authority,chmod-r 777/var/log/gitlab

2015-05-09_14:17:29.67447/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_ Server.rb:732:in ' Initialize ': Permission denied @ rb_sysopen-/var/log/gitlab/unicorn/unicorn_stderr.log (Errno:: eacces)
2015-05-09_14:17:29.67466 FROM/OPT/GITLAB/EMBEDDED/SERVICE/GEM/RUBY/2.1.0/GEMS/UNICORN-4.6.3/LIB/UNICORN/HTTP_ Server.rb:732:in ' Open '
2015-05-09_14:17:29.67469 FROM/OPT/GITLAB/EMBEDDED/SERVICE/GEM/RUBY/2.1.0/GEMS/UNICORN-4.6.3/LIB/UNICORN/HTTP_ Server.rb:732:in ' Redirect_io '
2015-05-09_14:17:29.67473 FROM/OPT/GITLAB/EMBEDDED/SERVICE/GEM/RUBY/2.1.0/GEMS/UNICORN-4.6.3/LIB/UNICORN/HTTP_ Server.rb:177:in ' stderr_path= '
2015-05-09_14:17:29.67478 from/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/ Configurator.rb:111:in ' block in commit! '
2015-05-09_14:17:29.67482 from/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/ Configurator.rb:108:in ' Each '
2015-05-09_14:17:29.67486 from/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/ Configurator.rb:108:in ' commit! '
2015-05-09_14:17:29.67491 FROM/OPT/GITLAB/EMBEDDED/SERVICE/GEM/RUBY/2.1.0/GEMS/UNICORN-4.6.3/LIB/UNICORN/HTTP_ Server.rb:121:in ' Initialize '
2015-05-09_14:17:29.67496 From/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in ' New '
2015-05-09_14:17:29.67500 From/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in ' <top (required) > '
2015-05-09_14:17:29.67504 from/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in ' Load '
2015-05-09_14:17:29.67509 from/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in ' <main> '
2015-05-09_14:17:29.68708 Master failed to start, check stderr log for details


<ul class= "pre-numbering" style= "Box-sizing:border-box; Position:absolute; width:50px; top:0px; left:0px; margin:0px; padding:6px 0px 40px; border-right-width:1px; Border-right-style:solid; Border-right-color:rgb (221, 221, 221); List-style:none; Text-align:right; Background-color:rgb (238, 238, 238); " ><li style= "Box-sizing:border-box; padding:0px 5px; " >1</li><li style= "Box-sizing:border-box; padding:0px 5px; " >2</li><li style= "Box-sizing:border-box; padding:0px 5px; " >3</li><li style= "Box-sizing:border-box; padding:0px 5px; " >4</li><li style= "Box-sizing:border-box; padding:0px 5px; " >5</li><li style= "Box-sizing:border-box; padding:0px 5px; " >6</li><li style= "Box-sizing:border-box; padding:0px 5px; " >7</li><li style= "Box-sizing:border-box; padding:0px 5px; " >8</li></ul>

4. Well, finally found out where the problem lies. This time the choice becomes is the original 8080 port service to kill or will unicorn port for one. This depends on your specific needs. My side is to replace the unicorn port with 9090, the method is the beginning of the method of the

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.