1

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: 'splash@redacted.com'
      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'] = 'admin@redacted.com'
        gitlab_rails['gitlab_email_display_name'] = 'Gitlab@redacted.com'
        gitlab_rails['gitlab_email_reply_to'] = 'admin@redacted.com'
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = 'mail.redacted.com'
        gitlab_rails['smtp_port'] = 587
        gitlab_rails['smtp_user_name'] = 'admin@redacted.com'
        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'] = 'admin@redacted.com'
        # 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
appfrosch
  • 1,146
  • 13
  • 36
  • 1
    You're already mounting in `./config` to `/etc/gitlab` you can just create the file `config/gitlab.rb` instead of using the environment variable. Beside that, you need to tell us specifically what is not working. Are you getting an error? Or is the configuration simply not working as expected; and how exactly? What is the expected behavior and what is the behavior you are observing? – sytech Nov 28 '21 at 04:29
  • Yes, sorry, I wasn't too specific I am afraid... Also, after having played around a lot now, I cannot figure out what the specific error has been; I managed to make it working though in the meantime and will post my now running `docker-compose.yml`--in hopes that it might help someone else. – appfrosch Nov 28 '21 at 21:00
  • 1
    Looks like the issue was likely a typo of indenting the first comment (`# Email setup`) properly in your YAML. – sytech Nov 30 '21 at 02:18
  • I can confirm: that's exactly what was happening, I tried again. Do you want to alter your comment to an answer so that I can accept it as such? – appfrosch Dec 01 '21 at 07:38
  • Thanks for confirming that. In this case, it would be [best to close/delete the question](https://meta.stackoverflow.com/q/366135/5747944) instead of answering it. This is because it was caused by a Typo and would be unlikely to help future readers that come across this question. So, feel free to delete the question -- or it will probably be closed on its own whenever a moderator or other voters come get around to reviewing and closing the question as such. – sytech Dec 01 '21 at 08:48
  • 1
    That makes sense I guess... I voted to have it closed because of the type; my understanding is that deleting can have bad implications... – appfrosch Dec 01 '21 at 09:08
  • @sytech I disagree. This is _exactly_ the sort of thing that causes most errors with GitLab configuration specifically, and YAML configs in general. This is a _syntax_ error, not a typo. – Auspex Aug 12 '22 at 08:52

2 Answers2

0

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: 'admin@redacted.com'
      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'] = 'admin@redacted.com'
        gitlab_rails['gitlab_email_display_name'] = 'Gitlab@Redacted'
        gitlab_rails['gitlab_email_reply_to'] = 'admin@redacted.com'
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = 'mail.redacted.com'
        gitlab_rails['smtp_port'] = 587
        gitlab_rails['smtp_user_name'] = 'admin@redacted.com'
        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'] = 'admin@redacted.com'
        # 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:
appfrosch
  • 1,146
  • 13
  • 36
  • You should fix _"I have not been able to figure out the specific problem…"_ now that you know it was indentation in the YAML config, and accept the answer. – Auspex Aug 12 '22 at 09:04
0

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'] = 'dev@foo.com';gitlab_rails['gitlab_email_display_name'] = 'DEV-GitLab';gitlab_rails['gitlab_email_reply_to'] = 'dev@foo.com';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.

  • I guess your issue is not the same as mine, I am afraid–though you had no chance of realising, as I had not stated my exact error message initially. Sorry for that. But I take it you where able to make yours work already? – appfrosch Dec 01 '21 at 07:40
  • Not really. It turns out, though, there are multiple hurdles here. One thing I verified is that the gitlab.rb file is, by default, empty; all comments actually. So, I changed my script to replace the gitlab.rb that the omnibus will install with the entries I care about. As long as gitlab continue to emit an effectively empty configuration, this is reliable. The other problem, which is worse, is Ubuntu. I'm working to install on another OS in a similarly automated fashion. – beewoolie Dec 02 '21 at 17:04
  • I'd suspect this is exactly the same as the OP's issue. I don't imagine that sticking all those assignments on a single line is valid YAML. Do you see a parser error as @ASSeeger did? – Auspex Aug 12 '22 at 08:54