- update: docker compose to add custom networks

- add: get service endpoints by using consul dns
This commit is contained in:
2025-03-10 06:09:26 -04:00
parent ae04d2bf5b
commit 81068759e5
8 changed files with 105 additions and 13 deletions

View File

@@ -5,6 +5,8 @@
dockerfile: Dockerfile
restart: on-failure
container_name: frontend
networks:
- frontend
ports:
- "3000:80"
env_file:
@@ -18,6 +20,8 @@
context: ./
dockerfile: ./auth-service/Dockerfile
restart: on-failure
networks:
- backend
ports:
- "50051:50051"
env_file:
@@ -37,6 +41,9 @@
context: ./
dockerfile: ./api-service/Dockerfile
restart: on-failure
networks:
- frontend
- backend
ports:
- "8080:8080"
- "8081:8081"
@@ -54,6 +61,8 @@
context: ./
dockerfile: ./database-service/Dockerfile
restart: on-failure
networks:
- backend
ports:
- "50052:50052"
env_file:
@@ -70,6 +79,8 @@
context: ./
dockerfile: ./character-service/Dockerfile
restart: on-failure
networks:
- backend
ports:
- "50053:50053"
env_file:
@@ -86,6 +97,8 @@
context: ./
dockerfile: ./world-service/Dockerfile
restart: on-failure
networks:
- backend
ports:
- "50054:50054"
env_file:
@@ -102,9 +115,12 @@
context: ./
dockerfile: ./packet-service/Dockerfile
restart: on-failure
networks:
- backend
ports:
- "29000:29000"
- "4001:4001"
- "8082:8082"
env_file:
- ./packet-service/.env
- .env
@@ -119,6 +135,8 @@
context: ./
dockerfile: ./session-service/Dockerfile
restart: on-failure
networks:
- backend
ports:
- "50055:50055"
env_file:
@@ -134,6 +152,9 @@
env_file:
- .env
restart: on-failure
networks:
backend:
ipv4_address: 172.16.238.4
ports:
- "6379:6379"
volumes:
@@ -144,6 +165,9 @@
env_file:
- .env
restart: on-failure
networks:
backend:
ipv4_address: 172.16.238.3
ports:
- "5432:5432"
volumes:
@@ -152,10 +176,21 @@
consul:
image: consul:1.15.4
command: agent -dev -client=0.0.0.0
command: [
"agent",
"-dev",
"-bootstrap-expect=1",
"-client=0.0.0.0",
"-bind=0.0.0.0",
]
restart: on-failure
networks:
backend:
ipv4_address: 172.16.238.2
ports:
- "8500:8500"
- "8600:8600/udp"
- "8600:8600/tcp"
volumes:
- ./scripts/consul.json:/consul/config/cors.json
@@ -163,3 +198,13 @@ volumes:
db_data:
cache_data:
service_ids:
networks:
backend:
ipam:
driver: default
config:
- subnet: "172.16.238.0/24"
- subnet: "2001:3984:3989::/64"
frontend:
driver: bridge