sameersbn / sameersbn/docker-gitlab

Gitlab with Mariadb: unexpected shutdown

Open
#1,640 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
Shell
Stars
8.1k
Forks
2.1k
Avg merge
17h 47m
Merged PRs (30d)
7

Description

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:

  • Is that error reproducible or just on my side?
  • Is the log giving any hints on what is going on?
  • Mariadb is set up with utf8 charset but with a 'utf8_general_ci' collation. Would that be a problem?

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied docker-compose setup and inspect the GitLab container's migrate_database entry point, especially the gitlab:setup invocation and its reported production secret error. Compare the behavior with the MariaDB configuration shown; done means the container completes first-run setup instead of exiting with code 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, mariadb
Domain
databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.