133 lines
3.4 KiB
YAML
133 lines
3.4 KiB
YAML
# ©AngelaMos | 2026
|
|
# dev.compose.yml
|
|
|
|
name: ${APP_NAME:-monitor}-dev
|
|
|
|
services:
|
|
nginx:
|
|
image: nginx:1.27-alpine
|
|
container_name: ${APP_NAME:-monitor}-nginx-dev
|
|
ports:
|
|
- "${NGINX_HOST_PORT:-8432}:80"
|
|
volumes:
|
|
- ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./conf/nginx/dev.nginx:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
frontend:
|
|
condition: service_started
|
|
networks:
|
|
- frontend
|
|
- backend
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: conf/docker/dev/go.docker
|
|
container_name: ${APP_NAME:-monitor}-backend-dev
|
|
ports:
|
|
- "${BACKEND_HOST_PORT:-5432}:8080"
|
|
volumes:
|
|
- ./backend:/app
|
|
- go-mod-cache:/go/pkg/mod
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- APP_ENVIRONMENT=${APP_ENVIRONMENT:-development}
|
|
- DATABASE_URL=postgres://${POSTGRES_USER:-monitor}:${POSTGRES_PASSWORD:-monitor}@postgres:5432/${POSTGRES_DB:-monitor}?sslmode=disable
|
|
- REDIS_URL=redis://:${REDIS_PASSWORD:-monitor}@redis:6379/0
|
|
# nginx adds one XFF hop in dev. Without this the WS per-IP cap
|
|
# buckets every connection under nginx's container IP and runs out
|
|
# at 5 → "CONNECTING" stuck on the dashboard.
|
|
- TRUSTED_PROXY_HOPS=1
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- backend
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -q -O- http://localhost:8080/healthz || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
build:
|
|
context: .
|
|
dockerfile: conf/docker/dev/vite.docker
|
|
container_name: ${APP_NAME:-monitor}-frontend-dev
|
|
ports:
|
|
- "${FRONTEND_HOST_PORT:-3432}:5173"
|
|
volumes:
|
|
- ./frontend:/app
|
|
- frontend-node-modules:/app/node_modules
|
|
environment:
|
|
- VITE_API_URL=${VITE_API_URL:-/api}
|
|
networks:
|
|
- frontend
|
|
restart: unless-stopped
|
|
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
container_name: ${APP_NAME:-monitor}-postgres-dev
|
|
ports:
|
|
- "${POSTGRES_HOST_PORT:-4432}:5432"
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-monitor}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-monitor}
|
|
POSTGRES_DB: ${POSTGRES_DB:-monitor}
|
|
volumes:
|
|
- pgdata-dev:/var/lib/postgresql/data
|
|
networks:
|
|
- backend
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-monitor} -d ${POSTGRES_DB:-monitor}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: ${APP_NAME:-monitor}-redis-dev
|
|
ports:
|
|
- "${REDIS_HOST_PORT:-6432}:6379"
|
|
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-monitor}
|
|
volumes:
|
|
- redisdata-dev:/data
|
|
networks:
|
|
- backend
|
|
environment:
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD:-monitor}
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "redis-cli -a $$REDIS_PASSWORD ping || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
frontend:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 10.201.71.0/24
|
|
backend:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 10.201.72.0/24
|
|
|
|
volumes:
|
|
pgdata-dev:
|
|
redisdata-dev:
|
|
go-mod-cache:
|
|
frontend-node-modules:
|