feat: server-core → network_mode host for direct WireGuard routing
NexusGuard CI / server-core-test (push) Failing after 27s
NexusGuard CI / device-agent-test (push) Failing after 28s
NexusGuard CI / dashboard-ui-build (push) Failing after 41s

- docker-compose.yml: server-core uses host network (no bridge isolation)
- docker-compose.yml: postgres/redis expose ports on 127.0.0.1 only
- docker-compose.dev.yml: also uses host network
- WireGuard now runs on host network stack (wg show works on host)
- nftables rules apply directly to host (proper peer isolation)
This commit is contained in:
datadunia
2026-05-28 13:31:24 +07:00
parent 4a5651651b
commit 31707cfaef
2 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -1,4 +1,3 @@
services: services:
server-core: server-core:
build: build:
@@ -8,5 +7,6 @@ services:
command: ["sh", "-c", "go install github.com/air-verse/air@latest && air"] command: ["sh", "-c", "go install github.com/air-verse/air@latest && air"]
volumes: volumes:
- ./apps/server-core:/app - ./apps/server-core:/app
network_mode: host
environment: environment:
- GIN_MODE=debug - GIN_MODE=debug
+8 -9
View File
@@ -1,4 +1,3 @@
services: services:
postgres: postgres:
image: postgres:16-alpine image: postgres:16-alpine
@@ -8,6 +7,8 @@ services:
POSTGRES_DB: nexusguard POSTGRES_DB: nexusguard
volumes: volumes:
- pgdata:/var/lib/postgresql/data - pgdata:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U nexusguard"] test: ["CMD-SHELL", "pg_isready -U nexusguard"]
interval: 5s interval: 5s
@@ -21,6 +22,8 @@ services:
image: redis:7-alpine image: redis:7-alpine
volumes: volumes:
- redisdata:/data - redisdata:/data
ports:
- "127.0.0.1:6379:6379"
healthcheck: healthcheck:
test: ["CMD", "redis-cli", "ping"] test: ["CMD", "redis-cli", "ping"]
interval: 5s interval: 5s
@@ -34,20 +37,19 @@ services:
build: build:
context: ./apps/server-core context: ./apps/server-core
dockerfile: Dockerfile dockerfile: Dockerfile
network_mode: host
environment: environment:
- DB_HOST=postgres - DB_HOST=127.0.0.1
- DB_PORT=5432 - DB_PORT=5432
- DB_USER=nexusguard - DB_USER=nexusguard
- DB_PASSWORD=${DB_PASSWORD:-nexusguard} - DB_PASSWORD=${DB_PASSWORD:-nexusguard}
- DB_NAME=nexusguard - DB_NAME=nexusguard
- REDIS_ADDR=redis:6379 - REDIS_ADDR=127.0.0.1:6379
- JWT_SECRET=${JWT_SECRET:-changeme} - JWT_SECRET=${JWT_SECRET:-changeme}
- SERVER_SALT=${SERVER_SALT:-changeme} - SERVER_SALT=${SERVER_SALT:-changeme}
- NFTABLES_TABLE=nexusguard - NFTABLES_TABLE=nexusguard
- IPAM_POOL=10.8.0.0/16 - IPAM_POOL=10.8.0.0/16
- GIN_MODE=release - GIN_MODE=release
ports:
- "${API_PORT:-8080}:8080"
depends_on: depends_on:
postgres: postgres:
condition: service_healthy condition: service_healthy
@@ -57,15 +59,12 @@ services:
- NET_ADMIN - NET_ADMIN
- NET_RAW - NET_RAW
restart: unless-stopped restart: unless-stopped
networks:
- nexusnet
dashboard-ui: dashboard-ui:
build: build:
context: ./apps/dashboard-ui context: ./apps/dashboard-ui
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
# Inject the root .env variable into the frontend build process
VITE_API_BASE_URL: ${VITE_API_BASE_URL} VITE_API_BASE_URL: ${VITE_API_BASE_URL}
ports: ports:
- "${WEB_PORT:-80}:80" - "${WEB_PORT:-80}:80"
@@ -81,4 +80,4 @@ volumes:
networks: networks:
nexusnet: nexusnet:
driver: bridge driver: bridge