122 lines
2.7 KiB
YAML
122 lines
2.7 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
db:
|
|
image: postgres:15
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data/
|
|
environment:
|
|
- POSTGRES_DB=gnxmail
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=password
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
web:
|
|
build: .
|
|
command: >
|
|
sh -c "python manage.py migrate &&
|
|
python manage.py collectstatic --noinput &&
|
|
gunicorn gnxmail.wsgi:application --bind 0.0.0.0:8000 --workers 3"
|
|
volumes:
|
|
- .:/app
|
|
- static_volume:/app/staticfiles
|
|
- media_volume:/app/media
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
- DEBUG=False
|
|
- SECRET_KEY=your-secret-key-here
|
|
- DB_NAME=gnxmail
|
|
- DB_USER=postgres
|
|
- DB_PASSWORD=password
|
|
- DB_HOST=db
|
|
- DB_PORT=5432
|
|
- CELERY_BROKER_URL=redis://redis:6379/0
|
|
- CELERY_RESULT_BACKEND=redis://redis:6379/0
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
celery:
|
|
build: .
|
|
command: celery -A gnxmail worker -l info
|
|
volumes:
|
|
- .:/app
|
|
- media_volume:/app/media
|
|
environment:
|
|
- DEBUG=False
|
|
- SECRET_KEY=your-secret-key-here
|
|
- DB_NAME=gnxmail
|
|
- DB_USER=postgres
|
|
- DB_PASSWORD=password
|
|
- DB_HOST=db
|
|
- DB_PORT=5432
|
|
- CELERY_BROKER_URL=redis://redis:6379/0
|
|
- CELERY_RESULT_BACKEND=redis://redis:6379/0
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
celery-beat:
|
|
build: .
|
|
command: celery -A gnxmail beat -l info
|
|
volumes:
|
|
- .:/app
|
|
environment:
|
|
- DEBUG=False
|
|
- SECRET_KEY=your-secret-key-here
|
|
- DB_NAME=gnxmail
|
|
- DB_USER=postgres
|
|
- DB_PASSWORD=password
|
|
- DB_HOST=db
|
|
- DB_PORT=5432
|
|
- CELERY_BROKER_URL=redis://redis:6379/0
|
|
- CELERY_RESULT_BACKEND=redis://redis:6379/0
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
|
- static_volume:/app/staticfiles
|
|
- media_volume:/app/media
|
|
depends_on:
|
|
- web
|
|
|
|
volumes:
|
|
postgres_data:
|
|
static_volume:
|
|
media_volume:
|