version: "3.8" volumes: righttree-static: name: righttree-static righttree-media: name: righttree-media righttree-postgres-data: name: righttree-postgres-data x-django: &django image: right-tree env_file: .env user: "$UID:$GID" restart: always volumes: - righttree-media:/app/right_tree/media - righttree-static:/app/right_tree/staticfiles services: collectstatic: <<: *django container_name: collectstatic command: - python - manage.py - collectstatic - --noinput backend: <<: *django container_name: backend expose: - "8000" command: - gunicorn - --bind=0.0.0.0:8000 - right_tree.wsgi depends_on: postgres: condition: service_healthy redis: condition: service_healthy celery: condition: service_healthy collectstatic: condition: service_completed_successfully nginx: container_name: nginx restart: always image: nginx depends_on: - backend volumes: - ./nginx.production.conf:/etc/nginx/nginx.conf:ro - ./backend/right_tree/staticfiles:/etc/nginx/html/staticfiles:ro - ./frontend/build:/etc/nginx/html/build:ro - /etc/letsencrypt:/etc/letsencrypt:ro ports: - "80:80" - "443:443" postgres: image: postgis/postgis:13-3.1 restart: always container_name: postgres volumes: - righttree-postgres-data:/var/lib/postgresql/data expose: - "5432" environment: - POSTGRES_DB=${POSTGRES_DB} - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} healthcheck: test: ["CMD", "pg_isready", "--dbname", "$DATABASE_NAME", "--username", "$DATABASE_USER"] interval: 10s timeout: 5s retries: 5 redis: image: redis:7.0.10 restart: always container_name: redis volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf:ro command: - redis-server - /usr/local/etc/redis/redis.conf expose: - "6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 celery: <<: *django container_name: celery command: - celery - -A - right_tree.api - worker depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "celery", "-A", "right_tree.api", "inspect", "ping"] interval: 10s timeout: 5s retries: 5 deploy: resources: limits: cpus: '1'