forked from APTrust/pharos
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.traefik.yml
85 lines (82 loc) · 2.51 KB
/
docker-compose.traefik.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
version: '3'
services:
db:
image: postgres:9.6.15-alpine
restart: always
volumes:
- pgdata:/var/lib/postgresql/data
- ${DOCKERAPP_DATA_PATH:-./docker}/pgdata:/pgdata
networks:
- backend
ports:
- '5432:5432'
pharos:
image: registry.gitlab.com/aptrust/container-registry/pharos:${DOCKER_TAG_NAME:-latest}
restart: always
command: bundle exec puma -C config/puma.rb -e ${RAILS_ENV}
volumes:
- assets:/pharos/public
- ${DOCKERAPP_DATA_PATH:-./docker}/log:/pharos/log
depends_on:
- db
- migration
ports:
- 9292
networks:
- backend
- gateway
env_file:
- ".env"
logging:
driver: "gelf"
options:
gelf-address: "udp://${PHAROS_LOGSERVER}:${PHAROS_LOGSERVER_PORT}"
labels:
- "traefik.enable=true"
- "traefik.http.routers.pharos.rule=Host(`${VIRTUAL_HOST:-localhost}`)"
- "traefik.http.routers.pharos.entrypoints=secure"
- "traefik.http.routers.pharos.tls.certresolver=le"
- "traefik.http.routers.pharos.loadbalancer.server.port=9292"
migration:
image: registry.gitlab.com/aptrust/container-registry/pharos:${DOCKER_TAG_NAME:-latest}
# Note: Sleep 5 seconds before init db, so psql has time to start up.
command: /bin/bash -c "sleep 15 && bundle exec rake db:exists && time bundle exec rake db:migrate || (echo 'Init DB setup' && bundle exec rake db:setup && bundle exec rake pharos:setup)"
env_file:
- ".env"
logging:
driver: "gelf"
options:
gelf-address: "udp://${PHAROS_LOGSERVER}:${PHAROS_LOGSERVER_PORT}"
depends_on:
- db
networks:
- backend
nginx-assets:
image: nginx:alpine
container_name: nginx-assets
restart: always
ports:
- 80
- 443
volumes:
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./docker/nginx-proxy/pharosstatic_location:/etc/nginx/vhost.d/${VIRTUAL_HOST}_location.conf
- assets:/etc/share/nginx/html/pharos
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx-assets.rule=Host(`${VIRTUAL_HOST:-localhost}`) && PathPrefix(`/assets`)"
- "traefik.http.routers.nginx-assets.entrypoints=secure"
- "traefik.http.routers.nginx-assets.tls=true"
- "traefik.http.routers.nginx-assets.certresolver=le"
- "traefik.http.services.nginx-assets.loadbalancer.server.port=80"
networks:
- gateway
networks:
gateway:
external:
name: gateway
backend:
volumes:
pgdata:
assets: