aurganize-backend/infrastructure/docker/docker-compose.yml

171 lines
4.1 KiB
YAML

# docker-compose.yml
version: '3.8'
# Define all services that make up Aurganize
services:
# PostgreSQL 14 - Primary database
postgres:
image: postgres:14-alpine
container_name: aurganize-postgres
restart: always
environment:
# Superuser credentials (for initialization only)
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "dev_pass_aurganize@v6.2"
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8"
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-scripts:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aurganize-network
# Redis 7 - Caching and session storage
redis:
image: redis:7-alpine
container_name: aurganize-redis
restart: unless-stopped
command: redis-server --appendonly yes
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aurganize-network
# NATS with JetStream - Event bus
nats:
image: nats:latest
container_name: aurganize-nats
restart: unless-stopped
command: ["-js", "-m", "8222"]
ports:
- "4222:4222" # Client connections
- "8222:8222" # HTTP monitoring
volumes:
- nats_data:/data
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8222/healthz"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aurganize-network
# MinIO - S3-compatible object storage
minio:
image: minio/minio:latest
container_name: aurganize-minio
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "9000:9000" # API
- "9001:9001" # Web Console
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aurganize-network
# Backend - Go API server
backend:
build:
context: ./../../backend
dockerfile: Dockerfile.dev
container_name: aurganize-backend
restart: unless-stopped
# environment:
# # Application config
# ENV: development
# PORT: 8080
# # Database connection
# DB_HOST: postgres
# DB_PORT: 5432
# DB_USER: aurganize
# DB_PASSWORD: dev_password_change_in_prod
# DB_NAME: aurganize
# DB_SSL_MODE: disable
# # Redis connection
# REDIS_HOST: redis
# REDIS_PORT: 6379
# REDIS_PASSWORD: ""
# # NATS connection
# NATS_URL: nats://nats:4222
# # MinIO connection
# MINIO_ENDPOINT: minio:9000
# MINIO_ACCESS_KEY: minioadmin
# MINIO_SECRET_KEY: minioadmin
# MINIO_USE_SSL: false
# # JWT secrets (development only)
# JWT_SECRET: dev-secret-change-in-production
# # CORS settings
# CORS_ORIGINS: http://localhost:3000
ports:
- "8080:8080"
volumes:
# Mount source code for hot reload
- ./../../backend:/app
# Exclude node_modules and vendor
- /app/vendor
- /app/bin
# depends_on:
# postgres:
# condition: service_healthy
# redis:
# condition: service_healthy
# nats:
# condition: service_healthy
# minio:
# condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aurganize-network
# Frontend - React application
# TODO
# Named volumes for data persistence
volumes:
postgres_data:
driver: local
redis_data:
driver: local
nats_data:
driver: local
minio_data:
driver: local
# Custom network for service isolation
networks:
aurganize-network:
driver: bridge