Я несколько дней пытался запустить gitlab через docker-composing через Traefik. Я нашел несколько тем об этом, но ни одна из них не решила мою проблему. Поэтому я хотел бы открыть тему сегодня.
Я очень помог себе со следующим примером: https://github.com/ambroisemaupate/docker-server-env/blob/master/compose/example-gitlab-traefik/docker-compose.yml
version: '3'
services:
traefik:
container_name: traefik
image: traefik:1.7.3 # The official Traefik docker image
restart: always
command: --api --docker # Enables the web UI and tells Traefik to listen to docker
ports:
- "80:80" # The HTTP port
- "443:443" # The HTTPS port
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
- ./conf/traefik.toml:/traefik.toml
- ./conf/acme.json:/acme.json
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik_network"
- "traefik.port=80"
- "traefik.entryPoint=https"
- "traefik.backend=traefik"
- "traefik.frontend.rule=Host:traefik.domain.com"
networks:
- traefik_network
gitlab:
container_name: gitlab
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab.domain.com'
labels:
- "traefik.docker.network=traefik_network"
- "traefik.enable=true"
- "traefik.port=80"
- "traefik.frontend.rule=Host:https://gitlab.domain.com"
- "traefik.frontend.entryPoints=https"
healthcheck:
disable: true
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.giftdigging.com'
nginx['redirect_http_to_https'] = false
nginx['listen_port'] = 80
nginx['listen_https'] = false
nginx['proxy_set_headers'] = {
'X-Forwarded-Proto' => 'https',
'X-Forwarded-Ssl' => 'on'
}
nginx['client_max_body_size'] = '2G'
unicorn['worker_timeout'] = 60
unicorn['worker_processes'] = 2
sidekiq['concurrency'] = 15
postgresql['shared_buffers'] = "512MB"
gitlab_rails['artifacts_enabled'] = true
gitlab_rails['artifacts_path'] = "/var/opt/gitlab/gitlab-artifacts"
gitlab_rails['lfs_enabled'] = true
gitlab_rails['backup_keep_time'] = 172600
gitlab_ci['backup_keep_time'] = 172600
ports:
- '22:22'
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/srv/gitlab/data:/var/opt/gitlab'
networks:
- traefik_network
networks:
traefik_network:
external: true
internal_network:
external: false
и моим traefik.toml
debug = false
logLevel = "INFO"
defaultEntryPoints = ["https", "http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "domain.com"
watch = true
exposedByDefault = false
[acme]
email = "contact@monsite.co"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"
Я получаю предупреждение о безопасности и сертификат, подписанный Traefik.
И, если я принимаю на себя риск, несмотря на предупреждение моего браузера, я получаю страницу 404, не найденную.