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

Can not connect to Database #2995

Open
sjpeng opened this issue Sep 3, 2024 · 1 comment
Open

Can not connect to Database #2995

sjpeng opened this issue Sep 3, 2024 · 1 comment

Comments

@sjpeng
Copy link

sjpeng commented Sep 3, 2024

+ chmod 0644 /home/git/gitlab/config/initializers/relative_url.rb
+ chown git: /home/git/gitlab/config/initializers/relative_url.rb
+ [[ root == git ]]
+ sudo -HEu git ln -s /home/git/data/tmp/cache /home/git/gitlab/tmp/cache
+ rm -rf /home/git/gitlab/public/assets
+ exec_as_git ln -s /home/git/data/tmp/assets /home/git/gitlab/public/assets
++ whoami
+ [[ root == git ]]
+ sudo -HEu git ln -s /home/git/data/tmp/assets /home/git/gitlab/public/assets
+ update_ca_certificates
+ [[ -f /home/git/data/certs/gitlab.crt ]]
+ [[ -f /home/git/data/certs/ca.crt ]]
+ [[ -f /home/git/data/certs/registry.crt ]]
+ generate_ssh_host_keys
+ sed -i 's|HostKey /etc/ssh/|HostKey /home/git/data/ssh/|g' /etc/ssh/sshd_config
+ [[ ! -e /home/git/data/ssh/ssh_host_rsa_key ]]
+ chmod 0600 /home/git/data/ssh/ssh_host_dsa_key /home/git/data/ssh/ssh_host_ecdsa_key /home/git/data/ssh/ssh_host_ed25519_key /home/git/data/ssh/ssh_host_rsa_key
+ chmod 0644 /home/git/data/ssh/ssh_host_dsa_key.pub /home/git/data/ssh/ssh_host_ecdsa_key.pub /home/git/data/ssh/ssh_host_ed25519_key.pub /home/git/data/ssh/ssh_host_rsa_key.pub
+ install_configuration_templates
+ echo 'Installing configuration templates...'
Installing configuration templates...
+ install_template git: gitlabhq/gitlab.yml /home/git/gitlab/config/gitlab.yml 0640
+ local OWNERSHIP=git:
+ local SRC=gitlabhq/gitlab.yml
+ local DEST=/home/git/gitlab/config/gitlab.yml
+ local MODE=0640
+ [[ -f /home/git/data/config/gitlabhq/gitlab.yml ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlabhq/gitlab.yml ]]
+ cp /etc/docker-gitlab/runtime/config/gitlabhq/gitlab.yml /home/git/gitlab/config/gitlab.yml
+ chmod 0640 /home/git/gitlab/config/gitlab.yml
+ chown git: /home/git/gitlab/config/gitlab.yml
+ install_template git: gitlabhq/database.yml /home/git/gitlab/config/database.yml 0640
+ local OWNERSHIP=git:
+ local SRC=gitlabhq/database.yml
+ local DEST=/home/git/gitlab/config/database.yml
+ local MODE=0640
+ [[ -f /home/git/data/config/gitlabhq/database.yml ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlabhq/database.yml ]]
+ cp /etc/docker-gitlab/runtime/config/gitlabhq/database.yml /home/git/gitlab/config/database.yml
+ chmod 0640 /home/git/gitlab/config/database.yml
+ chown git: /home/git/gitlab/config/database.yml
+ install_template git: gitlabhq/unicorn.rb /home/git/gitlab/config/unicorn.rb 0644
+ local OWNERSHIP=git:
+ local SRC=gitlabhq/unicorn.rb
+ local DEST=/home/git/gitlab/config/unicorn.rb
+ local MODE=0644
+ [[ -f /home/git/data/config/gitlabhq/unicorn.rb ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlabhq/unicorn.rb ]]
+ cp /etc/docker-gitlab/runtime/config/gitlabhq/unicorn.rb /home/git/gitlab/config/unicorn.rb
+ chmod 0644 /home/git/gitlab/config/unicorn.rb
+ chown git: /home/git/gitlab/config/unicorn.rb
+ install_template git: gitlabhq/rack_attack.rb /home/git/gitlab/config/initializers/rack_attack.rb 0644
+ local OWNERSHIP=git:
+ local SRC=gitlabhq/rack_attack.rb
+ local DEST=/home/git/gitlab/config/initializers/rack_attack.rb
+ local MODE=0644
+ [[ -f /home/git/data/config/gitlabhq/rack_attack.rb ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlabhq/rack_attack.rb ]]
+ cp /etc/docker-gitlab/runtime/config/gitlabhq/rack_attack.rb /home/git/gitlab/config/initializers/rack_attack.rb
+ chmod 0644 /home/git/gitlab/config/initializers/rack_attack.rb
+ chown git: /home/git/gitlab/config/initializers/rack_attack.rb
+ install_template git: gitlabhq/resque.yml /home/git/gitlab/config/resque.yml 0640
+ local OWNERSHIP=git:
+ local SRC=gitlabhq/resque.yml
+ local DEST=/home/git/gitlab/config/resque.yml
+ local MODE=0640
+ [[ -f /home/git/data/config/gitlabhq/resque.yml ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlabhq/resque.yml ]]
+ cp /etc/docker-gitlab/runtime/config/gitlabhq/resque.yml /home/git/gitlab/config/resque.yml
+ chmod 0640 /home/git/gitlab/config/resque.yml
+ chown git: /home/git/gitlab/config/resque.yml
+ install_template git: gitlabhq/secrets.yml /home/git/gitlab/config/secrets.yml 0600
+ local OWNERSHIP=git:
+ local SRC=gitlabhq/secrets.yml
+ local DEST=/home/git/gitlab/config/secrets.yml
+ local MODE=0600
+ [[ -f /home/git/data/config/gitlabhq/secrets.yml ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlabhq/secrets.yml ]]
+ cp /etc/docker-gitlab/runtime/config/gitlabhq/secrets.yml /home/git/gitlab/config/secrets.yml
+ chmod 0600 /home/git/gitlab/config/secrets.yml
+ chown git: /home/git/gitlab/config/secrets.yml
+ install_template git: gitlab-shell/config.yml /home/git/gitlab-shell/config.yml 0640
+ local OWNERSHIP=git:
+ local SRC=gitlab-shell/config.yml
+ local DEST=/home/git/gitlab-shell/config.yml
+ local MODE=0640
+ [[ -f /home/git/data/config/gitlab-shell/config.yml ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlab-shell/config.yml ]]
+ cp /etc/docker-gitlab/runtime/config/gitlab-shell/config.yml /home/git/gitlab-shell/config.yml
+ chmod 0640 /home/git/gitlab-shell/config.yml
+ chown git: /home/git/gitlab-shell/config.yml
+ [[ -n /git ]]
+ install_template git: gitlabhq/relative_url.rb /home/git/gitlab/config/initializers/relative_url.rb 0644
+ local OWNERSHIP=git:
+ local SRC=gitlabhq/relative_url.rb
+ local DEST=/home/git/gitlab/config/initializers/relative_url.rb
+ local MODE=0644
+ [[ -f /home/git/data/config/gitlabhq/relative_url.rb ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitlabhq/relative_url.rb ]]
+ cp /etc/docker-gitlab/runtime/config/gitlabhq/relative_url.rb /home/git/gitlab/config/initializers/relative_url.rb
+ chmod 0644 /home/git/gitlab/config/initializers/relative_url.rb
+ chown git: /home/git/gitlab/config/initializers/relative_url.rb
+ [[ false == true ]]
+ [[ -f /gitlabhq/robots.txt ]]
+ [[ false == true ]]
+ install_template root: nginx/gitlab /etc/nginx/sites-enabled/gitlab
+ local OWNERSHIP=root:
+ local SRC=nginx/gitlab
+ local DEST=/etc/nginx/sites-enabled/gitlab
+ local MODE=0644
+ [[ -f /home/git/data/config/nginx/gitlab ]]
+ [[ -f /etc/docker-gitlab/runtime/config/nginx/gitlab ]]
+ cp /etc/docker-gitlab/runtime/config/nginx/gitlab /etc/nginx/sites-enabled/gitlab
+ chmod 0644 /etc/nginx/sites-enabled/gitlab
+ chown root: /etc/nginx/sites-enabled/gitlab
+ [[ false == true ]]
+ [[ -n '' ]]
+ [[ false == true ]]
+ install_template git: gitaly/config.toml /home/git/gitaly/config.toml
+ local OWNERSHIP=git:
+ local SRC=gitaly/config.toml
+ local DEST=/home/git/gitaly/config.toml
+ local MODE=0644
+ [[ -f /home/git/data/config/gitaly/config.toml ]]
+ [[ -f /etc/docker-gitlab/runtime/config/gitaly/config.toml ]]
+ cp /etc/docker-gitlab/runtime/config/gitaly/config.toml /home/git/gitaly/config.toml
+ chmod 0644 /home/git/gitaly/config.toml
+ chown git: /home/git/gitaly/config.toml
+ rm -rf /var/run/supervisor.sock
+ configure_gitlab
Configuring gitlab...
+ echo 'Configuring gitlab...'
+ update_template /home/git/gitlab/config/gitlab.yml GITLAB_INSTALL_DIR GITLAB_SHELL_INSTALL_DIR GITLAB_DATA_DIR GITLAB_REPOS_DIR GITLAB_DOWNLOADS_DIR GITLAB_SHARED_DIR GITLAB_HOST GITLAB_PORT GITLAB_RELATIVE_URL_ROOT GITLAB_HTTPS GITLAB_SSH_HOST GITLAB_SSH_PORT GITLAB_SIGNUP_ENABLED GITLAB_PROJECTS_LIMIT GITLAB_USERNAME_CHANGE GITLAB_DEFAULT_THEME GITLAB_CREATE_GROUP
+ local FILE=/home/git/gitlab/config/gitlab.yml
+ shift
+ [[ ! -f /home/git/gitlab/config/gitlab.yml ]]
+ VARIABLES=($@)
+ local VARIABLES
++ stat -c %U /home/git/gitlab/config/gitlab.yml
+ local USR=git
++ mktemp
+ local tmp_file=/tmp/tmp.5h1ALWHVL5
+ cp -a /home/git/gitlab/config/gitlab.yml /tmp/tmp.5h1ALWHVL5
+ local variable
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_INSTALL_DIR[}]{2}/${GITLAB_INSTALL_DIR}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_SHELL_INSTALL_DIR[}]{2}/${GITLAB_SHELL_INSTALL_DIR}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_DATA_DIR[}]{2}/${GITLAB_DATA_DIR}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_REPOS_DIR[}]{2}/${GITLAB_REPOS_DIR}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_DOWNLOADS_DIR[}]{2}/${GITLAB_DOWNLOADS_DIR}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_SHARED_DIR[}]{2}/${GITLAB_SHARED_DIR}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_HOST[}]{2}/${GITLAB_HOST}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_PORT[}]{2}/${GITLAB_PORT}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_RELATIVE_URL_ROOT[}]{2}/${GITLAB_RELATIVE_URL_ROOT}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_HTTPS[}]{2}/${GITLAB_HTTPS}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_SSH_HOST[}]{2}/${GITLAB_SSH_HOST}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_SSH_PORT[}]{2}/${GITLAB_SSH_PORT}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_SIGNUP_ENABLED[}]{2}/${GITLAB_SIGNUP_ENABLED}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_PROJECTS_LIMIT[}]{2}/${GITLAB_PROJECTS_LIMIT}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_USERNAME_CHANGE[}]{2}/${GITLAB_USERNAME_CHANGE}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_DEFAULT_THEME[}]{2}/${GITLAB_DEFAULT_THEME}/g' /tmp/tmp.5h1ALWHVL5
+ for variable in '${VARIABLES[@]}'
+ sed -ri 's/[{]{2}GITLAB_CREATE_GROUP[}]{2}/${GITLAB_CREATE_GROUP}/g' /tmp/tmp.5h1ALWHVL5
+ export GITLAB_INSTALL_DIR GITLAB_SHELL_INSTALL_DIR GITLAB_DATA_DIR GITLAB_REPOS_DIR GITLAB_DOWNLOADS_DIR GITLAB_SHARED_DIR GITLAB_HOST GITLAB_PORT GITLAB_RELATIVE_URL_ROOT GITLAB_HTTPS GITLAB_SSH_HOST GITLAB_SSH_PORT GITLAB_SIGNUP_ENABLED GITLAB_PROJECTS_LIMIT GITLAB_USERNAME_CHANGE GITLAB_DEFAULT_THEME GITLAB_CREATE_GROUP
+ local IFS=:
+ sudo -HEu git envsubst '$GITLAB_INSTALL_DIR:$GITLAB_SHELL_INSTALL_DIR:$GITLAB_DATA_DIR:$GITLAB_REPOS_DIR:$GITLAB_DOWNLOADS_DIR:$GITLAB_SHARED_DIR:$GITLAB_HOST:$GITLAB_PORT:$GITLAB_RELATIVE_URL_ROOT:$GITLAB_HTTPS:$GITLAB_SSH_HOST:$GITLAB_SSH_PORT:$GITLAB_SIGNUP_ENABLED:$GITLAB_PROJECTS_LIMIT:$GITLAB_USERNAME_CHANGE:$GITLAB_DEFAULT_THEME:$GITLAB_CREATE_GROUP'
+ rm -f /tmp/tmp.5h1ALWHVL5
+ gitlab_configure_database
+ echo -n 'Configuring gitlab::database'
+ gitlab_finalize_database_parameters
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -z '' ]]
+ echo
+ echo 'ERROR: '
+ echo '  Please configure the database connection.'
Configuring gitlab::database
ERROR: 
  Please configure the database connection.
  Refer http://git.io/wkYhyA for more information.
  Cannot continue without a database. Aborting...

+ echo '  Refer http://git.io/wkYhyA for more information.'
+ echo '  Cannot continue without a database. Aborting...'
+ echo
+ return 1

the following is my config:

services:
  gitlab:
    environment:
      DEBUG: "true"
      GITLAB_HOST: 192.168.11.80
      GITLAB_PORT: 12080
      GITLAB_RELATIVE_URL_ROOT: /git
      GITLAB_SECRETS_DB_KEY_BASE: qcs-gitlab-app
      GITLAB_SECRETS_OTP_KEY_BASE: qcs-gitlab-app
      GITLAB_SECRETS_SECRET_KEY_BASE: qcs-gitlab-app
      GITLAB_SSH_PORT: 12022
    image: sameersbn/gitlab:11.4.0
    links:
    - redis:redisio
    - postgresql:postgresql
    ports:
    - 12080:80
    - "12022:22"
    restart: always
  postgresql:
    environment:
      DB_EXTENSION: pg_trgm
      DB_NAME: gitlabhq_production
      DB_PASS: password
      DB_USER: gitlab
    image: sameersbn/postgresql:9.6-2
    restart: always
  redis:
    command:
    - --loglevel warning
    image: sameersbn/redis:latest
    restart: always
version: "2"

@kkimurak
Copy link
Contributor

kkimurak commented Sep 4, 2024

DB_HOST setting seems to be not set for gitlab service.

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

Even you set them to postgresql service and link it to gitlab service, you have to specify corresponding settings to gitlab service too. Description in README is stale a bit..

services:
  gitlab:
    environment:
    - DEBUG: true

    # db settings to be added
    - DB_HOST: postgresql
    - DB_NAME: gitlabhq_production
    - DB_USER: gitlab
    - DB_PASS: password
    # optional: because default value `5432` will be used and you are not changing it on postgresql side
    # - DB_PORT: 5432

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

2 participants