-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.shared.yaml
179 lines (163 loc) · 5.94 KB
/
docker-compose.shared.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
version: "3.9"
services:
traefik:
image: "traefik:v2.10"
container_name: "traefik"
command:
- "--accesslog=true"
- "--accesslog.fields.headers.names.x-correlation-id=keep"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
# Adds correlation id
- "--tracing.jaeger.samplingparam=0"
- "--tracing.jaeger.tracecontextheadername=x-correlation-id"
labels:
- "traefik.enable=true"
- "traefik.http.routers.edge-router.entrypoints=web"
- "traefik.http.routers.edge-router.rule=Host(`traefik.console.$DOMAIN`)"
- "traefik.http.services.edge-router.loadbalancer.server.port=8080"
ports:
- 80:80
restart: "unless-stopped"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
api:
container_name: "api"
environment:
DB_DATABASE: "api"
DB_HOST: "db"
DB_PASSWORD: "$POSTGRES_PASSWORD"
DB_PORT: 5432
DB_USERNAME: "$POSTGRES_USERNAME"
EMAIL: "$EMAIL"
LOG_LEVEL: "$LOG_LEVEL"
PORT: 80
S3_ACCESS_KEY: "$MINIO_ACCESS_KEY"
S3_ENDPOINT: "minio"
S3_PUBLIC_ENDPOINT: "$PROTOCOL://s3.$DOMAIN"
S3_SECRET_KEY: "$MINIO_SECRET_KEY"
SMTP_HOST: "$SMTP_HOST"
SMTP_PASSWORD: "$SMTP_PASSWORD"
SMTP_PORT: "$SMTP_PORT"
SMTP_USERNAME: "$SMTP_USERNAME"
UI_DOMAIN: "$PROTOCOL://$DOMAIN"
VAPID_PUBLIC_KEY: "$VAPID_PUBLIC_KEY"
VAPID_PRIVATE_KEY: "$VAPID_PRIVATE_KEY"
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`$DOMAIN`)&&PathPrefix(`/api`)"
- "traefik.http.routers.api.entrypoints=web"
- "traefik.http.routers.api.middlewares=auth"
- "traefik.http.routers.api-healthcheck.rule=Host(`$DOMAIN`)&&PathPrefix(`/api/health`)"
- "traefik.http.routers.api-healthcheck.entrypoints=web"
restart: "unless-stopped"
console:
image: ghcr.io/benphelps/homepage:latest
container_name: console
environment:
HOMEPAGE_VAR_DOMAIN: "$DOMAIN"
labels:
- "traefik.enable=true"
- "traefik.http.routers.console.rule=Host(`console.$DOMAIN`)"
- "traefik.http.routers.console.entrypoints=web"
volumes:
- "$PWD/config/console/:/app/config"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
auth-api:
container_name: "auth-api"
labels:
- "traefik.enable=true"
- "traefik.http.routers.auth-api.rule=Host(`$DOMAIN`)&&(PathPrefix(`/auth/api`)||PathPrefix(`/logout`))"
- "traefik.http.routers.auth-api.entrypoints=web"
- "traefik.http.middlewares.auth.forwardauth.address=http://auth-api/authenticate"
- "traefik.http.middlewares.auth.forwardauth.authResponseHeaders=x-user-id"
environment:
API_URL: "$PROTOCOL://$DOMAIN"
UI_URL: "$PROTOCOL://$DOMAIN"
SUPERTOKENS_URL: "http://supertokens:3567"
restart: "unless-stopped"
auth-ui:
container_name: "auth-ui"
labels:
- "traefik.enable=true"
- "traefik.http.routers.auth-ui.rule=Host(`$DOMAIN`)&&PathPrefix(`/login`)"
- "traefik.http.routers.auth-ui.entrypoints=web"
environment:
API_URL: "$PROTOCOL://$DOMAIN"
UI_URL: "$PROTOCOL://$DOMAIN"
SUPERTOKENS_URL: "http://supertokens:3567"
restart: "unless-stopped"
db:
image: "postgis/postgis:15-3.3-alpine"
container_name: "db"
environment:
POSTGRES_PASSWORD: "$POSTGRES_PASSWORD"
POSTGRES_USERNAME: "$POSTGRES_USERNAME"
labels:
- "com.centurylinklabs.watchtower.enable=false"
ports:
- "5432:5432"
volumes:
- "$PWD/config/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql"
- ".data/postgres:/var/lib/postgresql/data:rw"
restart: "unless-stopped"
pgadmin:
image: "dpage/pgadmin4"
container_name: "pgadmin"
environment:
PGADMIN_DEFAULT_EMAIL: "$PGADMIN_EMAIL"
PGADMIN_DEFAULT_PASSWORD: "$PGADMIN_PASSWORD"
labels:
- "traefik.enable=true"
- "traefik.http.routers.pgadmin.rule=Host(`pgadmin.console.$DOMAIN`)"
- "traefik.http.routers.pgadmin.entrypoints=web"
volumes:
- ".data/pgadmin:/var/lib/pgadmin:rw"
supertokens:
image: "registry.supertokens.io/supertokens/supertokens-postgresql:5.0"
container_name: "supertokens"
environment:
POSTGRESQL_CONNECTION_URI: "postgresql://$POSTGRES_USERNAME:$POSTGRES_PASSWORD@db:5432/"
restart: "unless-stopped"
web-ui:
container_name: "web-ui"
labels:
- "traefik.enable=true"
- "traefik.http.routers.web-ui.rule=Host(`$DOMAIN`)&&!PathPrefix(`/api`)"
- "traefik.http.routers.web-ui.entrypoints=web"
restart: "unless-stopped"
minio:
image: "minio/minio"
container_name: "minio"
command:
- "server"
- "/data"
- "--console-address"
- ":9001"
environment:
MINIO_ACCESS_KEY: $MINIO_ACCESS_KEY
MINIO_SECRET_KEY: $MINIO_SECRET_KEY
labels:
- "traefik.enable=true"
- "traefik.http.routers.minio.entrypoints=web"
- "traefik.http.routers.minio.rule=Host(`minio.console.$DOMAIN`)"
- "traefik.http.routers.minio.service=minio"
- "traefik.http.services.minio.loadbalancer.server.port=9001"
- "traefik.http.routers.s3.entrypoints=web"
- "traefik.http.routers.s3.rule=Host(`s3.$DOMAIN`)"
- "traefik.http.routers.s3.service=s3"
- "traefik.http.services.s3.loadbalancer.server.port=9000"
- "traefik.http.middlewares.s3-cache.headers.customresponseheaders.Cache-Control=max-age=604800" # Cached for 1 week. Objects should be immutable and we can use a hard cache
- "traefik.http.routers.s3.middlewares=s3-cache"
restart: "unless-stopped"
volumes:
- ".data/mino:/data:rw"
tracking:
container_name: "tracking"
labels:
- "traefik.enable=true"
- "traefik.http.routers.tracking.rule=Host(`$DOMAIN`)&&(PathPrefix(`/tracking`))"
- "traefik.http.routers.tracking.entrypoints=web"
restart: "unless-stopped"