0

I want to host a private Gitlab server on my Debian VPS. I figured using Docker would be a good setup.

I tried running Gitlab with the following code:

version: '3' services: gitlab: image: 'gitlab/gitlab-ce' restart: always hostname: 'gitlab.MYDOMAIN.com' links: - postgresql:postgresql - redis:redis environment: GITLAB_OMNIBUS_CONFIG: | postgresql['enable'] = false gitlab_rails['db_username'] = "gitlab" gitlab_rails['db_password'] = "gitlab" gitlab_rails['db_host'] = "postgresql" gitlab_rails['db_port'] = "5432" gitlab_rails['db_database'] = "gitlabhq_production" gitlab_rails['db_adapter'] = 'postgresql' gitlab_rails['db_encoding'] = 'utf8' redis['enable'] = false gitlab_rails['redis_host'] = 'redis' gitlab_rails['redis_port'] = '6379' external_url 'http://gitlab.MYDOMAIN.com:30080' gitlab_rails['gitlab_shell_ssh_port'] = 30022 ports: # both ports must match the port from external_url above - "30080:30080" # the mapped port must match ssh_port specified above. - "30022:22" # the following are hints on what volumes to mount if you want to persist data # volumes: # - data/gitlab/config:/etc/gitlab:rw # - data/gitlab/logs:/var/log/gitlab:rw # - data/gitlab/data:/var/opt/gitlab:rw postgresql: restart: always image: postgres:9.6.2-alpine environment: - POSTGRES_USER=gitlab - POSTGRES_PASSWORD=gitlab - POSTGRES_DB=gitlabhq_production # the following are hints on what volumes to mount if you want to persist data # volumes: # - data/postgresql:/var/lib/postgresql:rw redis: restart: always image: redis:3.0.7-alpine 

Running this (docker-compose run -d) allows me to reach Gitlab on MYDOMAIN.com:30080, but not on gitlab.MYDOMAIN.com:30080.

Have I made an error in the configuration? Or do I need to use reverse proxies (NGINX or Traefik)?

3 Answers 3

1

I'm pretty sure the hostname: gitlab.MYDOMAIN.rocks needs to match the external_url 'http://gitlab.MYDOMAIN.com:30080' until the port exactly

So for example:

hostname: gitlab.MYDOMAIN.com . . . more configuration . . . external_url 'http://gitlab.MYDOMAIN.com:30080' 
Sign up to request clarification or add additional context in comments.

1 Comment

Absolutely correct, but that was just a typo in my post. I have set those fields correctly in my config.
0

Did you check that the subdomain gitlab in dns is pointing to the right ip? Looks like an infrastructure problem more than a docker configuration one.

Regards

Comments

0

I managed to fix it myself!

  • I totally forgot to add an A-record, setting gitlab.mydomain.com to point to the same IP address as @.

  • I added the following block to the nginx configuration:

    upstream gitlab.mydomain.com { server 1.2.3.4:30080; # IP address of Docker container } server { server_name gitlab.mydomain.com; location / { proxy_pass http://gitlab.mydomain.com; } } 

    I use upstream because otherwise the url set in new Gitlab projects is set to the IP address, as mentioned here.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.