sameersbn / docker-gitlab

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

Gitlab with Mariadb: unexpected shutdown #1640

Open Ageraluon opened 6 years ago

Ageraluon commented 6 years ago

In my setup due to technical restraints, I am trying to setup gitlab with a mysql database, specifically mariadb. For that, I am running the following docker-compose:


version: "3.6"

services:
  gitlab:
    image: 'sameersbn/gitlab:latest'
    ports:
      - "8101:443" #HTTPS Port
      - "8102:80" #HTTP Port
      - "8103:22" #SSH Port
    #restart: always
    environment:
      - DEBUG=true

      - DB_ADAPTER=mysql2
      - DB_HOST=con_database
      - DB_PORT=3306
      - DB_USER=gitlab
      - DB_PASS=testpassword
      - DB_NAME=gitlabhq_production

      - REDIS_HOST=con_redis
      - REDIS_PORT=6379

      - TZ=Europe/Berlin
      - GITLAB_TIMEZONE=Berlin  

      - GITLAB_HTTPS=false
      - SSL_SELF_SIGNED=false

      - GITLAB_HOST=localhost
      - GITLAB_PORT=8102
      - GITLAB_SSH_PORT=8103
      - GITLAB_RELATIVE_URL_ROOT=
      - GITLAB_SECRETS_DB_KEY_BASE=longandrandomalphanumericstring
      - GITLAB_SECRETS_SECRET_KEY_BASE=longandrandomalphanumericstring
      - GITLAB_SECRETS_OTP_KEY_BASE=longandrandomalphanumericstring

      - GITLAB_BACKUP_SCHEDULE=daily
      - GITLAB_BACKUP_TIME=01:00

    container_name: con_gitlab
    networks:
      - net_RevProxyLinux
      - net_GitLab
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:80"]
      interval: 3m
      timeout: 20s
      retries: 3
      start_period: 1m   

  #For user session data
  redis:
    restart: always
    image: sameersbn/redis:latest
    networks: 
      - net_GitLab
    container_name: con_redis

  #For permanent user data
  database:
    #restart: always
    image: bitnami/mariadb:latest
    environment:
      - MARIADB_ROOT_PASSWORD=testrootpassword
      - MARIADB_DATABASE=gitlabhq_production
      - MARIADB_USER=gitlab
      - MARIADB_PASSWORD=testpassword
    networks: 
      - net_GitLab
    container_name: con_database    

networks:
  net_RevProxyLinux:
  net_GitLab:

after some seconds, the gitlab container shuts down with the following message;

... con_gitlab | + sudo -HEu root envsubst '$NGINX_REAL_IP_RECURSIVE' con_gitlab | + rm -f /tmp/tmp.IWfuio10dZ con_gitlab | + sed -i '/{{NGINX_REAL_IP_TRUSTED_ADDRESSES}}/d' /etc/nginx/sites-enabled/gitlab con_gitlab | + nginx_configure_gitlab_ci con_gitlab | + [[ -n '' ]] con_gitlab | + nginx_configure_gitlab_registry con_gitlab | + [[ false == true ]] con_gitlab | + nginx_configure_pages con_gitlab | ++ sed 's/./\\./g' con_gitlab | ++ echo example.com con_gitlab | + local 'GITLAB_PAGES_DOMAIN=example\.com' con_gitlab | + [[ false == true ]] con_gitlab | + case ${1} in con_gitlab | + migrate_database con_gitlab | + case ${DB_ADAPTER} in con_gitlab | + QUERY='SELECT count() FROM information_schema.tables WHERE table_schema = '\''gitlabhq_production'\'';' con_gitlab | ++ mysql -h con_database -P 3306 -u gitlab -ptestpassword -ss -e 'SELECT count() FROM information_schema. tables WHERE table_schema = '\''gitlabhq_production'\'';' con_gitlab | mysql: [Warning] Using a password on the command line interface can be insecure. con_gitlab | + COUNT=0 con_gitlab | + [[ -z 0 ]] con_gitlab | + [[ 0 -eq 0 ]] con_gitlab | + echo 'Setting up GitLab for firstrun. Please be patient, this could take a while...' con_gitlab | + exec_as_git force=yes bundle exec rake gitlab:setup con_gitlab | Setting up GitLab for firstrun. Please be patient, this could take a while... con_gitlab | ++ whoami con_gitlab | + [[ root == git ]] con_gitlab | + sudo -HEu git force=yes bundle exec rake gitlab:setup con_gitlab | Missing Rails.application.secrets.openid_connect_signing_key for production environment. The secret will b e generated and stored in config/secrets.yml. con_gitlab exited with code 1

