diff --git a/stack.yaml b/stack.yaml index 4d9acb5..458ba36 100644 --- a/stack.yaml +++ b/stack.yaml @@ -31,7 +31,7 @@ services: max_failure_ratio: 0.2 resources: limits: - cpus: '1.00' + cpus: "1.00" memory: 512M healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d sifatbaho"] @@ -69,7 +69,7 @@ services: max_failure_ratio: 0.2 resources: limits: - cpus: '0.50' + cpus: "0.50" memory: 256M healthcheck: test: ["CMD", "redis-cli", "ping"] @@ -114,7 +114,7 @@ services: max_failure_ratio: 0.2 resources: limits: - cpus: '1.50' + cpus: "1.50" memory: 1024M healthcheck: test: ["CMD-SHELL", "curl -f http://localhost:8000/health/ || exit 1"] @@ -128,13 +128,47 @@ services: max-size: "50m" max-file: "5" + celery: + image: husanjon/sifatbaho:68 + env_file: + - .env + environment: + - DJANGO_SETTINGS_MODULE=config.settings.production + - CELERY_BROKER_URL=redis://redis:6379/0 + - CELERY_RESULT_BACKEND=redis://redis:6379/0 + command: > + sh -c " + echo 'Waiting for redis...' && + sleep 5 && + celery -A config worker --loglevel=info + " + networks: + - sifatbaho + volumes: + - logs:/code/resources/logs/:rw + - pycache:/var/cache/pycache:rw + deploy: + mode: replicated + replicas: 1 + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + failure_action: rollback + logging: + driver: json-file + options: + max-size: "20m" + max-file: "3" + nginx: image: nginx:alpine ports: - mode: ingress target: 80 - published: ${PORT:?enviromentda PORT topilmadi} + published: ${PORT:?enviromentda PORT topilmadi} protocol: tcp volumes: - type: bind @@ -161,7 +195,7 @@ services: max_failure_ratio: 0.2 resources: limits: - cpus: '0.50' + cpus: "0.50" memory: 256M tmpfs: - /var/cache/nginx