Skip to content

Commit 34f297d

Browse files
Merge pull request #593 from DefangLabs/jordan/compose-project-names
add project names and deploy resources to all samples
2 parents 0a8837a + 1baa74f commit 34f297d

1 file changed

Lines changed: 47 additions & 33 deletions

File tree

compose.yaml

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,71 @@
1+
name: django-redis-postgres
12
services:
23
app:
3-
# uncomment to add your own domain
4-
# domainname: example.com
54
build:
65
context: ./app
76
dockerfile: Dockerfile
87
ports:
9-
- target: 8000
10-
published: 8000
11-
mode: ingress
8+
- target: 8000
9+
published: 8000
10+
mode: ingress
1211
environment:
13-
- REDIS_URL=redis://redis-service:6379
14-
# if using BYOC add sslmode=require to the POSTGRES_URL query params
15-
- POSTGRES_URL=postgres://djangouser:${POSTGRES_PASSWORD}@postgres-service:5432/djangodatabase?
16-
- SECRET_KEY
12+
- REDIS_URL=redis://redis-service:6379
13+
- POSTGRES_URL=postgres://djangouser:${POSTGRES_PASSWORD}@postgres-service:5432/djangodatabase?
14+
- SECRET_KEY
1715
healthcheck:
18-
# wget or curl required for healthchecks on services with a published port
19-
# this gets parsed by Defang and provided to the load balancers as well
20-
test: ["CMD", "python3", "-c", "import sys, urllib.request; urllib.request.urlopen(sys.argv[1]).read()", "http://localhost:8000/"]
16+
test:
17+
- CMD
18+
- python3
19+
- -c
20+
- import sys, urllib.request; urllib.request.urlopen(sys.argv[1]).read()
21+
- http://localhost:8000/
2122
interval: 10s
2223
depends_on:
23-
- redis-service
24-
- postgres-service
25-
- migrate
26-
24+
- redis-service
25+
- postgres-service
26+
- migrate
27+
deploy:
28+
resources:
29+
reservations:
30+
cpus: '0.5'
31+
memory: 512M
2732
redis-service:
2833
image: redis:6.2
29-
# uncomment the following line in BYOC
30-
# x-defang-redis: true
3134
ports:
32-
- mode: host
33-
target: 6379
34-
35+
- mode: host
36+
target: 6379
37+
deploy:
38+
resources:
39+
reservations:
40+
cpus: '0.5'
41+
memory: 512M
3542
migrate:
36-
restart: "no"
43+
restart: 'no'
3744
build:
3845
context: ./app
3946
dockerfile: Dockerfile
4047
command: python manage.py migrate
4148
depends_on:
42-
- postgres-service
49+
- postgres-service
4350
environment:
44-
- POSTGRES_URL=postgres://djangouser:${POSTGRES_PASSWORD}@postgres-service:5432/djangodatabase?
45-
- SECRET_KEY
46-
51+
- POSTGRES_URL=postgres://djangouser:${POSTGRES_PASSWORD}@postgres-service:5432/djangodatabase?
52+
- SECRET_KEY
53+
deploy:
54+
resources:
55+
reservations:
56+
cpus: '0.5'
57+
memory: 512M
4758
postgres-service:
4859
image: postgres:16.4
49-
# uncomment the following line in BYOC
50-
# x-defang-postgres: true
5160
ports:
52-
- mode: host
53-
target: 5432
61+
- mode: host
62+
target: 5432
5463
environment:
55-
- POSTGRES_PASSWORD
56-
- POSTGRES_DB=djangodatabase
57-
- POSTGRES_USER=djangouser
64+
- POSTGRES_PASSWORD
65+
- POSTGRES_DB=djangodatabase
66+
- POSTGRES_USER=djangouser
67+
deploy:
68+
resources:
69+
reservations:
70+
cpus: '0.5'
71+
memory: 512M

0 commit comments

Comments
 (0)