Files
microdao-daarion/docker-compose.city-space.yml
Apple 85a785bd86 fix(compose): use external postgres volume + city-service ENV
- docker-compose.yml: postgres uses microdao-daarion_postgres_data (external)
- docker-compose.yml: city-service connects to dagi-postgres:5432/daarion + NATS_URL
- docker-compose.city-space.yml: added dagi-postgres, dagi-nats as services
- docs/DEPLOY_ON_SERVER.md: added restart instructions without data loss

Closes TASK_PHASE_DOCKER_COMPOSE_CITY_SERVICE_POSTGRES
2025-11-30 06:58:02 -08:00

140 lines
3.7 KiB
YAML

version: '3.8'
services:
# ============================================================================
# City Service (Production-ready)
# ============================================================================
city-service:
build:
context: ./services/city-service
dockerfile: Dockerfile
container_name: daarion-city-service
ports:
- "7001:7001"
environment:
- LOG_LEVEL=INFO
- ENVIRONMENT=production
- DATABASE_URL=postgresql://postgres:postgres@dagi-postgres:5432/daarion
- MATRIX_GATEWAY_URL=http://gateway:9300
- NATS_URL=nats://dagi-nats:4222
depends_on:
- dagi-postgres
- dagi-nats
networks:
- daarion-network
- dagi-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7001/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# ============================================================================
# Space Service
# ============================================================================
space-service:
build:
context: ./services/space-service
dockerfile: Dockerfile
container_name: daarion-space-service
ports:
- "7002:7002"
environment:
- LOG_LEVEL=INFO
- ENVIRONMENT=development
# TODO: додати з'єднання з Redis, NATS
# - REDIS_URL=redis://redis:6379
# - NATS_URL=nats://nats:4222
networks:
- daarion-network
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:7002/health')"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# ============================================================================
# Nginx Reverse Proxy (для єдиної точки входу)
# ============================================================================
api-gateway:
image: nginx:alpine
container_name: daarion-api-gateway
ports:
- "8080:80"
volumes:
- ./nginx/api-gateway.conf:/etc/nginx/nginx.conf:ro
networks:
- daarion-network
depends_on:
- city-service
- space-service
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
interval: 30s
timeout: 5s
retries: 3
# ============================================================================
# External Services (from main docker-compose.yml)
# ============================================================================
dagi-postgres:
image: postgres:15-alpine
container_name: dagi-postgres
ports:
- "5432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=daarion
volumes:
- microdao-daarion_postgres_data:/var/lib/postgresql/data
networks:
- dagi-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
dagi-nats:
image: nats:2.10-alpine
container_name: dagi-nats
ports:
- "4222:4222"
- "8222:8222"
command: ["--jetstream", "--store_dir=/data", "-m", "8222"]
volumes:
- nats-data:/data
networks:
- dagi-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8222/healthz"]
interval: 10s
timeout: 5s
retries: 3
volumes:
microdao-daarion_postgres_data:
external: true
nats-data:
driver: local
networks:
daarion-network:
name: daarion-network
driver: bridge
dagi-network:
external: true