docker-compose.yml 25 KB

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