Dokploy Deployment for Mautic 5 (#564)

* first draft

* second

* try 3

* 4

* Update docker-compose.yml

* Update template.toml

* Enhance healthchecks and service dependencies in Docker Compose

Updated healthcheck configurations for Mautic and MySQL services to improve service reliability. Added conditions to ensure services wait for dependencies to be healthy before starting.

* Update Mautic docker-compose with health checks and roles
This commit is contained in:
Christus Vincent
2026-01-08 03:11:03 +08:00
committed by GitHub
parent 7c2f0d4f8e
commit 1ead7d06a4
4 changed files with 277 additions and 0 deletions

View File

@@ -0,0 +1,131 @@
version: "3.8"
services:
# -------------------------------------------------------------------------
# Service 1: Database
# -------------------------------------------------------------------------
mysql:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MAUTIC_DB_DATABASE}
MYSQL_USER: ${MAUTIC_DB_USER}
MYSQL_PASSWORD: ${MAUTIC_DB_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
# -------------------------------------------------------------------------
# Service 2: Mautic Web (The Leader)
# -------------------------------------------------------------------------
mautic:
image: mautic/mautic:5.1.1-apache
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
ports:
- 80
environment:
- DOCKER_MAUTIC_ROLE=mautic_web
- DOCKER_MAUTIC_RUN_MIGRATIONS=true
- MAUTIC_DB_HOST=${MAUTIC_DB_HOST}
- MAUTIC_DB_PORT=${MAUTIC_DB_PORT}
- MAUTIC_DB_DATABASE=${MAUTIC_DB_DATABASE}
- MAUTIC_DB_USER=${MAUTIC_DB_USER}
- MAUTIC_DB_PASSWORD=${MAUTIC_DB_PASSWORD}
- MAUTIC_URL=${MAUTIC_URL}
- MAUTIC_TRUSTED_PROXIES=${MAUTIC_TRUSTED_PROXIES}
- MAUTIC_MESSENGER_DSN_EMAIL=${MAUTIC_MESSENGER_DSN_EMAIL}
- MAUTIC_MESSENGER_DSN_HIT=${MAUTIC_MESSENGER_DSN_HIT}
- PHP_INI_DATE_TIMEZONE=${PHP_INI_DATE_TIMEZONE}
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}
volumes:
- mautic_data:/var/www/html
# AUTOMATION FIX 1: Force permissions to be correct on every start
entrypoint: ["/bin/sh", "-c", "chown -R www-data:www-data /var/www/html && /entrypoint.sh apache2-foreground"]
# AUTOMATION FIX 2: Check if the CONFIG FILE exists. If not, report 'unhealthy'.
# This signals the other containers to keep waiting.
healthcheck:
test: ["CMD-SHELL", "test -f /var/www/html/config/local.php || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 300s # Give you 5 mins to run the installer before marking failed
# -------------------------------------------------------------------------
# Service 3: Mautic Cron (Waits for Install)
# -------------------------------------------------------------------------
mautic-cron:
image: mautic/mautic:5.1.1-apache
restart: unless-stopped
depends_on:
mautic:
condition: service_healthy # AUTOMATION FIX 3: Do not start until config file exists
environment:
- DOCKER_MAUTIC_ROLE=mautic_cron
- MAUTIC_DB_HOST=${MAUTIC_DB_HOST}
- MAUTIC_DB_PORT=${MAUTIC_DB_PORT}
- MAUTIC_DB_DATABASE=${MAUTIC_DB_DATABASE}
- MAUTIC_DB_USER=${MAUTIC_DB_USER}
- MAUTIC_DB_PASSWORD=${MAUTIC_DB_PASSWORD}
- MAUTIC_URL=${MAUTIC_URL}
- PHP_INI_DATE_TIMEZONE=${PHP_INI_DATE_TIMEZONE}
volumes:
- mautic_data:/var/www/html
# -------------------------------------------------------------------------
# Service 4: Mautic Worker (Waits for Install)
# -------------------------------------------------------------------------
mautic-worker:
image: mautic/mautic:5.1.1-apache
restart: unless-stopped
depends_on:
mautic:
condition: service_healthy # AUTOMATION FIX 3: Do not start until config file exists
deploy:
resources:
limits:
memory: 512M
environment:
- DOCKER_MAUTIC_ROLE=mautic_worker
- DOCKER_MAUTIC_WORKERS_CONSUME_EMAIL=2
- DOCKER_MAUTIC_WORKERS_CONSUME_HIT=2
- DOCKER_MAUTIC_WORKERS_CONSUME_FAILED=2
- MAUTIC_DB_HOST=${MAUTIC_DB_HOST}
- MAUTIC_DB_PORT=${MAUTIC_DB_PORT}
- MAUTIC_DB_DATABASE=${MAUTIC_DB_DATABASE}
- MAUTIC_DB_USER=${MAUTIC_DB_USER}
- MAUTIC_DB_PASSWORD=${MAUTIC_DB_PASSWORD}
- MAUTIC_URL=${MAUTIC_URL}
- MAUTIC_MESSENGER_DSN_EMAIL=${MAUTIC_MESSENGER_DSN_EMAIL}
- MAUTIC_MESSENGER_DSN_HIT=${MAUTIC_MESSENGER_DSN_HIT}
- PHP_INI_DATE_TIMEZONE=${PHP_INI_DATE_TIMEZONE}
volumes:
- mautic_data:/var/www/html
# -------------------------------------------------------------------------
# Service 5: phpMyAdmin
# -------------------------------------------------------------------------
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
environment:
PMA_HOST: mysql
PMA_PORT: 3306
UPLOAD_LIMIT: 64M
ports:
- 80
volumes:
mysql_data:
mautic_data:

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 242.6 230.8" enable-background="new 0 0 242.6 230.8" xml:space="preserve">
<g id="tagline">
<g>
<path fill="#8790B8" d="M0,206.6h12.3v1.8H2.2v6.6h9.4v1.8H2.2v8H0V206.6z"/>
<path fill="#8790B8" d="M22,213.4c-2.9,0-4.9,2.3-5,5v6.3h-2v-13h2v3.7c0.9-2.3,2.7-3.8,5-3.8V213.4z"/>
<path fill="#8790B8" d="M25.4,218.8c0.2,2.6,2.1,4.4,4.8,4.4c1.6,0,2.8-0.5,3.7-1.4c0.4,0.4,0.8,0.8,1.1,1.1
c-1.2,1.2-2.9,1.9-4.9,1.9c-4,0-6.7-2.7-6.7-6.6c0-3.9,2.5-6.6,6.2-6.6c3.6,0,6.1,2.7,6.1,6.6v0.6H25.4z M33.7,217.4
c-0.1-2.5-1.8-4.1-4.1-4.1c-2.3,0-3.9,1.7-4.2,4.1H33.7z"/>
<path fill="#8790B8" d="M39.7,218.8c0.2,2.6,2.1,4.4,4.8,4.4c1.6,0,2.8-0.5,3.7-1.4c0.4,0.4,0.8,0.8,1.1,1.1
c-1.2,1.2-2.9,1.9-4.9,1.9c-4,0-6.7-2.7-6.7-6.6c0-3.9,2.5-6.6,6.2-6.6c3.6,0,6.1,2.7,6.1,6.6v0.6H39.7z M47.9,217.4
c-0.1-2.5-1.8-4.1-4.1-4.1c-2.3,0-3.9,1.7-4.2,4.1H47.9z"/>
<path fill="#8790B8" d="M67.7,227.2c-0.9,2-2,3.5-3.9,3.5c-1.2,0-2.2-0.3-2.9-1.1l1-1.1c0.4,0.4,1.1,0.5,1.8,0.5
c1.1,0,1.8-1.1,2.4-2.5l0.9-1.8L61,211.8h2l4.8,10.7l4.9-10.7h2L67.7,227.2z"/>
<path fill="#8790B8" d="M81.4,211.6c3.9,0,6.6,2.7,6.6,6.6c0,3.9-2.7,6.6-6.6,6.6c-3.9,0-6.6-2.7-6.6-6.6
C74.8,214.3,77.5,211.6,81.4,211.6z M81.4,223.2c2.7,0,4.6-2,4.6-5s-1.9-5-4.6-5c-2.7,0-4.6,2-4.6,5S78.6,223.2,81.4,223.2z"/>
<path fill="#8790B8" d="M92.1,219.4c0,2.3,1.5,3.8,3.5,3.8c2.4,0,4.1-2.2,4.1-4.8v-6.6h2v13h-2v-3.2c-0.9,2-2.7,3.4-5,3.4
c-2.8,0-4.7-2.1-4.7-5.2v-7.9h2V219.4z"/>
<path fill="#8790B8" d="M111.9,213.4c-2.9,0-4.9,2.3-5,5v6.3h-2v-13h2v3.7c0.9-2.3,2.7-3.8,5-3.8V213.4z"/>
<path fill="#8790B8" d="M131.4,216.5c0-1.9-1.1-3.2-2.8-3.2c-2,0-3.5,1.7-3.5,4v7.4h-2v-13h2v2.5c0.9-1.6,2.4-2.6,4.3-2.6
c1.7,0,3,1,3.6,2.6c0.9-1.6,2.5-2.6,4.6-2.6c2.5,0,4.2,2,4.2,4.9v8.2h-2v-8.2c0-1.9-1.1-3.2-2.8-3.2c-2,0-3.5,1.7-3.6,4v7.4h-2
V216.5z"/>
<path fill="#8790B8" d="M144.6,213.4c1.3-1.1,2.9-1.8,5-1.8c3.2,0,5.5,2,5.5,4.8v8.3h-2v-2.9c-0.8,1.8-2.5,3-4.7,3
c-2.6,0-4.4-1.5-4.4-3.7c0-2.5,2.5-4.2,6.1-4.2c1,0,2,0.1,2.9,0.3v-0.8c0-1.9-1.4-3.2-3.4-3.2c-1.5,0-3,0.3-4,1.2L144.6,213.4z
M150.2,218.2c-2.5,0-4.3,1.1-4.3,2.7c0,1.3,1.3,2.2,3.1,2.2c2.4,0,4-2.1,4-4.6C152.1,218.3,151.3,218.2,150.2,218.2z"/>
<path fill="#8790B8" d="M165.2,213.4c-2.9,0-4.9,2.3-5,5v6.3h-2v-13h2v3.7c0.9-2.3,2.7-3.8,5-3.8V213.4z"/>
<path fill="#8790B8" d="M167.6,224.7v-18.8h2v12.1l6.1-6.3h2.4l-5.5,5.8l6.4,7.2h-2.3l-5.3-5.9l-1.7,1.9v4H167.6z"/>
<path fill="#8790B8" d="M181.5,218.8c0.2,2.6,2.1,4.4,4.8,4.4c1.6,0,2.8-0.5,3.7-1.4c0.4,0.4,0.8,0.8,1.1,1.1
c-1.2,1.2-2.9,1.9-4.9,1.9c-4,0-6.7-2.7-6.7-6.6c0-3.9,2.5-6.6,6.2-6.6s6.1,2.7,6.1,6.6v0.6H181.5z M189.7,217.4
c-0.1-2.5-1.8-4.1-4.1-4.1c-2.3,0-3.9,1.7-4.2,4.1H189.7z"/>
<path fill="#8790B8" d="M192.9,211.8h1.9v-3h2v3h4.8v1.6h-4.8v6.8c0,1.8,1.2,3,2.8,3c0.9,0,1.6-0.3,2.1-0.8l1.1,1.1
c-0.9,0.9-2,1.4-3.4,1.4c-2.7,0-4.6-1.9-4.6-4.7v-6.7h-1.9V211.8z"/>
<path fill="#8790B8" d="M204.8,206.6h2v2.4h-2V206.6z M204.8,224.7v-13h2v13H204.8z"/>
<path fill="#8790B8" d="M219.5,216.9c0-2.2-1.4-3.7-3.5-3.7c-2.5,0-4.1,2.3-4.1,5.1v6.4h-2v-13h2v3.3c0.9-2,2.7-3.4,5-3.4
c2.8,0,4.7,2,4.7,4.9v8.2h-2V216.9z"/>
<path fill="#8790B8" d="M225.1,227.7c0.9,0.8,2.3,1.3,4,1.3c2.7,0,4.5-1.8,4.5-4.3v-2.9c-0.9,1.8-2.6,3-4.9,3
c-3.1,0-5.2-2.6-5.2-6.3c0-4.1,3-6.9,7.3-6.9c1.8,0,3.4,0.3,4.8,0.9v12.2c0,3.5-2.7,6-6.5,6c-2.1,0-3.8-0.7-5.1-1.9L225.1,227.7z
M233.6,213.8c-0.9-0.3-2-0.5-3.2-0.5c-2.9,0-4.9,2.2-4.9,5.2c0,2.8,1.7,4.7,4.1,4.7c2.3,0,4-1.7,4-3.8V213.8z"/>
<path fill="#8790B8" d="M240,219.2v-12.6h2v12.6H240z M240,221.8h2v2.9h-2V221.8z"/>
</g>
</g>
<g id="logo">
<g>
<path fill="#4E5E9E" d="M26.1,187.9v-20.8c0-5.1-2.7-9.8-8-9.8c-5.2,0-8.3,4.6-8.3,9.8v20.8H0.3V149h8.9l0.7,4.7
c2-3.9,6.5-5.4,10.2-5.4c4.6,0,9.3,1.9,11.5,7.2c3.5-5.5,8-7.1,13-7.1c11,0,16.5,6.8,16.5,18.4v21h-9.6v-21c0-5.1-2.1-9.5-7.3-9.5
c-5.2,0-8.4,4.5-8.4,9.6v20.8H26.1z"/>
<path fill="#4E5E9E" d="M98.5,149.1h9.2v38.8h-9.1l-0.5-5.7c-2.2,4.6-8.3,6.8-12.6,6.9c-11.5,0.1-20-7-20-20.6
c0-13.4,8.9-20.4,20.2-20.3c5.2,0,10.2,2.4,12.4,6.3L98.5,149.1z M75.2,168.5c0,7.4,5.1,11.8,11.5,11.8c15.1,0,15.1-23.6,0-23.6
C80.3,156.7,75.2,161.1,75.2,168.5z"/>
<path fill="#4E5E9E" d="M123.5,149.1v20.3c0,5.9,3.2,10.4,9.4,10.4c5.9,0,9.9-5,9.9-10.9v-19.9h9.5V188h-8.6l-0.6-5.3
c-4,3.9-7.7,5.8-13.2,5.8c-9.3,0-16.1-7-16.1-19.1v-20.4H123.5z"/>
<path fill="#4E5E9E" d="M174.4,138.1v11h10.7v8.3h-10.8v16.8c0,3.7,2,5.5,5,5.5c1.5,0,3.2-0.5,4.6-1.2l2.7,8.2
c-2.8,1.1-5,1.6-8,1.7c-8.4,0.3-13.9-4.5-13.9-14.2v-16.8h-7.2v-8.3h7.2v-10L174.4,138.1z"/>
<path fill="#4E5E9E" d="M202.7,138.1c0,7.5-11.3,7.5-11.3,0C191.4,130.7,202.7,130.7,202.7,138.1z M192.3,148.9v39h9.6v-39H192.3z
"/>
<path fill="#4E5E9E" d="M242.6,183c-4.5,4.4-9.2,6.1-15,6.1c-11.3,0-20.6-6.8-20.6-20.6s9.4-20.6,20.6-20.6c5.5,0,9.8,1.6,14,5.8
l-6.1,6.4c-2.3-2-5.1-3.1-7.8-3.1c-6.5,0-11.2,4.7-11.2,11.5c0,7.4,5,11.3,11,11.3c3.1,0,6.1-0.9,8.5-3.2L242.6,183z"/>
</g>
</g>
<g id="brandmark">
<g>
<path fill="#4E5E9E" d="M121.2,119c-32.7,0-59.4-26.6-59.4-59.4S88.5,0.2,121.2,0.2c7.9,0,15.6,1.5,22.8,4.6c2,0.9,3,3.2,2.2,5.3
c-0.9,2-3.2,3-5.3,2.2c-6.3-2.6-12.9-3.9-19.7-3.9c-28.3,0-51.3,23-51.3,51.3s23,51.3,51.3,51.3c28.3,0,51.3-23,51.3-51.3
c0-6.1-1-12-3.1-17.6c-0.8-2.1,0.3-4.4,2.4-5.2c2.1-0.8,4.4,0.3,5.2,2.4c2.4,6.5,3.6,13.4,3.6,20.4C180.6,92.3,154,119,121.2,119z
"/>
</g>
<g>
<polygon fill="#FDB933" points="147.2,53.5 138,63.1 143.1,84.6 154.7,84.6 "/>
</g>
<polygon fill="#FDB933" points="143.4,25.1 146.6,28.3 121.2,55.2 99.5,32.9 87,84.6 98.6,84.6 105.5,55.9 121.2,73 154.8,36.4
158,39.7 161.2,21.6 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -0,0 +1,52 @@
[variables]
# Domain 1: For the main Mautic Application
mautic_domain = "${domain}"
# Domain 2: For phpMyAdmin (Database Manager)
pma_domain = "${domain}"
# Security: Random passwords
db_password = "${password:32}"
root_password = "${password:32}"
[config]
# --- Service 1: Mautic Web ---
[[config.domains]]
serviceName = "mautic"
port = 80
host = "${mautic_domain}"
path = "/"
# --- Service 2: phpMyAdmin ---
[[config.domains]]
serviceName = "phpmyadmin"
port = 80
host = "${pma_domain}"
path = "/"
# --- Shared Environment Variables ---
[config.env]
# URL Configuration
MAUTIC_URL = "https://${mautic_domain}"
# Database Connections
MAUTIC_DB_HOST = "mysql"
MAUTIC_DB_PORT = "3306"
MAUTIC_DB_DATABASE = "mautic"
MAUTIC_DB_USER = "mautic"
MAUTIC_DB_PASSWORD = "${db_password}"
MYSQL_ROOT_PASSWORD = "${root_password}"
# Security & Proxy (JSON ARRAY FIXED)
# We use single quotes '...' so TOML treats the inner [...] as a string
MAUTIC_TRUSTED_PROXIES = '["0.0.0.0/0"]'
# Queue Settings
MAUTIC_MESSENGER_DSN_EMAIL = "doctrine://default"
MAUTIC_MESSENGER_DSN_HIT = "doctrine://default"
# PHP Settings
PHP_INI_DATE_TIMEZONE = "UTC"
PHP_MEMORY_LIMIT = "512M"

View File

@@ -3734,6 +3734,24 @@
"self-hosted"
]
},
{
"id": "mautic",
"name": "Mautic",
"version": "5.1.1",
"description": "Mautic is the world's largest open-source marketing automation project. It allows you to automate the process of finding and nurturing contacts through landing pages and forms, sending email, text messages, web notifications, and tracking your contacts.",
"logo": "mautic.svg",
"links": {
"github": "https://github.com/mautic/mautic",
"website": "https://www.mautic.org/",
"docs": "https://docs.mautic.org/en"
},
"tags": [
"marketing",
"automation",
"email",
"crm"
]
},
{
"id": "maybe",
"name": "Maybe",