Skip to content

Commit be12815

Browse files
Merge pull request #593 from DefangLabs/jordan/compose-project-names
add project names and deploy resources to all samples
2 parents be396be + 3a67d9b commit be12815

1 file changed

Lines changed: 35 additions & 12 deletions

File tree

compose.yaml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: fastapi-postgres-pubsub
12
services:
23
app_a:
34
build:
@@ -8,16 +9,24 @@ services:
89
condition: service_healthy
910
environment:
1011
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres?sslmode=${SSL_MODE}
11-
SSL_MODE: # just here so it gets picked up by our tests
12+
SSL_MODE: null
1213
ports:
13-
- "8000:8000"
14+
- 8000:8000
1415
healthcheck:
15-
test: ["CMD", "curl", "-f", "http://localhost:8000/healthz"]
16+
test:
17+
- CMD
18+
- curl
19+
- -f
20+
- http://localhost:8000/healthz
1621
interval: 30s
1722
timeout: 5s
1823
retries: 3
1924
start_period: 10s
20-
25+
deploy:
26+
resources:
27+
reservations:
28+
cpus: '0.5'
29+
memory: 512M
2130
app_b:
2231
build:
2332
context: ./app
@@ -28,28 +37,42 @@ services:
2837
environment:
2938
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres?sslmode=${SSL_MODE}
3039
ports:
31-
- "8001:8000"
40+
- 8001:8000
3241
healthcheck:
33-
test: ["CMD", "curl", "-f", "http://localhost:8000/healthz"]
42+
test:
43+
- CMD
44+
- curl
45+
- -f
46+
- http://localhost:8000/healthz
3447
interval: 30s
3548
timeout: 5s
3649
retries: 3
3750
start_period: 10s
38-
51+
deploy:
52+
resources:
53+
reservations:
54+
cpus: '0.5'
55+
memory: 512M
3956
postgres:
4057
image: postgres:16
4158
restart: always
4259
environment:
4360
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
4461
ports:
45-
- mode: host
46-
target: 5432
47-
published: 5432
62+
- mode: host
63+
target: 5432
64+
published: 5432
4865
x-defang-postgres: true
4966
healthcheck:
50-
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
67+
test:
68+
- CMD-SHELL
69+
- pg_isready -U postgres -d postgres
5170
interval: 10s
5271
timeout: 5s
5372
retries: 5
5473
start_period: 5s
55-
74+
deploy:
75+
resources:
76+
reservations:
77+
cpus: '0.5'
78+
memory: 512M

0 commit comments

Comments
 (0)