docker compose edit
This commit is contained in:
1 parent
5c6069c3ef
commit
f273c83a5e
1 file changed
+32
-17
+32
-17
@@ -1,43 +1,58 @@
|
|||||||
# راهاندازی چهار سرویس از یک ایمیج مشترک:
|
version: '3.8'
|
||||||
# web → وبسرور Gunicorn (میگریشن/استاتیک فقط اینجا اجرا میشود)
|
|
||||||
# worker → تخلیه صف پیامک (sms_worker)
|
# تنظیمات پایه مشترک برای تمام سرویسها
|
||||||
# scheduler → اسکن دورهای و صفکردن یادآوریها (sms_scan --loop)
|
|
||||||
# delivery → استعلام وضعیت تحویل پیامکها (sms_delivery --sleep 30)
|
|
||||||
#
|
|
||||||
# توجه: دیتابیس SQLite است؛ مقیاس افقی (چند replica) ممنوع.
|
|
||||||
x-app: &app
|
x-app: &app
|
||||||
build: .
|
build: .
|
||||||
|
image: khatibi-app:latest
|
||||||
env_file: production.env
|
env_file: production.env
|
||||||
volumes:
|
volumes:
|
||||||
- ./sqlite:/app/sqlite
|
- khatibi-sqlite-db:/app/sqlite:rw
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- coolify
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
<<: *app
|
<<: *app
|
||||||
ports:
|
# در صورت استفاده از دامنه و پروکسی Coolify از expose استفاده کنید:
|
||||||
- "8000:8000"
|
expose:
|
||||||
|
- "8000"
|
||||||
|
# اگر مایلید پورت مستقیماً روی سرور باز شود، خط بالا را کامنت کرده و دو خط زیر را فعال کنید:
|
||||||
|
# ports:
|
||||||
|
# - "8000:8000"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "python -c \"import urllib.request;urllib.request.urlopen('http://127.0.0.1:8000/').read()\""]
|
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/').read()\""]
|
||||||
interval: 30s
|
interval: 15s
|
||||||
timeout: 10s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
start_period: 60s
|
start_period: 30s
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
<<: *app
|
<<: *app
|
||||||
command: ["python", "manage.py", "sms_worker", "--sleep", "3"]
|
command: ["python", "manage.py", "sms_worker", "--sleep", "3"]
|
||||||
depends_on:
|
depends_on:
|
||||||
- web
|
web:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
scheduler:
|
scheduler:
|
||||||
<<: *app
|
<<: *app
|
||||||
command: ["python", "manage.py", "sms_scan", "--loop", "--interval", "300"]
|
command: ["python", "manage.py", "sms_scan", "--loop", "--interval", "300"]
|
||||||
depends_on:
|
depends_on:
|
||||||
- web
|
web:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
delivery:
|
delivery:
|
||||||
<<: *app
|
<<: *app
|
||||||
command: ["python", "manage.py", "sms_delivery", "--sleep", "30"]
|
command: ["python", "manage.py", "sms_delivery", "--sleep", "30"]
|
||||||
depends_on:
|
depends_on:
|
||||||
- web
|
web:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
khatibi-sqlite-db:
|
||||||
|
external: true
|
||||||
|
name: tu9bnt8x4cd0hsmn8x6r5arf-khatibi-sqlite-db
|
||||||
|
|
||||||
|
networks:
|
||||||
|
coolify:
|
||||||
|
external: true
|
||||||
Reference in new issue
Block a user