80 lines
1.8 KiB
YAML
80 lines
1.8 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
redis:
|
|
image: redis:7-alpine
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- redis_data:/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
networks:
|
|
- splitchat_network
|
|
|
|
db:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_DB: splitchat
|
|
POSTGRES_USER: splitchat
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-splitchat_password_123}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U splitchat"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- splitchat_network
|
|
|
|
web:
|
|
build: .
|
|
expose:
|
|
- "8000"
|
|
volumes:
|
|
- static_volume:/app/staticfiles
|
|
- media_volume:/app/media
|
|
environment:
|
|
- SECRET_KEY=${SECRET_KEY}
|
|
- DEBUG=${DEBUG:-False}
|
|
- ALLOWED_HOSTS=${ALLOWED_HOSTS:-localhost,127.0.0.1}
|
|
- DATABASE_URL=postgres://splitchat:${DB_PASSWORD:-splitchat_password_123}@db:5432/splitchat
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
networks:
|
|
- splitchat_network
|
|
|
|
# Optional: Nginx for serving static files (if you want to offload from Django)
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "8002:80"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
- static_volume:/static:ro
|
|
- media_volume:/media:ro
|
|
depends_on:
|
|
- web
|
|
restart: unless-stopped
|
|
networks:
|
|
- splitchat_network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
static_volume:
|
|
media_volume:
|
|
|
|
networks:
|
|
splitchat_network:
|
|
driver: bridge |