-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-prod.yml
69 lines (63 loc) · 1.85 KB
/
docker-compose-prod.yml
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
# Work in progress
# TODO: create conn string for postgrs and rabbit in app. That way the passwords for both can be handled as secrets.
services:
rabbitmq:
container_name: ${RABBIT_CONTAINER_NAME}
image: rabbitmq:3.13-management
ports:
- ${RABBITMQ_PORT}:${RABBITMQ_PORT} # RabbitMQ messaging port
- "15672:15672" # RabbitMQ management UI port
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
networks:
- app-network
postgres:
image: postgres:16.4-alpine3.20
container_name: ${POSTGRES_CONTAINER_NAME}
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- app-network
fastapi:
build:
context: .
dockerfile: Dockerfile
args:
BASE_DIR: ${BASE_DIR}
container_name: ${FASTAPI_CONTAINER_NAME}
volumes:
- .:/app
depends_on:
- rabbitmq
- postgres
environment:
CELERY_BROKER_URL: amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@${RABBIT_CONTAINER_NAME}:${RABBITMQ_PORT}//
POSTGRES_CONNECTION_STRING: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_CONTAINER_NAME}/${POSTGRES_DB}
CELERY_CONFIG: ${CELERY_CONFIG}
JWT_SECRET_KEY: /run/secrets/jwt_secret_key #${JWT_SECRET_KEY}
ports:
- "9000:9000"
networks:
- app-network
secrets:
- celery_broker_url
- postgres_connection_string
- jwt_secret_key
networks:
app-network:
driver: bridge
volumes:
pgdata:
driver: local
secrets:
jwt_secret_token:
file: $SECRETSDIR/jwt_secret_token
postgres_password:
file: $SECRETSDIR/postgres_password
rabbitmq_password:
file: $SECRETSDIR/rabbitmq_password