Skip to content

Instantly share code, notes, and snippets.

@ryands
Created August 9, 2018 00:19
Show Gist options
  • Save ryands/ab54fd05507bfbcff850bff771939375 to your computer and use it in GitHub Desktop.
Save ryands/ab54fd05507bfbcff850bff771939375 to your computer and use it in GitHub Desktop.
gitlab-ce omnibus docker behind a local nginx reverse proxy (letsencrypt ssl termination at local nginx)
version: '3'
services:
gitlab:
image: gitlab/gitlab-ce:latest
hostname: gitlab.example.com
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com/'
nginx['listen_port'] = 80
nginx['listen_https'] = false
letsencrypt['enable'] = false
gitlab_rails['gitlab_shell_ssh_port'] = 31022
registry_external_url 'https://registry.example.com/'
registry_nginx['listen_https'] = false
registry_nginx['proxy_set_headers'] = {
"X-Forwarded-Proto" => "https",
"X-Forwarded-Ssl" => "on"
}
ports:
- '31080:80'
- '31088:8080'
- '31022:22'
volumes:
- './config:/etc/gitlab'
- './data:/var/opt/gitlab'
- './logs:/var/log/gitlab'
server {
listen 443 ssl;
server_name gitlab.example.com;
ssl on;
ssl_certificate /letsencrypt/fullchain.pem;
ssl_certificate_key /letsencrypt/live/privkey.pem;
location / {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://127.0.0.1:31080;
}
}
server {
listen 443 ssl;
server_name registry.example.com;
ssl on;
ssl_certificate /letsencrypt/fullchain.pem;
ssl_certificate_key /letsencrypt/privkey.pem;
location / {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://127.0.0.1:31080;
}
}
@smilence86
Copy link

The port format is "HOST:CONTAINER", should '22:31022' at line 23?

@rain2307
Copy link

what's in port 8080 ?

@kyberorg
Copy link

kyberorg commented May 2, 2023

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment