More production updates/fixes #97

Merged
mattn merged 3 commits from matt/prod into main 2023-03-29 16:42:44 +13:00
2 changed files with 33 additions and 17 deletions
Showing only changes of commit 625291b4bf - Show all commits

View file

@ -6,11 +6,6 @@ volumes:
x-django: &django x-django: &django
image: right-tree image: right-tree
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
env_file: .env env_file: .env
user: "$UID:$GID" user: "$UID:$GID"
restart: always restart: always
@ -25,6 +20,13 @@ services:
- gunicorn - gunicorn
- --bind=0.0.0.0:8000 - --bind=0.0.0.0:8000
- right_tree.wsgi - right_tree.wsgi
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
celery:
condition: service_healthy
nginx: nginx:
container_name: nginx container_name: nginx
@ -54,13 +56,13 @@ services:
- POSTGRES_USER=${POSTGRES_USER} - POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
healthcheck: healthcheck:
test: ["CMD", "pg_isready", "--dbname", "righttree", "--username", "righttree"] test: ["CMD", "pg_isready", "--dbname", "$DATABASE_NAME", "--username", "$DATABASE_USER"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
redis: redis:
image: redis:7.0.8 image: redis:7.0.10
restart: always restart: always
container_name: redis container_name: redis
expose: expose:
@ -84,6 +86,11 @@ services:
condition: service_healthy condition: service_healthy
redis: redis:
condition: service_healthy condition: service_healthy
healthcheck:
test: ["CMD", "celery", "-A", "right_tree.api", "inspect", "ping"]
interval: 10s
timeout: 5s
retries: 5
deploy: deploy:
resources: resources:
limits: limits:

View file

@ -6,11 +6,6 @@ volumes:
x-django: &django x-django: &django
image: right-tree image: right-tree
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes: volumes:
- ./backend:/app - ./backend:/app
env_file: .env env_file: .env
@ -21,6 +16,13 @@ services:
backend: backend:
<<: *django <<: *django
container_name: backend container_name: backend
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
celery:
condition: service_healthy
expose: expose:
- "8000" - "8000"
command: command:
@ -56,7 +58,7 @@ services:
environment: environment:
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
healthcheck: healthcheck:
test: ["CMD", "pg_isready", "--dbname", "righttree", "--username", "righttree"] test: ["CMD", "pg_isready", "--dbname", "$DATABASE_NAME", "--username", "$DATABASE_USER"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@ -75,7 +77,7 @@ services:
- 80:80 - 80:80
redis: redis:
image: redis:7.0.8 image: redis:7.0.10
restart: unless-stopped restart: unless-stopped
container_name: redis container_name: redis
volumes: volumes:
@ -94,14 +96,21 @@ services:
celery: celery:
<<: *django <<: *django
container_name: celery container_name: celery
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: command:
- celery - celery
- -A - -A
- right_tree.api - right_tree.api
- worker - worker
depends_on: healthcheck:
redis: test: ["CMD", "celery", "-A", "right_tree.api", "inspect", "ping"]
condition: service_healthy interval: 10s
timeout: 5s
retries: 5
deploy: deploy:
resources: resources:
limits: limits: