compose.runtime.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. name: zhifu-runtime
  2. x-runtime: &runtime
  3. image: ${ZHIFU_IMAGE:-zhifu-platform:local}
  4. env_file: ${ZHIFU_RUNTIME_ENV:?Specify an absolute runtime environment file path}
  5. init: true
  6. read_only: true
  7. tmpfs: ["/app/.work:uid=10001,gid=10001,mode=0700"]
  8. cap_drop: [ALL]
  9. security_opt: ["no-new-privileges:true"]
  10. stop_grace_period: 75s
  11. restart: unless-stopped
  12. pids_limit: 256
  13. mem_limit: 1g
  14. cpus: 2
  15. logging:
  16. driver: json-file
  17. options: {max-size: "10m", max-file: "3"}
  18. networks: [dependencies]
  19. services:
  20. api:
  21. <<: *runtime
  22. environment:
  23. DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
  24. ports: ["127.0.0.1:${ZHIFU_API_PORT:-28000}:8000"]
  25. healthcheck:
  26. test: [CMD, python, -c, "import httpx; httpx.get('http://127.0.0.1:8000/health/ready', timeout=4).raise_for_status()"]
  27. interval: 10s
  28. timeout: 5s
  29. retries: 3
  30. start_period: 30s
  31. oms:
  32. <<: *runtime
  33. command: [uvicorn, "zhifu.oms.api:create_app", --factory, --host, "0.0.0.0", --port, "8100", --timeout-graceful-shutdown, "60"]
  34. ports: ["127.0.0.1:${ZHIFU_OMS_PORT:-28100}:8100"]
  35. healthcheck:
  36. test: [CMD, python, -c, "import httpx; httpx.get('http://127.0.0.1:8100/health', timeout=4).raise_for_status()"]
  37. interval: 10s
  38. timeout: 5s
  39. retries: 3
  40. start_period: 30s
  41. operations:
  42. <<: *runtime
  43. command: [uvicorn, "zhifu.monitoring.api:app", --host, "0.0.0.0", --port, "8300"]
  44. ports: ["127.0.0.1:28300:8300"]
  45. agent:
  46. <<: *runtime
  47. profiles: [workers]
  48. environment:
  49. DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
  50. command: [python, -m, zhifu.operations.worker, agent]
  51. memory:
  52. <<: *runtime
  53. profiles: [workers]
  54. environment:
  55. DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
  56. command: [python, -m, zhifu.operations.worker, memory]
  57. fulfillment:
  58. <<: *runtime
  59. profiles: [workers]
  60. command: [python, -m, zhifu.operations.worker, fulfillment]
  61. knowledge:
  62. <<: *runtime
  63. profiles: [workers]
  64. command: [python, -m, zhifu.operations.worker, knowledge]
  65. channel-delivery:
  66. <<: *runtime
  67. profiles: [workers]
  68. command: [python, -m, zhifu.operations.worker, channel-delivery]
  69. migrate:
  70. <<: *runtime
  71. profiles: [release]
  72. restart: "no"
  73. command: [alembic, upgrade, head]
  74. migrate-oms:
  75. <<: *runtime
  76. profiles: [release]
  77. restart: "no"
  78. command: [alembic, -c, oms-alembic.ini, upgrade, head]
  79. release-check:
  80. <<: *runtime
  81. profiles: [release]
  82. environment:
  83. DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
  84. restart: "no"
  85. command: [python, -m, zhifu.operations.release_check]
  86. inference:
  87. <<: *runtime
  88. image: ${ZHIFU_INFERENCE_IMAGE:-zhifu-inference:local}
  89. profiles: [inference]
  90. command: [uvicorn, "zhifu.modules.knowledge.inference:app", --host, "0.0.0.0", --port, "8200", --timeout-graceful-shutdown, "60"]
  91. environment:
  92. KNOWLEDGE_MODEL_CACHE: /models
  93. HF_HUB_OFFLINE: "1"
  94. HF_HOME: /app/.work/huggingface
  95. volumes: ["${ZHIFU_MODEL_PATH:?Specify the BGE model cache path}:/models:ro"]
  96. mem_limit: 6g
  97. cpus: 4
  98. ports: ["127.0.0.1:28200:8200"]
  99. healthcheck:
  100. test: [CMD, python, -c, "import httpx; httpx.get('http://127.0.0.1:8200/health/ready', timeout=4).raise_for_status()"]
  101. interval: 10s
  102. timeout: 5s
  103. retries: 6
  104. start_period: 120s
  105. networks:
  106. dependencies:
  107. external: true
  108. name: ${ZHIFU_DEPENDENCY_NETWORK:-zhifu-platform_default}