-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
191 lines (180 loc) · 5 KB
/
Copy pathdocker-compose.yml
File metadata and controls
191 lines (180 loc) · 5 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
version: '3.8'
services:
# =============== API GATEWAY ===============
api-gateway:
build:
context: .
dockerfile: Dockerfile
image: api-gateway:latest
container_name: api-gateway
ports:
- "9000:4000"
environment:
# URLs de los microservicios en la red de Docker
GX_BE_PROASIG_URL: "http://component-2-1:8080/graphql"
GX_BE_CALIF_URL: "http://component-2-2:8080/graphql"
GX_AUTH_URL: "http://component-4:8080/api/v1"
GX_SIA_URL: "http://component-1:8000/api"
PORT: 4000
depends_on:
- component-1
- component-2-1
- component-2-2
- component-4
restart: always
networks:
- microservices-network
# =============== MICROSERVICIO SIA COLEGIOS (Component-1) ===============
component-1:
build:
context: ../component-1
dockerfile: Dockerfile
image: component-1:latest
container_name: component-1
ports:
- "8083:8000"
environment:
- DB_HOST=sia-db
- DB_NAME=sia_colegios
- DB_USER=postgres
- DB_PASSWORD=postgres
- DB_PORT=5432
- LOAD_INITIAL_DATA=true
command: ["django"]
depends_on:
- sia-db
restart: always
networks:
- microservices-network
# Base de datos PostgreSQL para SIA Colegios
sia-db:
image: postgres:17-alpine
container_name: sia-db
environment:
POSTGRES_DB: sia_colegios
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_ENCODING: UTF8
ports:
- "5433:5432"
volumes:
- sia_db_data:/var/lib/postgresql/data
- ../component-1-master/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
restart: always
networks:
- microservices-network
# =============== MICROSERVICIO DE AUTENTICACIÓN (Component-4) ===============
component-4:
build:
context: ./components/component-4
dockerfile: Dockerfile
image: component-4:latest
container_name: component-4
ports:
- "8082:8080"
environment:
- PORT=${PORT:-8080}
- JWT_SECRET=${JWT_SECRET:-mi-super-secreto-jwt-para-desarrollo-123456789}
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID:-tu-google-client-id-aqui}
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET:-tu-google-client-secret-aqui}
- GOOGLE_REDIRECT_URL=${GOOGLE_REDIRECT_URL:-http://localhost:8082/api/v1/auth/google/callback}
- DB_HOST=auth-db
- DB_PORT=5432
- DB_USER=authuser
- DB_PASSWORD=authpass
- DB_NAME=authdb
- DB_SSL_MODE=disable
depends_on:
auth-db:
condition: service_healthy
restart: always
networks:
- microservices-network
# Base de datos PostgreSQL para autenticación
auth-db:
image: postgres:16
container_name: auth-db
environment:
POSTGRES_DB: authdb
POSTGRES_USER: authuser
POSTGRES_PASSWORD: authpass
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
volumes:
- auth_db_data:/var/lib/postgresql/data
- ./components/component-4/migrations:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U authuser -d authdb"]
interval: 5s
timeout: 5s
retries: 5
restart: always
networks:
- microservices-network
# =============== MICROSERVICIO PROFESORES Y ASIGNATURAS (Component-2-1) ===============
component-2-1:
build:
context: ../component-2-1
dockerfile: Dockerfile
image: component-2-1:latest
container_name: component-2-1
ports:
- "8080:8080"
environment:
SPRING_DATA_MONGODB_URI: mongodb://mongo-professors:27017/profesores_db
SPRING_GRAPHQL_SCHEMA_LOCATION: classpath:/graphql/
depends_on:
- mongo-professors
restart: always
networks:
- microservices-network
# MongoDB para profesores y asignaturas
mongo-professors:
image: mongo:6.0
container_name: mongo-professors
ports:
- "27018:27017"
volumes:
- mongo_professors_data:/data/db
restart: always
networks:
- microservices-network
# =============== MICROSERVICIO DE CALIFICACIONES (Component-2-2) ===============
component-2-2:
build:
context: ../component-2-2
dockerfile: Dockerfile
image: component-2-2:latest
container_name: component-2-2
ports:
- "8081:8080"
environment:
SPRING_DATA_MONGODB_URI: mongodb://mongo-grades:27017/calificaciones_db
SPRING_GRAPHQL_SCHEMA_LOCATION: classpath:/graphql/
depends_on:
- mongo-grades
restart: always
networks:
- microservices-network
# MongoDB para calificaciones
mongo-grades:
image: mongo:6.0
container_name: mongo-grades
ports:
- "27019:27017"
volumes:
- mongo_grades_data:/data/db
restart: always
networks:
- microservices-network
# Volúmenes para persistencia de datos
volumes:
auth_db_data:
mongo_professors_data:
mongo_grades_data:
sia_db_data:
# Red para comunicación entre microservicios
networks:
microservices-network:
driver: bridge