-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
157 lines (149 loc) · 3.41 KB
/
docker-compose.yml
File metadata and controls
157 lines (149 loc) · 3.41 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
services:
db:
image: postgres:14-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- ./.env
ports:
- "127.0.0.1:15432:5432" # Restringido a localhost
restart: unless-stopped
networks:
- klu-net
deploy:
resources:
limits:
cpus: '1'
memory: 1G
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes
ports:
- "127.0.0.1:16379:6379" # Restringido a localhost
volumes:
- redis_data:/data
restart: unless-stopped
networks:
- klu-net
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
healthcheck:
test: [ "CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping" ]
interval: 10s
timeout: 5s
retries: 5
api:
build:
context: ./klu_backend
dockerfile: Dockerfile
args:
- ENVIRONMENT=production
command: uv run uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4 --limit-concurrency 100 --backlog 128 --proxy-headers
ports:
- "127.0.0.1:18000:8000" # Restringido a localhost
env_file:
- ./.env
environment:
- DB_TYPE=postgres
- POSTGRES_SERVER=db
- REDIS_HOST=redis
- REDIS_PASSWORD=${REDIS_PASSWORD}
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
networks:
- klu-net
deploy:
resources:
limits:
cpus: '1'
memory: 1G
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/healthcheck" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
celery_worker:
build:
context: ./klu_backend
dockerfile: Dockerfile
command: uv run celery -A app.worker worker -Q celery,payments-queue --loglevel=info
env_file:
- ./.env
environment:
- DB_TYPE=postgres
- POSTGRES_SERVER=db
- REDIS_HOST=redis
- REDIS_PASSWORD=${REDIS_PASSWORD}
depends_on:
- api
- redis
restart: unless-stopped
networks:
- klu-net
deploy:
resources:
limits:
cpus: '1'
memory: 1G
flower:
image: mher/flower
command: celery --broker=redis://:${REDIS_PASSWORD}@redis:6379/0 flower --port=5555 --basic_auth=admin:admin
ports:
- "15555:5555"
depends_on:
- redis
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD}
networks:
- klu-net
frontend:
build:
context: ./klu_ui
dockerfile: Dockerfile
ports:
- "13000:3000"
env_file:
- ./.env
environment:
- NEXT_PUBLIC_API_URL=https://api:8000/api/v1 # Usa nombre de servicio
depends_on:
- api
restart: unless-stopped
networks:
- klu-net
deploy:
resources:
limits:
cpus: '1'
memory: 1G
nginx:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./certs:/etc/nginx/certs # Directorio con tus certificados SSL
ports:
- "443:443"
networks:
- klu-net
restart: unless-stopped
networks:
klu-net:
driver: bridge
volumes:
postgres_data:
driver: local
redis_data:
driver: local