Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot continue without a database #1330

Closed
GarbageYard opened this issue Aug 21, 2017 · 2 comments
Closed

Error: Cannot continue without a database #1330

GarbageYard opened this issue Aug 21, 2017 · 2 comments

Comments

@GarbageYard
Copy link

GarbageYard commented Aug 21, 2017

I am using RancherOS v1.0.3. I am trying to install separate GitLab and PostgreSQL container on Kubernetes. Right now, i am only trying to run single instance of each container.

[rancher@rancher-agent-1 ~]$ docker version
Client:
 Version:      1.12.6
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   78d1802
 Built:        Wed Jan 11 00:23:16 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.6
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   78d1802
 Built:        Wed Jan 11 00:23:16 2017
 OS/Arch:      linux/amd64
[rancher@rancher-agent-1 ~]$ docker info
Containers: 39
 Running: 1
 Paused: 0
 Stopped: 38
Images: 25
Server Version: 1.12.6
Storage Driver: overlay
 Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge null host overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.9.34-rancher
Operating System: RancherOS v1.0.3
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.615 GiB
Name: rancher-agent-1.c.kubernetes-174104.internal
ID: ESGM:FSG6:AAET:IQ3G:IA5R:AVPI:7EOY:E7SI:VX5I:KNRY:4R4M:CETJ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8
[rancher@rancher-agent-1 ~]$ cat postgresql.sh
docker run --name gitlab-postgresql -d \
    --env 'DB_NAME=gitlabhq_production' \
    --env 'DB_USER=gitlab' --env 'DB_PASS=password' \
    --env 'DB_EXTENSION=pg_trgm' \
    --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
    sameersbn/postgresql:9.6-2
[rancher@rancher-agent-1 ~]$ cat gitlab.sh
docker run --name gitlab -d --link gitlab-postgresql:postgresql \
    --volume /srv/docker/gitlab/gitlab:/home/git/data \
    sameersbn/gitlab:9.4.5

I started PostgreSQL first and then GitLab.

PostgreSQL logs:

[rancher@rancher-agent-1 ~]$ docker logs 41a35e7c25511f419b3bc198e26223087b656336f8d5c46b84f7384aa7bc820e -f
Initializing datadir...
Initializing certdir...
Initializing logdir...
Initializing rundir...
Setting resolv.conf ACLs...
Initializing database...
Configuring hot standby...
‣ Setting postgresql.conf parameter: wal_level = 'hot_standby'
‣ Setting postgresql.conf parameter: max_wal_senders = '16'
‣ Setting postgresql.conf parameter: checkpoint_segments = '8'
‣ Setting postgresql.conf parameter: wal_keep_segments = '32'
‣ Setting postgresql.conf parameter: hot_standby = 'on'
‣ Setting postgresql.conf parameter: data_directory = '/var/lib/postgresql/9.6/main'
‣ Setting postgresql.conf parameter: log_directory = '/var/log/postgresql'
‣ Setting postgresql.conf parameter: log_filename = 'postgresql-9.6-main.log'
‣ Setting postgresql.conf parameter: ssl = 'off'
Creating database user: gitlab
Creating database: gitlabhq_production...
‣ Loading pg_trgm extension...
‣ Granting access to gitlab user...
Starting PostgreSQL 9.6...
LOG:  database system was shut down at 2017-08-21 10:41:01 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

GitLab logs:

[rancher@rancher-agent-1 ~]$ docker logs gitlab -f
Initializing logdir...
Initializing datadir...
Generating OpenSSH host keys... RSA1 RSA DSA ECDSA ED25519
Installing configuration templates...
Configuring gitlab...
Configuring gitlab::database
ERROR:
  Please configure the database connection.
  Refer http://git.io/wkYhyA for more information.
  Cannot continue without a database. Aborting...

But when i try connecting to the db, i see that the given database and user is there. Not sure what needs to be configured. Is there something wrong with the --link thing?

[rancher@rancher-agent-1 ~]$ docker exec -it gitlab-postgresql bash
root@41a35e7c2551:/var/lib/postgresql# psql gitlabhq_production gitlab
psql (9.6.1)
Type "help" for help.

gitlabhq_production=> \c gitlabhq_production
You are now connected to database "gitlabhq_production" as user "gitlab".
gitlabhq_production=>  \du
 gitlab    | Create DB                                                  | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
@GarbageYard
Copy link
Author

Do i need to launch a redis container too or GitLab container has the default in-built? I have implemented only the following section: https://github.com/sameersbn/docker-gitlab#linking-to-postgresql-container.

@GarbageYard
Copy link
Author

Sorry for the confusion but i got it working. Redis was indeed required but yesterday when i was checking the logs, it was only complaining about the db issue. Today when i started the Google Cloud instance and checked for error again, it was surprisingly showing no issue with database and started showing issue with redis as shown below:

...
Configuring gitlab...
Configuring gitlab::database
Configuring gitlab::redis
ERROR:
  Please configure the redis connection.
  Refer http://git.io/PMnRSw for more information.
  Cannot continue without a redis connection. Aborting...

Then when i configured Redis and provided values to GITLAB_SECRETS_DB_KEY_BASE, GITLAB_SECRETS_SECRET_KEY_BASE and GITLAB_SECRETS_OTP_KEY_BASE, i was finally able to access the GitLab UI. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant