-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
109 lines (102 loc) · 3.06 KB
/
Copy pathcompose.yaml
File metadata and controls
109 lines (102 loc) · 3.06 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
x-app-environment: &app-environment
APP_NAME: "${APP_NAME:-core-crewsim}"
APP_ENV: "${APP_ENV:-development}"
APP_DEBUG: "${APP_DEBUG:-false}"
API_PREFIX: "${API_PREFIX:-/api}"
CORS_ORIGINS: "${CORS_ORIGINS:-http://localhost:5173}"
DB_HOST: "${DB_HOST:-db}"
DB_PORT: "${DB_PORT:-5432}"
DB_DATABASE: "${DB_DATABASE:-${POSTGRES_DB:-core_crewsim}}"
DB_USERNAME: "${DB_USERNAME:-${POSTGRES_USER:-postgres}}"
DB_PASSWORD: "${DB_PASSWORD:-${POSTGRES_PASSWORD:-postgres}}"
x-app-service: &app-service
image: core-crewsim:local
build:
context: .
environment: *app-environment
services:
db:
image: postgres:18-alpine@sha256:9a8afca54e7861fd90fab5fdf4c42477a6b1cb7d293595148e674e0a3181de15
environment:
POSTGRES_DB: "${DB_DATABASE:-${POSTGRES_DB:-core_crewsim}}"
POSTGRES_USER: "${DB_USERNAME:-${POSTGRES_USER:-postgres}}"
POSTGRES_PASSWORD: "${DB_PASSWORD:-${POSTGRES_PASSWORD:-postgres}}"
volumes:
- postgres_data:/var/lib/postgresql
healthcheck:
test:
- CMD-SHELL
- pg_isready -U "$${POSTGRES_USER}" -d "$${POSTGRES_DB}"
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
restart: unless-stopped
migrate:
<<: *app-service
command: ["alembic", "upgrade", "head"]
depends_on:
db:
condition: service_healthy
healthcheck:
disable: true
restart: "no"
api:
<<: *app-service
command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
ports:
- "${APP_PORT:-8000}:8000"
depends_on:
db:
condition: service_healthy
migrate:
condition: service_completed_successfully
restart: unless-stopped
stop_grace_period: 10s
pgadmin:
image: dpage/pgadmin4:latest
environment:
PGADMIN_DEFAULT_EMAIL: "${PGADMIN_DEFAULT_EMAIL:-admin@example.com}"
PGADMIN_DEFAULT_PASSWORD: "${PGADMIN_DEFAULT_PASSWORD:-admin}"
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_REPLACE_SERVERS_ON_STARTUP: "True"
PGPASS_FILE: /pgadmin4/pgpass
ports:
- "127.0.0.1:${PGADMIN_PORT:-5051}:80"
volumes:
- pgadmin_data:/var/lib/pgadmin
configs:
- source: pgadmin_servers
target: /pgadmin4/servers.json
- source: pgadmin_pgpass
target: /pgadmin4/pgpass
mode: 0600
depends_on:
db:
condition: service_healthy
restart: unless-stopped
volumes:
postgres_data:
pgadmin_data:
configs:
pgadmin_servers:
content: |
{
"Servers": {
"1": {
"Name": "Core CrewSim",
"Group": "Servers",
"Host": "db",
"Port": 5432,
"MaintenanceDB": "${DB_DATABASE:-${POSTGRES_DB:-core_crewsim}}",
"Username": "${DB_USERNAME:-${POSTGRES_USER:-postgres}}",
"ConnectionParameters": {
"sslmode": "prefer",
"connect_timeout": 10
}
}
}
}
pgadmin_pgpass:
content: |
db:5432:*:${DB_USERNAME:-${POSTGRES_USER:-postgres}}:${DB_PASSWORD:-${POSTGRES_PASSWORD:-postgres}}