diff --git a/e-voting-system/MULTINODE_SETUP.md b/e-voting-system/MULTINODE_SETUP.md index 4a7c9e0..5f89273 100644 --- a/e-voting-system/MULTINODE_SETUP.md +++ b/e-voting-system/MULTINODE_SETUP.md @@ -55,12 +55,11 @@ docker-compose -f docker-compose.multinode.yml ps |-----------|-----|---------| | **Frontend** | http://localhost:3000 | Voting interface | | **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 | | **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 ### Load Balancing diff --git a/e-voting-system/docker-compose.multinode.yml b/e-voting-system/docker-compose.multinode.yml index 128153c..c91f4e1 100644 --- a/e-voting-system/docker-compose.multinode.yml +++ b/e-voting-system/docker-compose.multinode.yml @@ -29,7 +29,7 @@ services: start_period: 40s # ================================================================ - # Backend Node 1 (Port 8001) + # Backend Node 1 (Internal Port 8000, No external binding) # ================================================================ backend-node-1: build: @@ -47,9 +47,9 @@ services: DEBUG: ${DEBUG:-false} PYTHONUNBUFFERED: 1 NODE_ID: node1 - NODE_PORT: 8001 - ports: - - "8001:8000" + NODE_PORT: 8000 + expose: + - "8000" depends_on: mariadb: condition: service_healthy @@ -67,7 +67,7 @@ services: start_period: 40s # ================================================================ - # Backend Node 2 (Port 8002) + # Backend Node 2 (Internal Port 8000, No external binding) # ================================================================ backend-node-2: build: @@ -85,9 +85,9 @@ services: DEBUG: ${DEBUG:-false} PYTHONUNBUFFERED: 1 NODE_ID: node2 - NODE_PORT: 8002 - ports: - - "8002:8000" + NODE_PORT: 8000 + expose: + - "8000" depends_on: mariadb: condition: service_healthy @@ -105,7 +105,7 @@ services: start_period: 40s # ================================================================ - # Backend Node 3 (Port 8003) + # Backend Node 3 (Internal Port 8000, No external binding) # ================================================================ backend-node-3: build: @@ -123,9 +123,9 @@ services: DEBUG: ${DEBUG:-false} PYTHONUNBUFFERED: 1 NODE_ID: node3 - NODE_PORT: 8003 - ports: - - "8003:8000" + NODE_PORT: 8000 + expose: + - "8000" depends_on: mariadb: condition: service_healthy