I am not sure what exactly is going on here, so I am hoping you can help me out with the interpretion of the log:

MariaDB [gitlabhq_production]> show variables like "character_set_database"; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | character_set_database | utf8 | +------------------------+-------+ 1 row in set (0.01 sec)

MariaDB [gitlabhq_production]> SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; +--------------+---------------------+----------------------------+------------------------+----------+ | CATALOG_NAME | SCHEMA_NAME | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | +--------------+---------------------+----------------------------+------------------------+----------+ | def | gitlabhq_production | utf8 | utf8_general_ci | NULL | | def | information_schema | utf8 | utf8_general_ci | NULL | +--------------+---------------------+----------------------------+------------------------+----------+ 2 rows in set (0.00 sec)

My docker version:

Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:12:48 2018
 OS/Arch:      windows/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:22:38 2018
  OS/Arch:      linux/amd64
  Experimental: false

My docker-compose version:

docker-compose version 1.21.1, build 7641a569
docker-py version: 3.2.1
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2k  26 Jan 2017
Ageraluon commented 6 years ago

If instead using sameersbn/mysql, as in the following docker-compose file:

version: "3.6"

services:
  gitlab:
    image: 'sameersbn/gitlab:latest'
    ports:
      - "8101:443" #HTTPS Port
      - "8102:80" #HTTP Port
      - "8103:22" #SSH Port
    #restart: always
    environment:
      - DEBUG=true

      - DB_ADAPTER=mysql2
      - DB_HOST=con_database
      - DB_PORT=3306
      - DB_USER=gitlab
      - DB_PASS=testpassword
      - DB_NAME=gitlabhq_production

      - REDIS_HOST=con_redis
      - REDIS_PORT=6379

      - TZ=Europe/Berlin
      - GITLAB_TIMEZONE=Berlin  

      - GITLAB_HTTPS=false
      - SSL_SELF_SIGNED=false

      - GITLAB_HOST=localhost
      - GITLAB_PORT=8102
      - GITLAB_SSH_PORT=8103
      - GITLAB_RELATIVE_URL_ROOT=
      - GITLAB_SECRETS_DB_KEY_BASE=longandrandomalphanumericstring
      - GITLAB_SECRETS_SECRET_KEY_BASE=longandrandomalphanumericstring
      - GITLAB_SECRETS_OTP_KEY_BASE=longandrandomalphanumericstring

      - GITLAB_BACKUP_SCHEDULE=daily
      - GITLAB_BACKUP_TIME=01:00

    container_name: con_gitlab
    networks:
      - net_RevProxyLinux
      - net_GitLab
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:80"]
      interval: 3m
      timeout: 20s
      retries: 3
      start_period: 1m   

  #For user session data
  redis:
    restart: always
    image: sameersbn/redis:latest
    networks: 
      - net_GitLab
    container_name: con_redis

  #For permanent user data
  database:
    #restart: always
    image: sameersbn/mysql:latest
    environment:
      - DB_NAME=gitlabhq_production
      - DB_USER=gitlab
      - MARIADB_PASSWORD=testpassword
    networks: 
      - net_GitLab
    container_name: con_database    

networks:
  net_RevProxyLinux:
  net_GitLab:

The output is as follows:

