sameersbn / docker-gitlab

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

Configuring gitlab : database .......................................... #999

Open SebaBoler opened 7 years ago

SebaBoler commented 7 years ago

Created new container 👍

docker run --name gitlab -d \
--link gitlab-redis:redisio \
    --publish 10022:22 --publish 10080:80 \
    --env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' \
    --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \
    --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \
    --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \
    --env 'DB_ADAPTER=postgresql' --env 'DB_HOST=192.168.20.12' \
    --env 'DB_NAME=gitlabdb' \
    --env 'DB_USER=gitlabuser' --env 'DB_PASS=password' \
    --volume /share/VM/container-station-data/gitlab/gitlab:/home/git/data \
    sameersbn/gitlab:8.14.2

few minutes after start container stoping. i see only text below

Generating OpenSSH host keys... RSA1 RSA DSA ECDSA ED25519                                                                       
Installing configuration templates...                                                                                            
Configuring gitlab...                                                                                                            
Configuring gitlab::database...........................................................                                          
Initializing logdir...                                                                                                           
Initializing datadir...                                                                                                          
Installing configuration templates...                                                                                            
Configuring gitlab...                                                                                                            
Configuring gitlab::database...........................................................                                          
Initializing logdir...                                                                                                           
Initializing datadir...                                                                                                          
Installing configuration templates...                                                                                            
Configuring gitlab...                                                                                                            
Configuring gitlab::database...........................................................
solidnerd commented 7 years ago

Hey,

what do you mean with container stopping ?

SebaBoler commented 7 years ago

Container is switching off

r2evans commented 7 years ago

(I'll take your command literally, forgive me if I'm wrong here.) Can you try it with setting the *_SECRETS_* variables with strings that are just alpha-numeric? (Just A-Za-z0-9.) I don't know if that would cause a problem. (Also, I'm assuming the database user/pass are correct, as should be the redis hostname.)

sameersbn commented 7 years ago

@SebaBoler Configuring gitlab::database........................................................... indicates that the database connection test is timing out after 60 seconds. Which could mean the database server cannot be reached from the container.

You can try the following command to test the connection to the database server from a container

docker run -it --rm sameersbn/gitlab /usr/lib/postgresql/9.6/bin/pg_isready -h 192.168.20.12 -t 5

You may also want to confirm if the database user is allowed to login remotely and that the login credentials are invalid.

Lastly you can also launch the container with -e DEBUG=true to see the commands that are being executed which should help you debug the cause of the issue.

SebaBoler commented 7 years ago

When i tried your command and get 192.168.20.12:5432 not response. I need check NAT, beacuse container working on 10.0.3.3

I will another solution : create container with postgresql

kelvinblood commented 6 years ago

hey guys.

I met this problem too.

as @sameersbn says, database connection test is timing out. I just clean my /var/lib/docker and then restart from the beginning, it is ok.

I have build up compose for serveral times, maybe it leave some problem with docker-postgresql.

kinlao commented 4 years ago

I have the same problem, and I just solved it. Try to use "docker logs -f your_container_name" and find the errors. I found the timezone setting in my docker-compose.yml is wrong. After correcting it, my gitlab container works well.

# docker logs -f my_gitlab ... ArgumentError: Invalid Timezone: China/Shanghai /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/zones.rb:100:in rescue in find_zone!' /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/zones.rb:82:infind_zone!' /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/zones.rb:42:in zone=' /home/git/gitlab/config/initializers/time_zone.rb:1:in<top (required)>' ...

r2evans commented 4 years ago

@kinlao, I think the OP of this issue had database-not-running problem, as indicated by sameersbn's mention that the connection timed out after 60 seconds. I suggest you verify that (1) the database is running, whether in the same container, in a neighboring container, or externally; (2) the gitlab configuration points to the database correctly, with ip/port and user/pass; and (3) that the gitlab container has network access to it (generally not a problem unless you specifically change the docker networking).

(I'm not a maintainer and long ago migrated to GitLab's omnibus image, so I can't provide much more help than this. I thought I would comment since your comment is the first in well over two years with no other activity. Part of me thinks this issue should be closed either due to "resolved as db problem" or "inactivity".)