sameersbn / docker-gitlab

Dockerized GitLab
http://www.damagehead.com/docker-gitlab/
MIT License
7.87k stars 2.14k forks source link

Gitlab not starting up #384

Closed ovalin closed 9 years ago

ovalin commented 9 years ago

I am having trouble starting up gitlab with the following logs According to the logs it looks like I have a permission issue on my log folder but I've tied giving the folder full permissions and am still running into this issue.

Let me know what you think

Supervisor.log

2015-07-18 13:35:30,073 INFO supervisord started with pid 1 2015-07-18 13:35:31,076 INFO spawned: 'sidekiq' with pid 270 2015-07-18 13:35:31,080 INFO spawned: 'unicorn' with pid 271 2015-07-18 13:35:31,083 INFO spawned: 'cron' with pid 272 2015-07-18 13:35:31,087 INFO spawned: 'nginx' with pid 273 2015-07-18 13:35:31,091 INFO spawned: 'sshd' with pid 274 2015-07-18 13:35:32,133 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:32,133 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:32,133 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:32,133 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:32,133 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:33,234 INFO exited: unicorn (exit status 1; not expected) 2015-07-18 13:35:33,808 INFO spawned: 'unicorn' with pid 280 2015-07-18 13:35:33,822 INFO exited: sidekiq (exit status 1; not expected) 2015-07-18 13:35:34,826 INFO spawned: 'sidekiq' with pid 283 2015-07-18 13:35:34,827 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:35,727 INFO exited: unicorn (exit status 1; not expected) 2015-07-18 13:35:36,729 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:36,731 INFO spawned: 'unicorn' with pid 286 2015-07-18 13:35:37,047 INFO exited: sidekiq (exit status 1; not expected) 2015-07-18 13:35:38,051 INFO spawned: 'sidekiq' with pid 289 2015-07-18 13:35:38,054 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:38,676 INFO exited: unicorn (exit status 1; not expected) 2015-07-18 13:35:39,678 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:39,680 INFO spawned: 'unicorn' with pid 292 2015-07-18 13:35:40,282 INFO exited: sidekiq (exit status 1; not expected) 2015-07-18 13:35:41,286 INFO spawned: 'sidekiq' with pid 296 2015-07-18 13:35:41,287 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-07-18 13:35:41,628 INFO exited: unicorn (exit status 1; not expected) 2015-07-18 13:35:42,629 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) ...

Sidekiq.log has this repeated

Permission denied @ rb_sysopen - /home/git/gitlab/log/sidekiq.log /usr/lib/ruby/2.1.0/logger.rb:592:in initialize' /usr/lib/ruby/2.1.0/logger.rb:592:inopen' /usr/lib/ruby/2.1.0/logger.rb:592:in open_logfile' /usr/lib/ruby/2.1.0/logger.rb:549:ininitialize' /usr/lib/ruby/2.1.0/logger.rb:318:in new' /usr/lib/ruby/2.1.0/logger.rb:318:ininitialize' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/logging.rb:30:in new' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/logging.rb:30:ininitialize_logger' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/cli.rb:339:in initialize_logger' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/cli.rb:39:inparse' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/bin/sidekiq:7:in <top (required)>' /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/sidekiq:23:inload' /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/sidekiq:23:in `

'

unicorn.log has the below repeated

/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:91:in block in reload': directory for stderr_path=/home/git/gitlab/lo g/unicorn.stderr.log not writable (ArgumentError) from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:87:ineach' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:87:in reload' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:68:ininitialize' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:108:in new' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:108:ininitialize' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn_rails:209:in new' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn_rails:209:in<top (required)>' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/unicorn_rails:23:in load' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/unicorn_rails:23:in

'

sameersbn commented 9 years ago

@ovalin please share some information with respect to your setup (host,boot2docker,etc). Additionally please share your docker run command or docker-compose file.

ovalin commented 9 years ago

I am using a QNAP NAS with ContainerStation and docker-gitlab container

my run command is ... docker run --name gitlab1_gitlab_1 -d --link gitlab1_postgresql_1:postgresql --link gitlab1_redis_1:redisio --publish=10022:22 --publish=10080:80 --env='GITLAB_PORT=10080' --env 'DB_TYPE=postgres' --env 'DB_NAME=gitlabhq_production' --env 'DB_USER=gitlab' --env 'DB_PASS=password' --env 'REDIS_HOST=redisio' --volume /share/DockerContainers/container-station-data/lib/docker/containers/eb9e1df78ce4db3de8006692905cf01729298c0bc7f51965d450b10d65db7d01:/home/git/data sameersbn/gitlab:7.12.2-2

ovalin commented 9 years ago

could it have something to do with permissions given to ruby?

ovalin commented 9 years ago

Does anyone know what user is used to execute the gitlab *rb files?

ovalin commented 9 years ago

I was able to resolve the issue myself thank you for your help though and I appreciate your work on the container.
The solution was that by default the container had the folder /var/log/gitlab/ did not providing permission to user git. After running a chown -R git on the folder I had resolved the issue.

sameersbn commented 9 years ago

@ovalin thats weird. the permissions of the folders in /var/log/gitlab are updated when the container is started https://github.com/sameersbn/docker-gitlab/blob/master/entrypoint.sh#L283-L287.

ovalin commented 9 years ago

yeah sorry I don't know the build well enough to help explain it all i can say is that i rebuilt it a handful of times each with the same issue.

FYI I also had trouble with nginx and the permission of all the asset folders. I followed this to resolve the issue I got the below from (https://forum.gitlab.com/t/troubleshooting-guide-wiki/31)

When accessing GitLab, the login page is broken, images and CSS files are not correctly loaded.

In Nginx error log

2013/08/23 13:52:19 [error] 31035#0: 1 open() "/home/git/gitlab/public/assets/login-logo-20fd89985ad8929292196a39fa51787c.png" failed (13: Permission denied), client: 10.191.131.75, server: devops.company.com, request: "GET /assets/login-logo-20fd89985ad8929292196a39fa51787c.png HTTP/1.1", host: "devops.company.com", referrer: "http://devops.company.com/users/sign_in" 2013/08/23 13:52:22 [error] 31035#0: 1 open() "/home/git/gitlab/public/assets/application-8d0430122c22e07faecdd974cd21a38b.css" failed (13: Permission denied), client: 10.191.131.75, server: devops.company.com, request: "GET /assets/application-8d0430122c22e07faecdd974cd21a38b.css HTTP/1.1", host: "devops.company.com", referrer: "http://devops.company.com/users/sign_in" 2013/08/23 13:52:22 [error] 31035#0: *10 open() "/home/git/gitlab/public/assets/application-7b88a88b92ad70a827dbedb75e5206b1.js" failed (13: Permission denied), client: 10.191.131.75, server: devops.company.com, request: "GET /assets/application-7b88a88b92ad70a827dbedb75e5206b1.js HTTP/1.1", host: "devops.company.com", referrer: "http://devops.company.com/users/sign_in" Problem: Permission denied when nginx user was trying to open assets (images, CSS files). The nginx user does NOT have access to the assets directory because it is NOT member of the git group.

NOTE: In the installation guide, adding Nginx user to the git group is NOT explicitly mentioned. However, it is well documented in the Gitlab Recipes. Solution:

Recommended

add nginx user to git group and give groups read/execute permission on /home/git

sudo usermod -a -G git nginx sudo chmod g+rx /home/git/ Alternatively, replace the default nginx user with git and group root in /etc/nginx/nginx.conf

user nginx;

user git root; Then restart Nginx, the issue should be fixed. See issue 48932 for more information.

sameersbn commented 9 years ago

@ovalin interesting. The nginx user www-data should have read access to the /home/git/gitlab directory. The assets file you mentioned reside in /home/git/data/tmp and the nginx user should have read access to these files as well. This leads me to believe that the permissions of the files in the data volume /home/git/data were somehow altered which probably rendered these files inaccessible by the www-data user.

In such cases, the permissions of the files and directories in the data volume can be corrected by starting the container with the app:sanitize command.