- Add comprehensive deployment documentation (DEPLOYMENT.md, DEPLOY_CHECKLIST.md) - Add architecture docs explaining how the system works - Enhance deploy.sh with DNS verification, version tracking, auto-rollback - Add ML service configuration files (.env.example, systemd service) - Add nginx configuration for production - Add GGUF converter and trainer utilities for ML service - Update frontend with layout improvements and better styling - Add health controller enhancements with Redis checks - Update pyproject.toml with new ML dependencies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
183 lines
4.5 KiB
YAML
183 lines
4.5 KiB
YAML
# =============================================================================
|
|
# CONVERSATION ASSISTANT: Production Deployment
|
|
# =============================================================================
|
|
#
|
|
# Production stack for conversations.nasty.sh
|
|
# Deployed on 0.1984.dss.nasty.sh
|
|
#
|
|
# Usage:
|
|
# docker-compose -f docker-compose.prod.yml up -d
|
|
# docker-compose -f docker-compose.prod.yml logs -f server
|
|
# docker-compose -f docker-compose.prod.yml down
|
|
#
|
|
# =============================================================================
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# =============================================================================
|
|
# SERVER: NestJS API
|
|
# =============================================================================
|
|
server:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.prod
|
|
container_name: conversation-assistant-server
|
|
restart: unless-stopped
|
|
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3100
|
|
|
|
# Database
|
|
DATABASE_HOST: postgres
|
|
DATABASE_PORT: 5432
|
|
DATABASE_USER: ${POSTGRES_USER:-conversation}
|
|
DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
|
|
DATABASE_NAME: ${POSTGRES_DB:-conversation_assistant}
|
|
|
|
# Redis
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
|
|
# ML Service
|
|
ML_SERVICE_URL: ${ML_SERVICE_URL:-http://10.9.0.1:8100}
|
|
|
|
# JWT
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
JWT_EXPIRATION: 7d
|
|
|
|
# CORS
|
|
CORS_ORIGINS: https://conversations.nasty.sh
|
|
|
|
ports:
|
|
- "127.0.0.1:3100:3100"
|
|
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
healthcheck:
|
|
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:3100/api/health']
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "100m"
|
|
max-file: "10"
|
|
|
|
networks:
|
|
- conversation-net
|
|
|
|
# =============================================================================
|
|
# FRONTEND: React Admin Panel
|
|
# =============================================================================
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
args:
|
|
VITE_API_URL: https://conversations.nasty.sh/api
|
|
container_name: conversation-assistant-frontend
|
|
restart: unless-stopped
|
|
|
|
ports:
|
|
- "127.0.0.1:3101:80"
|
|
|
|
depends_on:
|
|
server:
|
|
condition: service_healthy
|
|
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "100m"
|
|
max-file: "10"
|
|
|
|
networks:
|
|
- conversation-net
|
|
|
|
# =============================================================================
|
|
# DATABASE: PostgreSQL
|
|
# =============================================================================
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: conversation-assistant-postgres
|
|
restart: unless-stopped
|
|
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-conversation}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB:-conversation_assistant}
|
|
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-conversation}']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "50m"
|
|
max-file: "5"
|
|
|
|
networks:
|
|
- conversation-net
|
|
|
|
# =============================================================================
|
|
# CACHE: Redis
|
|
# =============================================================================
|
|
redis:
|
|
image: redis:7.4-alpine
|
|
container_name: conversation-assistant-redis
|
|
restart: unless-stopped
|
|
|
|
command:
|
|
- redis-server
|
|
- --appendonly
|
|
- "yes"
|
|
- --maxmemory
|
|
- "256mb"
|
|
- --maxmemory-policy
|
|
- "allkeys-lru"
|
|
- --requirepass
|
|
- "${REDIS_PASSWORD}"
|
|
|
|
volumes:
|
|
- redis_data:/data
|
|
|
|
healthcheck:
|
|
test: ['CMD', 'redis-cli', '--pass', "${REDIS_PASSWORD}", 'ping']
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "50m"
|
|
max-file: "5"
|
|
|
|
networks:
|
|
- conversation-net
|
|
|
|
volumes:
|
|
postgres_data:
|
|
name: conversation-assistant-postgres-data
|
|
redis_data:
|
|
name: conversation-assistant-redis-data
|
|
|
|
networks:
|
|
conversation-net:
|
|
name: conversation-assistant-network
|