-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Expand file tree
/
Copy pathcompose.yml
More file actions
116 lines (106 loc) · 3.67 KB
/
Copy pathcompose.yml
File metadata and controls
116 lines (106 loc) · 3.67 KB
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
services:
proxy:
image: traefik:3.6
volumes:
# Add Docker as a mounted volume, so that Traefik can read the labels of other services
- /var/run/docker.sock:/var/run/docker.sock:ro
command:
# Enable Docker in Traefik, so that it reads labels from Docker services
- --providers.docker
# Do not expose all Docker services, only the ones explicitly exposed
- --providers.docker.exposedbydefault=false
# Create an entrypoint "http" listening on port 80
- --entrypoints.http.address=:80
# Enable the access log, with HTTP requests
- --accesslog
# Enable the Traefik log, for configurations and errors
- --log
db:
image: postgres:18
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
volumes:
- app-db-data:/var/lib/postgresql
env_file:
- .env
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
adminer:
image: adminer
depends_on:
- db
environment:
- ADMINER_DESIGN=pepa-linha-dark
labels:
# Enable Traefik for this service
- traefik.enable=true
# Route HTTP traffic for the Adminer subdomain
- traefik.http.routers.adminer-http.rule=Host(`adminer.${DOMAIN?Variable not set}`)
- traefik.http.routers.adminer-http.entrypoints=http
# Define the port inside of the Docker service to use
- traefik.http.services.adminer.loadbalancer.server.port=8080
backend:
image: backend:latest
depends_on:
db:
condition: service_healthy
restart: true
prestart:
condition: service_completed_successfully
# The YAML anchor lets the prestart service reuse this environment mapping.
environment: &backend-environment
FRONTEND_HOST: ${FRONTEND_HOST?Variable not set}
ENVIRONMENT: ${ENVIRONMENT}
PROJECT_NAME: ${PROJECT_NAME?Variable not set}
BACKEND_CORS_ORIGINS: ${BACKEND_CORS_ORIGINS}
SECRET_KEY: ${SECRET_KEY?Variable not set}
FIRST_SUPERUSER: ${FIRST_SUPERUSER?Variable not set}
FIRST_SUPERUSER_PASSWORD: ${FIRST_SUPERUSER_PASSWORD?Variable not set}
SMTP_HOST: ${SMTP_HOST}
SMTP_USER: ${SMTP_USER}
SMTP_PASSWORD: ${SMTP_PASSWORD}
EMAILS_FROM_EMAIL: ${EMAILS_FROM_EMAIL}
SMTP_TLS: ${SMTP_TLS}
SMTP_SSL: ${SMTP_SSL}
SMTP_PORT: ${SMTP_PORT}
POSTGRES_SERVER: db
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER?Variable not set}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD?Variable not set}
SENTRY_DSN: ${SENTRY_DSN}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/utils/health-check/"]
interval: 10s
timeout: 5s
retries: 5
build:
context: .
dockerfile: backend/Dockerfile
labels:
# Enable Traefik for this service
- traefik.enable=true
# Define the port inside of the Docker service to use
- traefik.http.services.backend.loadbalancer.server.port=8000
# Route HTTP traffic for this domain
- traefik.http.routers.backend-http.rule=Host(`${DOMAIN?Variable not set}`)
- traefik.http.routers.backend-http.entrypoints=http
prestart:
image: backend:latest
build:
context: .
dockerfile: backend/Dockerfile
depends_on:
db:
condition: service_healthy
restart: true
command: bash scripts/prestart.sh
environment: *backend-environment
volumes:
app-db-data: