appfrosch
appfrosch

Reputation: 1366

Docker-Compose.yml with GITLAB_OMNIBUS_CONFIG not working

Sorry if this is a duplicate question––I found similar issues but none seemed to be my exact use case... If I missed something mentioning a link would be highly appreciated.

I am trying to compose a docker stack with frontproxy, acme-companion and gitlab.

Currently, I am using a setup with several docker-compose.yml files for frontproxy and gitlab, in separate directories––which is working, without acme-companion.

My attempt to integrate it all into one file fails so far; obviously I am messing up the GITLAB_OMNIBUS_CONFIG configs––I just don't understand where my error is.

version: '3.1'

services:
  frontproxy:
    restart: always
    image: jwilder/nginx-proxy
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "certs-volume:/etc/nginx/certs:ro"
      - "/etc/nginx/vhost.d"
      - "/usr/share/nginx/html"
  nginx-letsencrypt-companion:
    restart: always
    image: nginxproxy/acme-companion
    volumes:
      - "certs-volume:/etc/nginx/certs"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
  gitlab:
    image: gitlab/gitlab-ce:latest
    restart: always
    hostname: 'dev.redacted.com'
    environment:
      VIRTUAL_HOST: 'dev.redacted.com'
      LETSENCRYPT_HOST: 'dev.redacted.com'
      LETSENCRYPT_EMAIL: '[email protected]'
      VIRTUAL_PROTO: 'https'
      VIRTUAL_PORT: '443'
      CERT_NAME: 'redacted.com'
      GITLAB_OMNIBUS_CONFIG: |
      # Email setup
        gitlab_rails['gitlab_email_enabled'] = true
        gitlab_rails['gitlab_email_from'] = '[email protected]'
        gitlab_rails['gitlab_email_display_name'] = '[email protected]'
        gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = 'mail.redacted.com'
        gitlab_rails['smtp_port'] = 587
        gitlab_rails['smtp_user_name'] = '[email protected]'
        gitlab_rails['smtp_password'] = 'redacted'
        gitlab_rails['smtp_domain'] = 'redacted.com'
        gitlab_rails['smtp_authentication'] = 'login'
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['gitlab_root_email'] = '[email protected]'
        # HTTPS Setup
        letsencrypt['enable'] = false
        external_url 'https://dev.redacted.com'
        gitlab_rails['gitlab_https'] = true
        gitlab_rails['gitlab_port'] = 443
    ports:
      - '22:22'
    volumes:
      - ./config:/etc/gitlab
      - ./logs:/var/log/gitlab
      - ./data:/var/opt/gitlab
volumes:
  certs-volume:

Edit:

I had not specified the error I was seeing–thanks for pointing it out, @sytech! So, here's the exact error message, when trying to start the stack with docker-compose up -d:

ERROR: yaml.parser.ParserError: while parsing a block mapping
  in "./docker-compose.yml", line 29, column 7
expected <block end>, but found '<scalar>'
  in "./docker-compose.yml", line 38, column 9

Upvotes: 1

Views: 14825

Answers (2)

beewoolie
beewoolie

Reputation: 1

I've been experiencing the same issue.

When I use the GITLAB_OMNIBUS_CONFIG environment variable, these settings do not appear to apply. If I copy just one of the settings that is easily identifiable into the gitlab.rb configuration, it applies just fine.

This is the environment variable as it is present in the container:

GITLAB_OMNIBUS_CONFIG="external_url 'https://dev.foo.com';nginx['redirect_http_to_https'] = true;gitlab_rails['gitlab_https'] = true;gitlab_rails['gitlab_email_enabled'] = true;gitlab_rails['gitlab_email_from'] = '[email protected]';gitlab_rails['gitlab_email_display_name'] = 'DEV-GitLab';gitlab_rails['gitlab_email_reply_to'] = '[email protected]';gitlab_rails['gitlab_email_subject_suffix'] = 'DEV-GIT';gitlab_rails['backup_keep_time'] = 172800;gitlab_rails['gitlab_shell_ssh_port'] = 9999;"

Yet, if I add the SSH port option to the gitlab.rb and reconfigure, I will see it in the clone address. So, while I am not using the composition method, I am launching the container with 'podman run' and passing options like those described in the docker guide for gitlab.

Upvotes: 0

appfrosch
appfrosch

Reputation: 1366

Although I have not been able to figure out the specific problem I had with the docker-compose.yml with version 3.1. I managed to compose one that works now for me though––perhaps it's useful to others as well:

version: '2.1'

services:
  frontproxy:
    restart: always
    image: jwilder/nginx-proxy
    labels:
      com.github.nginxproxy.acme-companion.frontproxy: true
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "certs-volume:/etc/nginx/certs:ro"
      - "/etc/nginx/vhost.d"
      - "/usr/share/nginx/html"
  nginx-letsencrypt-companion:
    restart: always
    image: nginxproxy/acme-companion
    volumes:
      - "certs-volume:/etc/nginx/certs"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    depends_on:
      - "frontproxy"
    volumes_from:
      - frontproxy
  gitlab:
    image: gitlab/gitlab-ce:latest
    restart: always
    hostname: 'dev.redacted.com'
    environment:
      VIRTUAL_HOST: 'dev.redacted.com'
      LETSENCRYPT_HOST: 'dev.redacted.com'
      LETSENCRYPT_EMAIL: '[email protected]'
      VIRTUAL_PROTO: 'https'
      VIRTUAL_PORT: '443'
      CERT_NAME: 'dev.redacted.com'
      GITLAB_SKIP_UNMIGRATED_DATA_CHECK: 'true'
      GITLAB_OMNIBUS_CONFIG: |
        # Email setup
        gitlab_rails['gitlab_email_enabled'] = true
        gitlab_rails['gitlab_email_from'] = '[email protected]'
        gitlab_rails['gitlab_email_display_name'] = 'Gitlab@Redacted'
        gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = 'mail.redacted.com'
        gitlab_rails['smtp_port'] = 587
        gitlab_rails['smtp_user_name'] = '[email protected]'
        gitlab_rails['smtp_password'] = 'myfancypassword'
        gitlab_rails['smtp_domain'] = 'redacted.com'
        gitlab_rails['smtp_authentication'] = 'login'
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['gitlab_root_email'] = '[email protected]'
        # HTTPS Setup
        letsencrypt['enable'] = false
        external_url 'https://dev.redacted.com'
        gitlab_rails['gitlab_https'] = true
        gitlab_rails['gitlab_port'] = 443
    ports:
      - '22:22'
    volumes:
      - ./config:/etc/gitlab
      - ./logs:/var/log/gitlab
      - ./data:/var/opt/gitlab
volumes:
  certs-volume:

Upvotes: 0

Related Questions