This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.traefik.yml
97 lines (93 loc) · 3.37 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
86
87
88
89
90
91
92
93
94
95
96
97
---
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=true"
- "traefik.http.routers.pharos.tls.certresolver=le"
- "traefik.http.services.pharos.loadbalancer.server.port=9292"
# CORS Headers
- "traefik.http.middlewares.pharos.headers.accesscontrolalloworiginlist=https://demo.aptrust.org,https://repo.aptrust.org,https://aptrust.github.io"
- "traefik.http.middlewares.pharos.headers.accessControlAllowCredentials=true"
- "traefik.http.middlewares.pharos.headers.accesscontrolallowmethods=GET,PUT,POST,DELETE,OPTIONS"
- "traefik.http.middlewares.pharos.headers.accessControlAllowHeaders=Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-Pharos-API-KEY,X-Pharos-API-User,api_key"
#PerformanceSettings
- "traefik.http.middlewares.limit.buffering.maxRequestBodyBytes=0"
- "traefik.http.middlewares.pharos.compress=true"
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"
volumes:
- ${DOCKERAPP_DATA_PATH:-./docker}/log:/pharos/log
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.tls.certresolver=le"
- "traefik.http.services.nginx-assets.loadbalancer.server.port=80"
networks:
- gateway
networks:
gateway:
external:
name: gateway
backend:
volumes:
pgdata:
assets: