fix: Configure multi-node backend nodes for internal networking (no port conflicts)
This commit is contained in:
parent
5ac2a49a2a
commit
f83bd796dd
@ -55,12 +55,11 @@ docker-compose -f docker-compose.multinode.yml ps
|
|||||||
|-----------|-----|---------|
|
|-----------|-----|---------|
|
||||||
| **Frontend** | http://localhost:3000 | Voting interface |
|
| **Frontend** | http://localhost:3000 | Voting interface |
|
||||||
| **Load Balancer** | http://localhost:8000 | Routes to all backend nodes |
|
| **Load Balancer** | http://localhost:8000 | Routes to all backend nodes |
|
||||||
| **Node 1 Direct** | http://localhost:8001 | Direct access to node 1 |
|
|
||||||
| **Node 2 Direct** | http://localhost:8002 | Direct access to node 2 |
|
|
||||||
| **Node 3 Direct** | http://localhost:8003 | Direct access to node 3 |
|
|
||||||
| **API Docs** | http://localhost:8000/docs | API documentation |
|
| **API Docs** | http://localhost:8000/docs | API documentation |
|
||||||
| **Database UI** | http://localhost:8081 | Database management (Adminer) |
|
| **Database UI** | http://localhost:8081 | Database management (Adminer) |
|
||||||
|
|
||||||
|
**Note**: Backend nodes are internal to the Docker network and only accessible through Nginx load balancer on port 8000. This is more efficient and prevents port conflicts.
|
||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
### Load Balancing
|
### Load Balancing
|
||||||
|
|||||||
@ -29,7 +29,7 @@ services:
|
|||||||
start_period: 40s
|
start_period: 40s
|
||||||
|
|
||||||
# ================================================================
|
# ================================================================
|
||||||
# Backend Node 1 (Port 8001)
|
# Backend Node 1 (Internal Port 8000, No external binding)
|
||||||
# ================================================================
|
# ================================================================
|
||||||
backend-node-1:
|
backend-node-1:
|
||||||
build:
|
build:
|
||||||
@ -47,9 +47,9 @@ services:
|
|||||||
DEBUG: ${DEBUG:-false}
|
DEBUG: ${DEBUG:-false}
|
||||||
PYTHONUNBUFFERED: 1
|
PYTHONUNBUFFERED: 1
|
||||||
NODE_ID: node1
|
NODE_ID: node1
|
||||||
NODE_PORT: 8001
|
NODE_PORT: 8000
|
||||||
ports:
|
expose:
|
||||||
- "8001:8000"
|
- "8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
mariadb:
|
mariadb:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@ -67,7 +67,7 @@ services:
|
|||||||
start_period: 40s
|
start_period: 40s
|
||||||
|
|
||||||
# ================================================================
|
# ================================================================
|
||||||
# Backend Node 2 (Port 8002)
|
# Backend Node 2 (Internal Port 8000, No external binding)
|
||||||
# ================================================================
|
# ================================================================
|
||||||
backend-node-2:
|
backend-node-2:
|
||||||
build:
|
build:
|
||||||
@ -85,9 +85,9 @@ services:
|
|||||||
DEBUG: ${DEBUG:-false}
|
DEBUG: ${DEBUG:-false}
|
||||||
PYTHONUNBUFFERED: 1
|
PYTHONUNBUFFERED: 1
|
||||||
NODE_ID: node2
|
NODE_ID: node2
|
||||||
NODE_PORT: 8002
|
NODE_PORT: 8000
|
||||||
ports:
|
expose:
|
||||||
- "8002:8000"
|
- "8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
mariadb:
|
mariadb:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@ -105,7 +105,7 @@ services:
|
|||||||
start_period: 40s
|
start_period: 40s
|
||||||
|
|
||||||
# ================================================================
|
# ================================================================
|
||||||
# Backend Node 3 (Port 8003)
|
# Backend Node 3 (Internal Port 8000, No external binding)
|
||||||
# ================================================================
|
# ================================================================
|
||||||
backend-node-3:
|
backend-node-3:
|
||||||
build:
|
build:
|
||||||
@ -123,9 +123,9 @@ services:
|
|||||||
DEBUG: ${DEBUG:-false}
|
DEBUG: ${DEBUG:-false}
|
||||||
PYTHONUNBUFFERED: 1
|
PYTHONUNBUFFERED: 1
|
||||||
NODE_ID: node3
|
NODE_ID: node3
|
||||||
NODE_PORT: 8003
|
NODE_PORT: 8000
|
||||||
ports:
|
expose:
|
||||||
- "8003:8000"
|
- "8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
mariadb:
|
mariadb:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user