# =============================================================================
# Admin Service - Docker Compose (Development/Standalone)
# =============================================================================
# For production, use the root docker-compose.yml in ../
#
# For standalone development:
#   1. First start shared infrastructure: cd .. && ./deploy.sh up postgres redis kafka
#   2. Then: docker compose up -d --build
# =============================================================================

services:
  admin-service:
    build: .
    container_name: rwa-admin-service
    ports:
      - "3010:3010"
    environment:
      # Application
      - NODE_ENV=production
      - APP_PORT=3010
      - API_PREFIX=api/v1
      # Database (shared PostgreSQL)
      - DATABASE_URL=postgresql://rwa_user:rwa_secure_password@rwa-postgres:5432/rwa_admin?schema=public
      # JWT
      - JWT_SECRET=${JWT_SECRET:-your-admin-jwt-secret-change-in-production}
      - JWT_EXPIRES_IN=7d
      # Redis (shared)
      - REDIS_HOST=rwa-redis
      - REDIS_PORT=6379
      - REDIS_PASSWORD=${REDIS_PASSWORD:-}
      - REDIS_DB=9
      # Kafka
      - KAFKA_BROKERS=kafka:29092
      - KAFKA_CLIENT_ID=admin-service
      - KAFKA_CONSUMER_GROUP=admin-service-user-sync
      # File Storage
      - UPLOAD_DIR=/app/uploads
      - BASE_URL=${BASE_URL:-https://rwaapi.szaiai.com/api/v1}
    volumes:
      - uploads_data:/app/uploads
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3010/api/v1/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    restart: unless-stopped
    networks:
      - rwa-network

volumes:
  uploads_data:
    name: admin-service-uploads-data

networks:
  rwa-network:
    external: true
