Backend (Django 4.2 + DRF): - accounts: phone OTP login, JWT, profile, addresses - catalog: categories, products, images, filters, search, hits/new/related - orders: creation with Idempotency-Key, stock reservation, status history, cancel - loyalty: bonus accounts, promo codes, gift certificates - payments: payment records and YooKassa webhook handling - content: static pages, banners, site settings - integration: 1C exchange (catalog sync, order push via outbox, statuses, bonuses) - common: error envelope, pagination, request-id, integration auth, admin dashboard Infrastructure: Dockerfile, docker-compose (Postgres, Redis, Celery worker/beat, Nginx), requirements split by environment, OpenAPI contracts for site and 1C, architecture doc. Tests: 22 pytest cases covering catalog, orders, idempotency, OTP, integration.
106 lines
2.6 KiB
YAML
106 lines
2.6 KiB
YAML
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-homm}
|
|
POSTGRES_USER: ${POSTGRES_USER:-homm}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-homm}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-homm} -d ${POSTGRES_DB:-homm}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
command: ["redis-server", "--appendonly", "yes"]
|
|
volumes:
|
|
- redisdata:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
web:
|
|
build: .
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DJANGO_SETTINGS_MODULE: config.settings.prod
|
|
DB_ENGINE: postgres
|
|
POSTGRES_HOST: db
|
|
REDIS_URL: redis://redis:6379/0
|
|
CELERY_BROKER_URL: redis://redis:6379/0
|
|
CELERY_RESULT_BACKEND: redis://redis:6379/1
|
|
command: >
|
|
sh -c "python manage.py migrate --noinput &&
|
|
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3 --timeout 60"
|
|
volumes:
|
|
- staticfiles:/app/staticfiles
|
|
- media:/app/media
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
ports:
|
|
- "8000:8000"
|
|
|
|
worker:
|
|
build: .
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DJANGO_SETTINGS_MODULE: config.settings.prod
|
|
DB_ENGINE: postgres
|
|
POSTGRES_HOST: db
|
|
REDIS_URL: redis://redis:6379/0
|
|
CELERY_BROKER_URL: redis://redis:6379/0
|
|
CELERY_RESULT_BACKEND: redis://redis:6379/1
|
|
command: ["celery", "-A", "config", "worker", "-l", "info", "--concurrency", "4"]
|
|
volumes:
|
|
- media:/app/media
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
beat:
|
|
build: .
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DJANGO_SETTINGS_MODULE: config.settings.prod
|
|
DB_ENGINE: postgres
|
|
POSTGRES_HOST: db
|
|
REDIS_URL: redis://redis:6379/0
|
|
CELERY_BROKER_URL: redis://redis:6379/0
|
|
CELERY_RESULT_BACKEND: redis://redis:6379/1
|
|
command: ["celery", "-A", "config", "beat", "-l", "info"]
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
nginx:
|
|
image: nginx:1.27-alpine
|
|
ports:
|
|
- "80:80"
|
|
volumes:
|
|
- ./deploy/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
|
- staticfiles:/app/staticfiles:ro
|
|
- media:/app/media:ro
|
|
depends_on:
|
|
- web
|
|
|
|
volumes:
|
|
pgdata:
|
|
redisdata:
|
|
staticfiles:
|
|
media:
|