docker-compose.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. build: .
  37. image: coordinator:latest
  38. container_name: coordinator-sentinel
  39. command: ["python3", "main.py", "sentinel"]
  40. restart: unless-stopped
  41. depends_on:
  42. proxy:
  43. condition: service_healthy
  44. shm_size: '2gb'
  45. volumes:
  46. - ./config:/app/config
  47. - ./logs:/app/logs
  48. - ./data:/app/data
  49. - ./plugins:/app/plugins
  50. environment:
  51. - TZ=Asia/Shanghai
  52. - DISPLAY=:99
  53. - CHROME_BIN=/opt/ungoogled-chromium/chrome
  54. - MIHOMO_BIN=/bin/mihomo
  55. - PROXY_HOST=proxy
  56. - NODE_ID=${NODE_ID:-testnode}
  57. deploy:
  58. resources:
  59. limits:
  60. cpus: '2.0'
  61. memory: 2G
  62. visa-booker:
  63. build: .
  64. image: coordinator:latest
  65. container_name: coordinator-booker
  66. command: ["python3", "main.py", "booker"]
  67. restart: unless-stopped
  68. depends_on:
  69. proxy:
  70. condition: service_healthy
  71. shm_size: '2gb'
  72. volumes:
  73. - ./config:/app/config
  74. - ./logs:/app/logs
  75. - ./data:/app/data
  76. - ./plugins:/app/plugins
  77. environment:
  78. - TZ=Asia/Shanghai
  79. - DISPLAY=:99
  80. - CHROME_BIN=/opt/ungoogled-chromium/chrome
  81. - MIHOMO_BIN=/bin/mihomo
  82. - PROXY_HOST=proxy
  83. - NODE_ID=${NODE_ID:-testnode}
  84. deploy:
  85. resources:
  86. limits:
  87. cpus: '2.0'
  88. memory: 2G
  89. visa-standalone:
  90. build: .
  91. image: coordinator:latest
  92. container_name: coordinator-standalone
  93. command: ["python3", "main.py", "standalone"]
  94. restart: unless-stopped
  95. depends_on:
  96. proxy:
  97. condition: service_healthy
  98. shm_size: '2gb'
  99. volumes:
  100. - ./config:/app/config
  101. - ./logs:/app/logs
  102. - ./data:/app/data
  103. - ./plugins:/app/plugins
  104. environment:
  105. - TZ=Asia/Shanghai
  106. - DISPLAY=:99
  107. - CHROME_BIN=/opt/ungoogled-chromium/chrome
  108. - MIHOMO_BIN=/bin/mihomo
  109. - PROXY_HOST=proxy
  110. - NODE_ID=${NODE_ID:-testnode}
  111. deploy:
  112. resources:
  113. limits:
  114. cpus: '2.0'
  115. memory: 2G
  116. visa-sweeper:
  117. build: .
  118. image: coordinator:latest
  119. container_name: coordinator-sweeper
  120. command: ["python3", "main_sweeper.py"]
  121. restart: unless-stopped
  122. volumes:
  123. - ./config:/app/config
  124. - ./data:/app/data
  125. - ./logs:/app/logs
  126. environment:
  127. - TZ=Asia/Shanghai
  128. - NODE_ID=${NODE_ID:-testnode}
  129. deploy:
  130. resources:
  131. limits:
  132. cpus: '0.2'
  133. memory: 256M