... con_gitlab | + [[ false == true ]] con_gitlab | + case ${1} in con_gitlab | + SUPERVISOR_PID=591 con_gitlab | + migrate_database con_gitlab | + /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf con_gitlab | + case ${DB_ADAPTER} in con_gitlab | + QUERY='SELECT count() FROM information_schema.tables WHERE table_schema = '\''gitlabhq_production'\'';' con_gitlab | ++ mysql -h con_database -P 3306 -u gitlab -pL86JIYwMpm443qcz5RV9 -ss -e 'SELECT count() FROM information _schema.tables WHERE table_schema = '\''gitlabhq_production'\'';' con_gitlab | mysql: [Warning] Using a password on the command line interface can be insecure. con_gitlab | + COUNT=0 con_gitlab | + [[ -z 0 ]] con_gitlab | + [[ 0 -eq 0 ]] con_gitlab | + echo 'Setting up GitLab for firstrun. Please be patient, this could take a while...' con_gitlab | Setting up GitLab for firstrun. Please be patient, this could take a while... con_gitlab | + exec_as_git force=yes bundle exec rake gitlab:setup con_gitlab | ++ whoami con_gitlab | + [[ root == git ]] con_gitlab | + sudo -HEu git force=yes bundle exec rake gitlab:setup con_gitlab | 2018-06-18 16:33:12,103 CRIT Supervisor running as root (no user in config file) con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/gitaly.conf" during parsing con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/gitlab-workhorse.conf" during par sing con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/mail_room.conf" during parsing con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/nginx.conf" during parsing con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/sidekiq.conf" during parsing con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/sshd.conf" during parsing con_gitlab | 2018-06-18 16:33:12,103 WARN Included extra file "/etc/supervisor/conf.d/unicorn.conf" during parsing con_gitlab | 2018-06-18 16:33:12,164 INFO RPC interface 'supervisor' initialized con_gitlab | 2018-06-18 16:33:12,165 CRIT Server 'unix_http_server' running without any HTTP authentication checking con_gitlab | 2018-06-18 16:33:12,165 INFO supervisord started with pid 591 con_gitlab | 2018-06-18 16:33:13,169 INFO spawned: 'gitaly' with pid 600 con_gitlab | 2018-06-18 16:33:13,176 INFO spawned: 'sidekiq' with pid 601 con_gitlab | 2018-06-18 16:33:13,183 INFO spawned: 'unicorn' with pid 602 con_gitlab | 2018-06-18 16:33:13,200 INFO spawned: 'mail_room' with pid 603 con_gitlab | 2018-06-18 16:33:13,206 INFO spawned: 'gitlab-workhorse' with pid 604 con_gitlab | 2018-06-18 16:33:13,213 INFO spawned: 'cron' with pid 605 con_gitlab | 2018-06-18 16:33:13,234 INFO spawned: 'nginx' with pid 606 con_gitlab | 2018-06-18 16:33:13,239 INFO spawned: 'sshd' with pid 608 con_gitlab | 2018-06-18 16:33:14,251 INFO success: gitaly entered RUNNING state, process has stayed up for > than 1 sec onds (startsecs) con_gitlab | 2018-06-18 16:33:14,251 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 se conds (startsecs) con_gitlab | 2018-06-18 16:33:14,251 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 se conds (startsecs) con_gitlab | 2018-06-18 16:33:14,251 INFO success: mail_room entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) con_gitlab | 2018-06-18 16:33:14,251 INFO success: gitlab-workhorse entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) con_gitlab | 2018-06-18 16:33:14,251 INFO success: cron entered RUNNING state, process has stayed up for > than 1 secon ds (startsecs) con_gitlab | 2018-06-18 16:33:14,251 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seco nds (startsecs) con_gitlab | 2018-06-18 16:33:14,251 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 secon ds (startsecs) con_gitlab | Missing Rails.application.secrets.openid_connect_signing_key for production environment. The secret will b e generated and stored in config/secrets.yml. con_gitlab | Rails.application.secrets.openid_connect_signing_key was blank, but the literal value in config/secrets.ym l was: con_gitlab | -----BEGIN RSA PRIVATE KEY----- con_gitlab | MIIEpAIBAAKCAQEAyZhwkj6b+i/QqqJJ44kuaS36O3GFtMjqBhXidLzDM0nHNkx4 con_gitlab | 5UmqoiSwGsoA6GqM3B49dn9vbgiC/g8lYpyOmOBQnldSeRRovzC0m7WfD48YxExh con_gitlab | FyQPBdnl93pX1Bo0KiCJDHX11S0jfV/NAuW7bjk7uvoxiXKxGhuGxqHT2l+k5N6E ... ... con_gitlab | -----END RSA PRIVATE KEY----- con_gitlab | con_gitlab | con_gitlab | This probably isn't the expected value for this secret. To keep using a literal Erb string in config/secre ts.yml, replace <% with <%%. con_gitlab exited with code 1

spritle commented 6 years ago

If you can use mysql like this


    restart: always
    image: mysql:5.7.21
    volumes:```
nixel2007 commented 6 years ago

MySQL support was dropped at GitLab 10.0. Migrate to PostgreSQL if you want use newer versions of GitLab.

spritle commented 6 years ago

@nixel2007 Using gitlab 10.8.3 with mysql 5.7.21. So far so good.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.