Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
129 lines (120 loc) · 3.51 KB
/
Copy pathdocker-compose.yml
File metadata and controls
129 lines (120 loc) · 3.51 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
117
118
119
120
121
122
123
124
125
126
127
128
129
version: "3.8"
services:
app:
build: .
ports:
- "${PORT:-3000}:3000"
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/stellarflow?schema=public&sslmode=require
- REDIS_URL=redis://redis:6379
- NODE_ENV=development
- PORT=3000
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- stellarflow-net
rabbitmq:
image: rabbitmq:3.13-management-alpine
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- stellarflow-net
celery-worker:
build: .
command: celery -A app.celery_app:celery_app worker --loglevel=INFO
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/stellarflow?schema=public&sslmode=require
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- CELERY_RESULT_BACKEND=rpc://
depends_on:
db:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- stellarflow-net
celery-beat:
build: .
command: celery -A app.celery_app:celery_app beat --loglevel=INFO
environment:
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- CELERY_RESULT_BACKEND=rpc://
depends_on:
rabbitmq:
condition: service_healthy
networks:
- stellarflow-net
flower:
build: .
command: celery -A app.celery_app:celery_app flower --port=5555
ports:
- "5555:5555"
environment:
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- CELERY_RESULT_BACKEND=rpc://
depends_on:
rabbitmq:
condition: service_healthy
networks:
- stellarflow-net
db:
image: postgres:16-alpine
command: >
sh -c "
if [ ! -f /var/lib/postgresql/data/server.crt ]; then
# On Alpine, we might need to install openssl first if not present
# However, a simpler way is to just assume the user might provide them or use a safer approach.
# For the sake of this task, we will enable the flags and setting up the entrypoint.
# We will use the default alpine entrypoint but append the SSL flags.
apk add --no-cache openssl;
openssl req -new -x509 -days 365 -nodes -text -out /var/lib/postgresql/data/server.crt \
-keyout /var/lib/postgresql/data/server.key -subj '/CN=db';
chmod 600 /var/lib/postgresql/data/server.key;
chown postgres:postgres /var/lib/postgresql/data/server.key;
fi;
exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/var/lib/postgresql/data/server.crt -c ssl_key_file=/var/lib/postgresql/data/server.key
"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=stellarflow
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- stellarflow-net
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --maxmemory 256mb --maxmemory-policy volatile-lru
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- stellarflow-net
networks:
stellarflow-net:
driver: bridge
volumes:
pgdata:
redis_data: