docker-compose.pdf.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. services:
  2. # 主应用(Web API 服务)- 用于渲染 HTML
  3. app:
  4. build: .
  5. container_name: math_cms_app
  6. ports:
  7. - "8000:8000"
  8. env_file:
  9. - .env
  10. volumes:
  11. - ./storage:/app/storage
  12. - ./.env:/app/.env
  13. restart: unless-stopped
  14. healthcheck:
  15. test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
  16. interval: 30s
  17. timeout: 10s
  18. retries: 3
  19. start_period: 40s
  20. # PDF Worker 1
  21. pdf-worker-1:
  22. build: .
  23. container_name: pdf_worker_1
  24. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  25. env_file:
  26. - .env
  27. volumes:
  28. - ./storage:/app/storage
  29. - ./.env:/app/.env
  30. restart: unless-stopped
  31. stop_grace_period: 120s
  32. depends_on:
  33. app:
  34. condition: service_healthy
  35. healthcheck:
  36. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  37. interval: 30s
  38. timeout: 10s
  39. retries: 3
  40. start_period: 10s
  41. deploy:
  42. resources:
  43. limits:
  44. cpus: '1'
  45. memory: 1536M
  46. # PDF Worker 2
  47. pdf-worker-2:
  48. build: .
  49. container_name: pdf_worker_2
  50. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  51. env_file:
  52. - .env
  53. volumes:
  54. - ./storage:/app/storage
  55. - ./.env:/app/.env
  56. restart: unless-stopped
  57. stop_grace_period: 120s
  58. depends_on:
  59. app:
  60. condition: service_healthy
  61. healthcheck:
  62. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  63. interval: 30s
  64. timeout: 10s
  65. retries: 3
  66. start_period: 10s
  67. deploy:
  68. resources:
  69. limits:
  70. cpus: '1'
  71. memory: 1536M
  72. # PDF Worker 3
  73. pdf-worker-3:
  74. build: .
  75. container_name: pdf_worker_3
  76. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  77. env_file:
  78. - .env
  79. volumes:
  80. - ./storage:/app/storage
  81. - ./.env:/app/.env
  82. restart: unless-stopped
  83. stop_grace_period: 120s
  84. depends_on:
  85. app:
  86. condition: service_healthy
  87. healthcheck:
  88. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  89. interval: 30s
  90. timeout: 10s
  91. retries: 3
  92. start_period: 10s
  93. deploy:
  94. resources:
  95. limits:
  96. cpus: '1'
  97. memory: 1536M
  98. # PDF Worker 4
  99. pdf-worker-4:
  100. build: .
  101. container_name: pdf_worker_4
  102. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  103. env_file:
  104. - .env
  105. volumes:
  106. - ./storage:/app/storage
  107. - ./.env:/app/.env
  108. restart: unless-stopped
  109. stop_grace_period: 120s
  110. depends_on:
  111. app:
  112. condition: service_healthy
  113. healthcheck:
  114. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  115. interval: 30s
  116. timeout: 10s
  117. retries: 3
  118. start_period: 10s
  119. deploy:
  120. resources:
  121. limits:
  122. cpus: '1'
  123. memory: 1536M
  124. networks:
  125. default:
  126. driver: bridge