docker-compose.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. version: '3.8'
  2. services:
  3. # ----------------------------------------------------
  4. # Mihomo 多端口代理池微服务 (供其他服务及宿主机使用)
  5. # ----------------------------------------------------
  6. proxy:
  7. build: .
  8. image: coordinator:latest
  9. container_name: coordinator-proxy
  10. command: ["python3", "start_proxy.py", "-f", "config/mihomo_config.yaml"]
  11. restart: unless-stopped
  12. volumes:
  13. - ./config:/app/config
  14. - ./logs:/app/logs
  15. environment:
  16. - TZ=Asia/Shanghai
  17. - MIHOMO_BIN=/bin/mihomo
  18. - ALLOW_LAN=true
  19. ports:
  20. # 全局混杂端口 (Mixed-port)
  21. - "16000:16000"
  22. # 多节点独立端口池 (覆盖 proxies.yaml 中的所有独立出口端口)
  23. - "16001-16350:16001-16350"
  24. healthcheck:
  25. test: ["CMD", "python3", "start_proxy.py", "--check-health"]
  26. interval: 10s
  27. timeout: 5s
  28. retries: 3
  29. start_period: 5s
  30. deploy:
  31. resources:
  32. limits:
  33. cpus: '1.0'
  34. memory: 512M
  35. visa-sentinel:
  36. stop_grace_period: 30s
  37. build: .
  38. image: coordinator:latest
  39. container_name: coordinator-sentinel
  40. command: ["python3", "main.py", "sentinel"]
  41. restart: unless-stopped
  42. depends_on:
  43. proxy:
  44. condition: service_healthy
  45. shm_size: '2gb'
  46. volumes:
  47. - ./config:/app/config
  48. - ./logs:/app/logs
  49. - ./data:/app/data
  50. - ./plugins:/app/plugins
  51. environment:
  52. - TZ=Asia/Shanghai
  53. - DISPLAY=:99
  54. - CHROME_BIN=/opt/ungoogled-chromium/chrome
  55. - MIHOMO_BIN=/bin/mihomo
  56. - PROXY_HOST=proxy
  57. - NODE_ID=${NODE_ID:-jerry_win11_pc}
  58. deploy:
  59. resources:
  60. limits:
  61. cpus: '2.0'
  62. memory: 2G
  63. visa-booker:
  64. stop_grace_period: 30s
  65. build: .
  66. image: coordinator:latest
  67. container_name: coordinator-booker
  68. command: ["python3", "main.py", "booker"]
  69. restart: unless-stopped
  70. depends_on:
  71. proxy:
  72. condition: service_healthy
  73. shm_size: '2gb'
  74. volumes:
  75. - ./config:/app/config
  76. - ./logs:/app/logs
  77. - ./data:/app/data
  78. - ./plugins:/app/plugins
  79. environment:
  80. - TZ=Asia/Shanghai
  81. - DISPLAY=:99
  82. - CHROME_BIN=/opt/ungoogled-chromium/chrome
  83. - MIHOMO_BIN=/bin/mihomo
  84. - PROXY_HOST=proxy
  85. - NODE_ID=${NODE_ID:-jerry_win11_pc}
  86. deploy:
  87. resources:
  88. limits:
  89. cpus: '2.0'
  90. memory: 2G
  91. visa-standalone:
  92. stop_grace_period: 30s
  93. build: .
  94. image: coordinator:latest
  95. container_name: coordinator-standalone
  96. command: ["python3", "main.py", "standalone"]
  97. restart: unless-stopped
  98. depends_on:
  99. proxy:
  100. condition: service_healthy
  101. shm_size: '2gb'
  102. volumes:
  103. - ./config:/app/config
  104. - ./logs:/app/logs
  105. - ./data:/app/data
  106. - ./plugins:/app/plugins
  107. environment:
  108. - TZ=Asia/Shanghai
  109. - DISPLAY=:99
  110. - CHROME_BIN=/opt/ungoogled-chromium/chrome
  111. - MIHOMO_BIN=/bin/mihomo
  112. - PROXY_HOST=proxy
  113. - NODE_ID=${NODE_ID:-jerry_win11_pc}
  114. deploy:
  115. resources:
  116. limits:
  117. cpus: '2.0'
  118. memory: 2G
  119. visa-sweeper:
  120. build: .
  121. image: coordinator:latest
  122. container_name: coordinator-sweeper
  123. command: ["python3", "main_sweeper.py"]
  124. restart: unless-stopped
  125. volumes:
  126. - ./config:/app/config
  127. - ./data:/app/data
  128. - ./logs:/app/logs
  129. environment:
  130. - TZ=Asia/Shanghai
  131. - NODE_ID=${NODE_ID:-jerry_win11_pc}
  132. deploy:
  133. resources:
  134. limits:
  135. cpus: '0.2'
  136. memory: 256M