docker-compose.yml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. version: '2.1'
  2. services:
  3. unbound-mailcow:
  4. image: mailcow/unbound:1.20
  5. environment:
  6. - TZ=${TZ}
  7. - SKIP_UNBOUND_HEALTHCHECK=${SKIP_UNBOUND_HEALTHCHECK:-n}
  8. volumes:
  9. - ./data/hooks/unbound:/hooks:Z
  10. - ./data/conf/unbound/unbound.conf:/etc/unbound/unbound.conf:ro,Z
  11. restart: always
  12. tty: true
  13. networks:
  14. mailcow-network:
  15. ipv4_address: ${IPV4_NETWORK:-172.22.1}.254
  16. aliases:
  17. - unbound
  18. mysql-mailcow:
  19. image: mariadb:10.5
  20. depends_on:
  21. - unbound-mailcow
  22. - netfilter-mailcow
  23. stop_grace_period: 45s
  24. volumes:
  25. - mysql-vol-1:/var/lib/mysql/
  26. - mysql-socket-vol-1:/var/run/mysqld/
  27. - ./data/conf/mysql/:/etc/mysql/conf.d/:ro,Z
  28. environment:
  29. - TZ=${TZ}
  30. - MYSQL_ROOT_PASSWORD=${DBROOT}
  31. - MYSQL_DATABASE=${DBNAME}
  32. - MYSQL_USER=${DBUSER}
  33. - MYSQL_PASSWORD=${DBPASS}
  34. - MYSQL_INITDB_SKIP_TZINFO=1
  35. restart: always
  36. ports:
  37. - "${SQL_PORT:-127.0.0.1:13306}:3306"
  38. networks:
  39. mailcow-network:
  40. aliases:
  41. - mysql
  42. redis-mailcow:
  43. image: redis:7-alpine
  44. volumes:
  45. - redis-vol-1:/data/
  46. restart: always
  47. depends_on:
  48. - netfilter-mailcow
  49. ports:
  50. - "${REDIS_PORT:-127.0.0.1:7654}:6379"
  51. environment:
  52. - TZ=${TZ}
  53. sysctls:
  54. - net.core.somaxconn=4096
  55. networks:
  56. mailcow-network:
  57. ipv4_address: ${IPV4_NETWORK:-172.22.1}.249
  58. aliases:
  59. - redis
  60. clamd-mailcow:
  61. image: mailcow/clamd:1.64
  62. restart: always
  63. depends_on:
  64. unbound-mailcow:
  65. condition: service_healthy
  66. dns:
  67. - ${IPV4_NETWORK:-172.22.1}.254
  68. environment:
  69. - TZ=${TZ}
  70. - SKIP_CLAMD=${SKIP_CLAMD:-n}
  71. volumes:
  72. - ./data/conf/clamav/:/etc/clamav/:Z
  73. - clamd-db-vol-1:/var/lib/clamav
  74. networks:
  75. mailcow-network:
  76. aliases:
  77. - clamd
  78. rspamd-mailcow:
  79. image: mailcow/rspamd:1.95
  80. stop_grace_period: 30s
  81. depends_on:
  82. - dovecot-mailcow
  83. environment:
  84. - TZ=${TZ}
  85. - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
  86. - IPV6_NETWORK=${IPV6_NETWORK:-fd4d:6169:6c63:6f77::/64}
  87. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  88. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  89. volumes:
  90. - ./data/hooks/rspamd:/hooks:Z
  91. - ./data/conf/rspamd/custom/:/etc/rspamd/custom:z
  92. - ./data/conf/rspamd/override.d/:/etc/rspamd/override.d:Z
  93. - ./data/conf/rspamd/local.d/:/etc/rspamd/local.d:Z
  94. - ./data/conf/rspamd/plugins.d/:/etc/rspamd/plugins.d:Z
  95. - ./data/conf/rspamd/lua/:/etc/rspamd/lua/:ro,Z
  96. - ./data/conf/rspamd/rspamd.conf.local:/etc/rspamd/rspamd.conf.local:Z
  97. - ./data/conf/rspamd/rspamd.conf.override:/etc/rspamd/rspamd.conf.override:Z
  98. - rspamd-vol-1:/var/lib/rspamd
  99. restart: always
  100. hostname: rspamd
  101. dns:
  102. - ${IPV4_NETWORK:-172.22.1}.254
  103. networks:
  104. mailcow-network:
  105. aliases:
  106. - rspamd
  107. php-fpm-mailcow:
  108. image: mailcow/phpfpm:1.87
  109. command: "php-fpm -d date.timezone=${TZ} -d expose_php=0"
  110. depends_on:
  111. - redis-mailcow
  112. volumes:
  113. - ./data/hooks/phpfpm:/hooks:Z
  114. - ./data/web:/web:z
  115. - ./data/conf/rspamd/dynmaps:/dynmaps:ro,z
  116. - ./data/conf/rspamd/custom/:/rspamd_custom_maps:z
  117. - ./data/conf/dovecot/auth/mailcowauth.php:/mailcowauth/mailcowauth.php:z
  118. - ./data/web/inc/functions.inc.php:/mailcowauth/functions.inc.php:z
  119. - ./data/web/inc/functions.auth.inc.php:/mailcowauth/functions.auth.inc.php:z
  120. - ./data/web/inc/sessions.inc.php:/mailcowauth/sessions.inc.php:z
  121. - ./data/web/inc/functions.mailbox.inc.php:/mailcowauth/functions.mailbox.inc.php:z
  122. - ./data/web/inc/functions.ratelimit.inc.php:/mailcowauth/functions.ratelimit.inc.php:z
  123. - rspamd-vol-1:/var/lib/rspamd
  124. - mysql-socket-vol-1:/var/run/mysqld/
  125. - ./data/conf/sogo/:/etc/sogo/:z
  126. - ./data/conf/rspamd/meta_exporter:/meta_exporter:ro,z
  127. - ./data/conf/phpfpm/crons:/crons:z
  128. - ./data/conf/phpfpm/sogo-sso/:/etc/sogo-sso/:z
  129. - ./data/conf/phpfpm/php-fpm.d/pools.conf:/usr/local/etc/php-fpm.d/z-pools.conf:Z
  130. - ./data/conf/phpfpm/php-conf.d/opcache-recommended.ini:/usr/local/etc/php/conf.d/opcache-recommended.ini:Z
  131. - ./data/conf/phpfpm/php-conf.d/upload.ini:/usr/local/etc/php/conf.d/upload.ini:Z
  132. - ./data/conf/phpfpm/php-conf.d/other.ini:/usr/local/etc/php/conf.d/zzz-other.ini:Z
  133. - ./data/conf/dovecot/global_sieve_before:/global_sieve/before:z
  134. - ./data/conf/dovecot/global_sieve_after:/global_sieve/after:z
  135. - ./data/assets/templates:/tpls:z
  136. - ./data/conf/nginx/:/etc/nginx/conf.d/:z
  137. dns:
  138. - ${IPV4_NETWORK:-172.22.1}.254
  139. environment:
  140. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  141. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  142. - LOG_LINES=${LOG_LINES:-9999}
  143. - TZ=${TZ}
  144. - DBNAME=${DBNAME}
  145. - DBUSER=${DBUSER}
  146. - DBPASS=${DBPASS}
  147. - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  148. - MAILCOW_PASS_SCHEME=${MAILCOW_PASS_SCHEME:-BLF-CRYPT}
  149. - IMAP_PORT=${IMAP_PORT:-143}
  150. - IMAPS_PORT=${IMAPS_PORT:-993}
  151. - POP_PORT=${POP_PORT:-110}
  152. - POPS_PORT=${POPS_PORT:-995}
  153. - SIEVE_PORT=${SIEVE_PORT:-4190}
  154. - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
  155. - IPV6_NETWORK=${IPV6_NETWORK:-fd4d:6169:6c63:6f77::/64}
  156. - SUBMISSION_PORT=${SUBMISSION_PORT:-587}
  157. - SMTPS_PORT=${SMTPS_PORT:-465}
  158. - SMTP_PORT=${SMTP_PORT:-25}
  159. - API_KEY=${API_KEY:-invalid}
  160. - API_KEY_READ_ONLY=${API_KEY_READ_ONLY:-invalid}
  161. - API_ALLOW_FROM=${API_ALLOW_FROM:-invalid}
  162. - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-mailcow-dockerized}
  163. - SKIP_SOLR=${SKIP_SOLR:-y}
  164. - SKIP_CLAMD=${SKIP_CLAMD:-n}
  165. - SKIP_SOGO=${SKIP_SOGO:-n}
  166. - ALLOW_ADMIN_EMAIL_LOGIN=${ALLOW_ADMIN_EMAIL_LOGIN:-n}
  167. - MASTER=${MASTER:-y}
  168. - DEV_MODE=${DEV_MODE:-n}
  169. - DEMO_MODE=${DEMO_MODE:-n}
  170. - WEBAUTHN_ONLY_TRUSTED_VENDORS=${WEBAUTHN_ONLY_TRUSTED_VENDORS:-n}
  171. - CLUSTERMODE=${CLUSTERMODE:-}
  172. restart: always
  173. labels:
  174. ofelia.enabled: "true"
  175. ofelia.job-exec.phpfpm_keycloak_sync.schedule: "@every 1m"
  176. ofelia.job-exec.phpfpm_keycloak_sync.no-overlap: "true"
  177. ofelia.job-exec.phpfpm_keycloak_sync.command: "/bin/bash -c \"php /crons/keycloak-sync.php || exit 0\""
  178. networks:
  179. mailcow-network:
  180. aliases:
  181. - phpfpm
  182. sogo-mailcow:
  183. image: mailcow/sogo:nightly-20240205
  184. environment:
  185. - DBNAME=${DBNAME}
  186. - DBUSER=${DBUSER}
  187. - DBPASS=${DBPASS}
  188. - TZ=${TZ}
  189. - LOG_LINES=${LOG_LINES:-9999}
  190. - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  191. - MAILCOW_PASS_SCHEME=${MAILCOW_PASS_SCHEME:-BLF-CRYPT}
  192. - ACL_ANYONE=${ACL_ANYONE:-disallow}
  193. - ALLOW_ADMIN_EMAIL_LOGIN=${ALLOW_ADMIN_EMAIL_LOGIN:-n}
  194. - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
  195. - SOGO_EXPIRE_SESSION=${SOGO_EXPIRE_SESSION:-480}
  196. - SKIP_SOGO=${SKIP_SOGO:-n}
  197. - MASTER=${MASTER:-y}
  198. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  199. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  200. dns:
  201. - ${IPV4_NETWORK:-172.22.1}.254
  202. volumes:
  203. - ./data/hooks/sogo:/hooks:Z
  204. - ./data/conf/sogo/:/etc/sogo/:z
  205. - ./data/web/inc/init_db.inc.php:/init_db.inc.php:z
  206. - ./data/conf/sogo/custom-favicon.ico:/usr/lib/GNUstep/SOGo/WebServerResources/img/sogo.ico:z
  207. - ./data/conf/sogo/custom-theme.js:/usr/lib/GNUstep/SOGo/WebServerResources/js/theme.js:z
  208. - ./data/conf/sogo/custom-sogo.js:/usr/lib/GNUstep/SOGo/WebServerResources/js/custom-sogo.js:z
  209. - mysql-socket-vol-1:/var/run/mysqld/
  210. - sogo-web-vol-1:/sogo_web
  211. - sogo-userdata-backup-vol-1:/sogo_backup
  212. labels:
  213. ofelia.enabled: "true"
  214. ofelia.job-exec.sogo_sessions.schedule: "@every 1m"
  215. ofelia.job-exec.sogo_sessions.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu sogo /usr/sbin/sogo-tool -v expire-sessions $${SOGO_EXPIRE_SESSION} || exit 0\""
  216. ofelia.job-exec.sogo_ealarms.schedule: "@every 1m"
  217. ofelia.job-exec.sogo_ealarms.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu sogo /usr/sbin/sogo-ealarms-notify -p /etc/sogo/sieve.creds || exit 0\""
  218. ofelia.job-exec.sogo_eautoreply.schedule: "@every 5m"
  219. ofelia.job-exec.sogo_eautoreply.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu sogo /usr/sbin/sogo-tool update-autoreply -p /etc/sogo/sieve.creds || exit 0\""
  220. ofelia.job-exec.sogo_backup.schedule: "@every 24h"
  221. ofelia.job-exec.sogo_backup.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu sogo /usr/sbin/sogo-tool backup /sogo_backup ALL || exit 0\""
  222. restart: always
  223. networks:
  224. mailcow-network:
  225. ipv4_address: ${IPV4_NETWORK:-172.22.1}.248
  226. aliases:
  227. - sogo
  228. dovecot-mailcow:
  229. image: mailcow/dovecot:nightly-20240205
  230. depends_on:
  231. - mysql-mailcow
  232. - netfilter-mailcow
  233. dns:
  234. - ${IPV4_NETWORK:-172.22.1}.254
  235. cap_add:
  236. - NET_BIND_SERVICE
  237. volumes:
  238. - ./data/hooks/dovecot:/hooks:Z
  239. - ./data/conf/dovecot:/etc/dovecot:z
  240. - ./data/assets/ssl:/etc/ssl/mail/:ro,z
  241. - ./data/conf/sogo/:/etc/sogo/:z
  242. - ./data/conf/phpfpm/sogo-sso/:/etc/phpfpm/:z
  243. - vmail-vol-1:/var/vmail
  244. - vmail-index-vol-1:/var/vmail_index
  245. - crypt-vol-1:/mail_crypt/
  246. - ./data/conf/rspamd/custom/:/etc/rspamd/custom:z
  247. - ./data/assets/templates:/templates:z
  248. - rspamd-vol-1:/var/lib/rspamd
  249. - mysql-socket-vol-1:/var/run/mysqld/
  250. environment:
  251. - DOVECOT_MASTER_USER=${DOVECOT_MASTER_USER:-}
  252. - DOVECOT_MASTER_PASS=${DOVECOT_MASTER_PASS:-}
  253. - MAILCOW_REPLICA_IP=${MAILCOW_REPLICA_IP:-}
  254. - DOVEADM_REPLICA_PORT=${DOVEADM_REPLICA_PORT:-}
  255. - LOG_LINES=${LOG_LINES:-9999}
  256. - DBNAME=${DBNAME}
  257. - DBUSER=${DBUSER}
  258. - DBPASS=${DBPASS}
  259. - TZ=${TZ}
  260. - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  261. - MAILCOW_PASS_SCHEME=${MAILCOW_PASS_SCHEME:-BLF-CRYPT}
  262. - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
  263. - ALLOW_ADMIN_EMAIL_LOGIN=${ALLOW_ADMIN_EMAIL_LOGIN:-n}
  264. - MAILDIR_GC_TIME=${MAILDIR_GC_TIME:-7200}
  265. - ACL_ANYONE=${ACL_ANYONE:-disallow}
  266. - SKIP_SOLR=${SKIP_SOLR:-y}
  267. - MAILDIR_SUB=${MAILDIR_SUB:-}
  268. - MASTER=${MASTER:-y}
  269. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  270. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  271. - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-mailcow-dockerized}
  272. ports:
  273. - "${DOVEADM_PORT:-127.0.0.1:19991}:12345"
  274. - "${IMAP_PORT:-143}:143"
  275. - "${IMAPS_PORT:-993}:993"
  276. - "${POP_PORT:-110}:110"
  277. - "${POPS_PORT:-995}:995"
  278. - "${SIEVE_PORT:-4190}:4190"
  279. restart: always
  280. tty: true
  281. labels:
  282. ofelia.enabled: "true"
  283. ofelia.job-exec.dovecot_imapsync_runner.schedule: "@every 1m"
  284. ofelia.job-exec.dovecot_imapsync_runner.no-overlap: "true"
  285. ofelia.job-exec.dovecot_imapsync_runner.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu nobody /usr/local/bin/imapsync_runner.pl || exit 0\""
  286. ofelia.job-exec.dovecot_trim_logs.schedule: "@every 1m"
  287. ofelia.job-exec.dovecot_trim_logs.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu vmail /usr/local/bin/trim_logs.sh || exit 0\""
  288. ofelia.job-exec.dovecot_quarantine.schedule: "@every 20m"
  289. ofelia.job-exec.dovecot_quarantine.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu vmail /usr/local/bin/quarantine_notify.py || exit 0\""
  290. ofelia.job-exec.dovecot_clean_q_aged.schedule: "@every 24h"
  291. ofelia.job-exec.dovecot_clean_q_aged.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu vmail /usr/local/bin/clean_q_aged.sh || exit 0\""
  292. ofelia.job-exec.dovecot_maildir_gc.schedule: "@every 30m"
  293. ofelia.job-exec.dovecot_maildir_gc.command: "/bin/bash -c \"source /source_env.sh ; /usr/local/bin/gosu vmail /usr/local/bin/maildir_gc.sh\""
  294. ofelia.job-exec.dovecot_sarules.schedule: "@every 24h"
  295. ofelia.job-exec.dovecot_sarules.command: "/bin/bash -c \"/usr/local/bin/sa-rules.sh\""
  296. ofelia.job-exec.dovecot_fts.schedule: "@every 24h"
  297. ofelia.job-exec.dovecot_fts.command: "/usr/bin/curl http://solr:8983/solr/dovecot-fts/update?optimize=true"
  298. ofelia.job-exec.dovecot_repl_health.schedule: "@every 5m"
  299. ofelia.job-exec.dovecot_repl_health.command: "/bin/bash -c \"/usr/local/bin/gosu vmail /usr/local/bin/repl_health.sh\""
  300. ulimits:
  301. nproc: 65535
  302. nofile:
  303. soft: 20000
  304. hard: 40000
  305. networks:
  306. mailcow-network:
  307. ipv4_address: ${IPV4_NETWORK:-172.22.1}.250
  308. aliases:
  309. - dovecot
  310. postfix-mailcow:
  311. image: mailcow/postfix:1.74
  312. depends_on:
  313. mysql-mailcow:
  314. condition: service_started
  315. unbound-mailcow:
  316. condition: service_healthy
  317. volumes:
  318. - ./data/hooks/postfix:/hooks:Z
  319. - ./data/conf/postfix:/opt/postfix/conf:z
  320. - ./data/assets/ssl:/etc/ssl/mail/:ro,z
  321. - postfix-vol-1:/var/spool/postfix
  322. - crypt-vol-1:/var/lib/zeyple
  323. - rspamd-vol-1:/var/lib/rspamd
  324. - mysql-socket-vol-1:/var/run/mysqld/
  325. environment:
  326. - LOG_LINES=${LOG_LINES:-9999}
  327. - TZ=${TZ}
  328. - DBNAME=${DBNAME}
  329. - DBUSER=${DBUSER}
  330. - DBPASS=${DBPASS}
  331. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  332. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  333. - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  334. - SPAMHAUS_DQS_KEY=${SPAMHAUS_DQS_KEY:-}
  335. cap_add:
  336. - NET_BIND_SERVICE
  337. ports:
  338. - "${SMTP_PORT:-25}:25"
  339. - "${SMTPS_PORT:-465}:465"
  340. - "${SUBMISSION_PORT:-587}:587"
  341. restart: always
  342. dns:
  343. - ${IPV4_NETWORK:-172.22.1}.254
  344. networks:
  345. mailcow-network:
  346. ipv4_address: ${IPV4_NETWORK:-172.22.1}.253
  347. aliases:
  348. - postfix
  349. memcached-mailcow:
  350. image: memcached:alpine
  351. restart: always
  352. environment:
  353. - TZ=${TZ}
  354. networks:
  355. mailcow-network:
  356. aliases:
  357. - memcached
  358. nginx-mailcow:
  359. depends_on:
  360. - sogo-mailcow
  361. - php-fpm-mailcow
  362. - redis-mailcow
  363. image: nginx:mainline-alpine
  364. dns:
  365. - ${IPV4_NETWORK:-172.22.1}.254
  366. command: /bin/sh -c "envsubst < /etc/nginx/conf.d/templates/listen_plain.template > /etc/nginx/conf.d/listen_plain.active &&
  367. envsubst < /etc/nginx/conf.d/templates/listen_ssl.template > /etc/nginx/conf.d/listen_ssl.active &&
  368. envsubst < /etc/nginx/conf.d/templates/sogo.template > /etc/nginx/conf.d/sogo.active &&
  369. . /etc/nginx/conf.d/templates/server_name.template.sh > /etc/nginx/conf.d/server_name.active &&
  370. . /etc/nginx/conf.d/templates/sites.template.sh > /etc/nginx/conf.d/sites.active &&
  371. . /etc/nginx/conf.d/templates/sogo_eas.template.sh > /etc/nginx/conf.d/sogo_eas.active &&
  372. . /etc/nginx/conf.d/templates/ssl_client_auth.template.sh &&
  373. nginx -qt &&
  374. until ping phpfpm -c1 > /dev/null; do sleep 1; done &&
  375. until ping sogo -c1 > /dev/null; do sleep 1; done &&
  376. until ping redis -c1 > /dev/null; do sleep 1; done &&
  377. until ping rspamd -c1 > /dev/null; do sleep 1; done &&
  378. exec nginx -g 'daemon off;'"
  379. environment:
  380. - DBNAME=${DBNAME}
  381. - DBUSER=${DBUSER}
  382. - DBPASS=${DBPASS}
  383. - HTTPS_PORT=${HTTPS_PORT:-443}
  384. - HTTP_PORT=${HTTP_PORT:-80}
  385. - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  386. - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
  387. - TZ=${TZ}
  388. - SKIP_SOGO=${SKIP_SOGO:-n}
  389. - ALLOW_ADMIN_EMAIL_LOGIN=${ALLOW_ADMIN_EMAIL_LOGIN:-n}
  390. - ADDITIONAL_SERVER_NAMES=${ADDITIONAL_SERVER_NAMES:-}
  391. volumes:
  392. - ./data/web:/web:ro,z
  393. - ./data/conf/rspamd/dynmaps:/dynmaps:ro,z
  394. - ./data/assets/ssl/:/etc/ssl/mail/:ro,z
  395. - ./data/conf/nginx/:/etc/nginx/conf.d/:z
  396. - ./data/conf/rspamd/meta_exporter:/meta_exporter:ro,z
  397. - ./data/conf/dovecot/auth/mailcowauth.php:/mailcowauth/mailcowauth.php:z
  398. - ./data/web/inc/functions.inc.php:/mailcowauth/functions.inc.php:z
  399. - ./data/web/inc/functions.auth.inc.php:/mailcowauth/functions.auth.inc.php:z
  400. - ./data/web/inc/sessions.inc.php:/mailcowauth/sessions.inc.php:z
  401. - sogo-web-vol-1:/usr/lib/GNUstep/SOGo/
  402. - mysql-socket-vol-1:/var/run/mysqld/
  403. ports:
  404. - "${HTTPS_BIND:-}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}"
  405. - "${HTTP_BIND:-}:${HTTP_PORT:-80}:${HTTP_PORT:-80}"
  406. restart: always
  407. networks:
  408. mailcow-network:
  409. aliases:
  410. - nginx
  411. acme-mailcow:
  412. depends_on:
  413. nginx-mailcow:
  414. condition: service_started
  415. unbound-mailcow:
  416. condition: service_healthy
  417. image: mailcow/acme:1.87
  418. dns:
  419. - ${IPV4_NETWORK:-172.22.1}.254
  420. environment:
  421. - LOG_LINES=${LOG_LINES:-9999}
  422. - ACME_CONTACT=${ACME_CONTACT:-}
  423. - ADDITIONAL_SAN=${ADDITIONAL_SAN}
  424. - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  425. - DBNAME=${DBNAME}
  426. - DBUSER=${DBUSER}
  427. - DBPASS=${DBPASS}
  428. - SKIP_LETS_ENCRYPT=${SKIP_LETS_ENCRYPT:-n}
  429. - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-mailcow-dockerized}
  430. - DIRECTORY_URL=${DIRECTORY_URL:-}
  431. - ENABLE_SSL_SNI=${ENABLE_SSL_SNI:-n}
  432. - SKIP_IP_CHECK=${SKIP_IP_CHECK:-n}
  433. - SKIP_HTTP_VERIFICATION=${SKIP_HTTP_VERIFICATION:-n}
  434. - ONLY_MAILCOW_HOSTNAME=${ONLY_MAILCOW_HOSTNAME:-n}
  435. - LE_STAGING=${LE_STAGING:-n}
  436. - TZ=${TZ}
  437. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  438. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  439. - SNAT_TO_SOURCE=${SNAT_TO_SOURCE:-n}
  440. - SNAT6_TO_SOURCE=${SNAT6_TO_SOURCE:-n}
  441. volumes:
  442. - ./data/web/.well-known/acme-challenge:/var/www/acme:z
  443. - ./data/assets/ssl:/var/lib/acme/:z
  444. - ./data/assets/ssl-example:/var/lib/ssl-example/:ro,Z
  445. - mysql-socket-vol-1:/var/run/mysqld/
  446. restart: always
  447. networks:
  448. mailcow-network:
  449. aliases:
  450. - acme
  451. netfilter-mailcow:
  452. image: mailcow/netfilter:1.57
  453. stop_grace_period: 30s
  454. restart: always
  455. privileged: true
  456. environment:
  457. - TZ=${TZ}
  458. - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
  459. - IPV6_NETWORK=${IPV6_NETWORK:-fd4d:6169:6c63:6f77::/64}
  460. - SNAT_TO_SOURCE=${SNAT_TO_SOURCE:-n}
  461. - SNAT6_TO_SOURCE=${SNAT6_TO_SOURCE:-n}
  462. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  463. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  464. - MAILCOW_REPLICA_IP=${MAILCOW_REPLICA_IP:-}
  465. - DISABLE_NETFILTER_ISOLATION_RULE=${DISABLE_NETFILTER_ISOLATION_RULE:-n}
  466. network_mode: "host"
  467. volumes:
  468. - /lib/modules:/lib/modules:ro
  469. watchdog-mailcow:
  470. image: mailcow/watchdog:2.02
  471. dns:
  472. - ${IPV4_NETWORK:-172.22.1}.254
  473. tmpfs:
  474. - /tmp
  475. volumes:
  476. - rspamd-vol-1:/var/lib/rspamd
  477. - mysql-socket-vol-1:/var/run/mysqld/
  478. - postfix-vol-1:/var/spool/postfix
  479. - ./data/assets/ssl:/etc/ssl/mail/:ro,z
  480. restart: always
  481. depends_on:
  482. - postfix-mailcow
  483. - dovecot-mailcow
  484. - mysql-mailcow
  485. - acme-mailcow
  486. - redis-mailcow
  487. environment:
  488. - IPV6_NETWORK=${IPV6_NETWORK:-fd4d:6169:6c63:6f77::/64}
  489. - LOG_LINES=${LOG_LINES:-9999}
  490. - TZ=${TZ}
  491. - DBNAME=${DBNAME}
  492. - DBUSER=${DBUSER}
  493. - DBPASS=${DBPASS}
  494. - DBROOT=${DBROOT}
  495. - USE_WATCHDOG=${USE_WATCHDOG:-n}
  496. - WATCHDOG_NOTIFY_EMAIL=${WATCHDOG_NOTIFY_EMAIL:-}
  497. - WATCHDOG_NOTIFY_BAN=${WATCHDOG_NOTIFY_BAN:-y}
  498. - WATCHDOG_NOTIFY_START=${WATCHDOG_NOTIFY_START:-y}
  499. - WATCHDOG_SUBJECT=${WATCHDOG_SUBJECT:-Watchdog ALERT}
  500. - WATCHDOG_NOTIFY_WEBHOOK=${WATCHDOG_NOTIFY_WEBHOOK:-}
  501. - WATCHDOG_NOTIFY_WEBHOOK_BODY=${WATCHDOG_NOTIFY_WEBHOOK_BODY:-}
  502. - WATCHDOG_EXTERNAL_CHECKS=${WATCHDOG_EXTERNAL_CHECKS:-n}
  503. - WATCHDOG_MYSQL_REPLICATION_CHECKS=${WATCHDOG_MYSQL_REPLICATION_CHECKS:-n}
  504. - WATCHDOG_VERBOSE=${WATCHDOG_VERBOSE:-n}
  505. - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  506. - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-mailcow-dockerized}
  507. - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
  508. - IP_BY_DOCKER_API=${IP_BY_DOCKER_API:-0}
  509. - CHECK_UNBOUND=${CHECK_UNBOUND:-1}
  510. - SKIP_CLAMD=${SKIP_CLAMD:-n}
  511. - SKIP_LETS_ENCRYPT=${SKIP_LETS_ENCRYPT:-n}
  512. - SKIP_SOGO=${SKIP_SOGO:-n}
  513. - HTTPS_PORT=${HTTPS_PORT:-443}
  514. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  515. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  516. - EXTERNAL_CHECKS_THRESHOLD=${EXTERNAL_CHECKS_THRESHOLD:-1}
  517. - NGINX_THRESHOLD=${NGINX_THRESHOLD:-5}
  518. - UNBOUND_THRESHOLD=${UNBOUND_THRESHOLD:-5}
  519. - REDIS_THRESHOLD=${REDIS_THRESHOLD:-5}
  520. - MYSQL_THRESHOLD=${MYSQL_THRESHOLD:-5}
  521. - MYSQL_REPLICATION_THRESHOLD=${MYSQL_REPLICATION_THRESHOLD:-1}
  522. - SOGO_THRESHOLD=${SOGO_THRESHOLD:-3}
  523. - POSTFIX_THRESHOLD=${POSTFIX_THRESHOLD:-8}
  524. - CLAMD_THRESHOLD=${CLAMD_THRESHOLD:-15}
  525. - DOVECOT_THRESHOLD=${DOVECOT_THRESHOLD:-12}
  526. - DOVECOT_REPL_THRESHOLD=${DOVECOT_REPL_THRESHOLD:-20}
  527. - PHPFPM_THRESHOLD=${PHPFPM_THRESHOLD:-5}
  528. - RATELIMIT_THRESHOLD=${RATELIMIT_THRESHOLD:-1}
  529. - FAIL2BAN_THRESHOLD=${FAIL2BAN_THRESHOLD:-1}
  530. - ACME_THRESHOLD=${ACME_THRESHOLD:-1}
  531. - RSPAMD_THRESHOLD=${RSPAMD_THRESHOLD:-5}
  532. - OLEFY_THRESHOLD=${OLEFY_THRESHOLD:-5}
  533. - MAILQ_THRESHOLD=${MAILQ_THRESHOLD:-20}
  534. - MAILQ_CRIT=${MAILQ_CRIT:-30}
  535. networks:
  536. mailcow-network:
  537. aliases:
  538. - watchdog
  539. dockerapi-mailcow:
  540. image: mailcow/dockerapi:2.07
  541. security_opt:
  542. - label=disable
  543. restart: always
  544. dns:
  545. - ${IPV4_NETWORK:-172.22.1}.254
  546. environment:
  547. - DBROOT=${DBROOT}
  548. - TZ=${TZ}
  549. - REDIS_SLAVEOF_IP=${REDIS_SLAVEOF_IP:-}
  550. - REDIS_SLAVEOF_PORT=${REDIS_SLAVEOF_PORT:-}
  551. volumes:
  552. - /var/run/docker.sock:/var/run/docker.sock:ro
  553. networks:
  554. mailcow-network:
  555. aliases:
  556. - dockerapi
  557. ##### Will be removed soon #####
  558. solr-mailcow:
  559. image: mailcow/solr:nightly-20231011
  560. restart: always
  561. depends_on:
  562. - netfilter-mailcow
  563. volumes:
  564. - solr-vol-1:/opt/solr/server/solr/dovecot-fts/data
  565. ports:
  566. - "${SOLR_PORT:-127.0.0.1:18983}:8983"
  567. environment:
  568. - TZ=${TZ}
  569. - SOLR_HEAP=${SOLR_HEAP:-1024}
  570. - SKIP_SOLR=${SKIP_SOLR:-y}
  571. networks:
  572. mailcow-network:
  573. aliases:
  574. - solr
  575. ################################
  576. olefy-mailcow:
  577. image: mailcow/olefy:nightly-20231011
  578. restart: always
  579. environment:
  580. - TZ=${TZ}
  581. - OLEFY_BINDADDRESS=0.0.0.0
  582. - OLEFY_BINDPORT=10055
  583. - OLEFY_TMPDIR=/tmp
  584. - OLEFY_PYTHON_PATH=/usr/bin/python3
  585. - OLEFY_OLEVBA_PATH=/usr/bin/olevba
  586. - OLEFY_LOGLVL=20
  587. - OLEFY_MINLENGTH=500
  588. - OLEFY_DEL_TMP=1
  589. networks:
  590. mailcow-network:
  591. aliases:
  592. - olefy
  593. ofelia-mailcow:
  594. image: mcuadros/ofelia:latest
  595. restart: always
  596. command: daemon --docker
  597. environment:
  598. - TZ=${TZ}
  599. depends_on:
  600. - sogo-mailcow
  601. - dovecot-mailcow
  602. labels:
  603. ofelia.enabled: "true"
  604. security_opt:
  605. - label=disable
  606. volumes:
  607. - /var/run/docker.sock:/var/run/docker.sock:ro
  608. networks:
  609. mailcow-network:
  610. aliases:
  611. - ofelia
  612. ipv6nat-mailcow:
  613. depends_on:
  614. - unbound-mailcow
  615. - mysql-mailcow
  616. - redis-mailcow
  617. - clamd-mailcow
  618. - rspamd-mailcow
  619. - php-fpm-mailcow
  620. - sogo-mailcow
  621. - dovecot-mailcow
  622. - postfix-mailcow
  623. - memcached-mailcow
  624. - nginx-mailcow
  625. - acme-mailcow
  626. - netfilter-mailcow
  627. - watchdog-mailcow
  628. - dockerapi-mailcow
  629. - solr-mailcow
  630. environment:
  631. - TZ=${TZ}
  632. image: robbertkl/ipv6nat
  633. security_opt:
  634. - label=disable
  635. restart: always
  636. privileged: true
  637. network_mode: "host"
  638. volumes:
  639. - /var/run/docker.sock:/var/run/docker.sock:ro
  640. - /lib/modules:/lib/modules:ro
  641. networks:
  642. mailcow-network:
  643. driver: bridge
  644. driver_opts:
  645. com.docker.network.bridge.name: br-mailcow
  646. enable_ipv6: true
  647. ipam:
  648. driver: default
  649. config:
  650. - subnet: ${IPV4_NETWORK:-172.22.1}.0/24
  651. - subnet: ${IPV6_NETWORK:-fd4d:6169:6c63:6f77::/64}
  652. volumes:
  653. vmail-vol-1:
  654. vmail-index-vol-1:
  655. mysql-vol-1:
  656. mysql-socket-vol-1:
  657. redis-vol-1:
  658. rspamd-vol-1:
  659. solr-vol-1:
  660. postfix-vol-1:
  661. crypt-vol-1:
  662. sogo-web-vol-1:
  663. sogo-userdata-backup-vol-1:
  664. clamd-db-vol-1: