forked from Sherevv/fastapi-react-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
126 lines (117 loc) · 3.03 KB
/
docker-compose.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
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
version: "3.8"
services:
db:
container_name: postgres_db
image: postgres:14.2
restart: always
ports:
- "${POSTGRES_PORT}:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data/
networks:
- postgres
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: 'False'
volumes:
- pgadmin:/var/lib/pgadmin
ports:
- "${PGADMIN_PORT:-5050}:80"
networks:
- postgres
restart: unless-stopped
redis:
container_name: redis
image: redis:7-alpine
ports:
- 6379:6379
networks:
- rabbitmq
rabbitmq3:
container_name: rabbitmq
image: rabbitmq:3-management
ports:
- 15672:15672
- 5672:5672
- 25676:25676
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
networks:
- postgres
- rabbitmq
backend:
container_name: backend
build:
context: .
target: backend
command: uvicorn app.main:app --host 0.0.0.0 --reload
environment:
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- BROKER_URL=pyamqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@rabbitmq3:5672
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- db
- rabbitmq3
- redis
networks:
- postgres
- rabbitmq
flower:
container_name: flower
build:
context: .
target: backend
command: celery -A app.worker:celery flower --loglevel=DEBUG
ports:
- 5556:5555
environment:
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- BROKER_URL=pyamqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@rabbitmq3:5672
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- FLOWER_BROKER_API=http://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@rabbitmq3:15672/api/
- FLOWER_DEBUG=True
volumes:
- "./backend:/app"
depends_on:
- backend
- rabbitmq3
- redis
networks:
- postgres
- rabbitmq
worker:
container_name: celery
build:
context: .
target: backend
command: celery -A app.worker:celery worker --loglevel=info
volumes:
- "./backend:/app"
environment:
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- BROKER_URL=pyamqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@rabbitmq3:5672
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- backend
- rabbitmq3
- redis
networks:
- postgres
- rabbitmq
volumes:
postgres_data:
pgadmin:
networks:
postgres:
driver: bridge
rabbitmq:
driver: bridge