From e4c7767f33e91457140a84d44a735735c9eb222b Mon Sep 17 00:00:00 2001 From: henmohr Date: Fri, 22 Aug 2025 13:07:54 -0300 Subject: [PATCH 01/10] Update Dockerfile.apache --- .docker/Dockerfile.apache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile.apache b/.docker/Dockerfile.apache index 20adb829..a38e4b63 100644 --- a/.docker/Dockerfile.apache +++ b/.docker/Dockerfile.apache @@ -1,4 +1,4 @@ -FROM php:8.1-apache +FROM php:8.3-apache LABEL vendor="Mautic" LABEL maintainer="LibreCode coop" From 1a59d4e8ce556e756e107f4b8962e9e282ad97b3 Mon Sep 17 00:00:00 2001 From: henmohr Date: Mon, 15 Sep 2025 11:29:29 -0300 Subject: [PATCH 02/10] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 23173547..f28a9fc7 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,8 @@ The `examples` folder contains examples of `docker-compose` setups that use the You can build your own images easily using the `docker build` command in the root of this directory: ``` -docker build . -f Dockerfile.apache -t librecodecoop/mautic:5-apache -docker build . -f Dockerfile.fpm -t librecodecoop/mautic:5-fpm +docker build . -f Dockerfile.apache -t librecodecoop/mautic:6-apache +docker build . -f Dockerfile.fpm -t librecodecoop/mautic:6-fpm ``` ## Persistent storage @@ -184,4 +184,4 @@ You can also reach the Mautic community through its [online forums](https://www. You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. -Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/librecodecoop/mautic-docker/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing. \ No newline at end of file +Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/librecodecoop/mautic-docker/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing. From 401639c727c6f5a8cf0b854936bec8493a403252 Mon Sep 17 00:00:00 2001 From: henmohr Date: Fri, 12 Dec 2025 15:48:19 -0300 Subject: [PATCH 03/10] bump versions Signed-off-by: henmohr --- .docker/.mautic_env | 11 +++++++++++ .docker/Dockerfile.apache | 2 +- .docker/Dockerfile.fpm | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .docker/.mautic_env diff --git a/.docker/.mautic_env b/.docker/.mautic_env new file mode 100644 index 00000000..3c29a702 --- /dev/null +++ b/.docker/.mautic_env @@ -0,0 +1,11 @@ +# use this file for environment variables that can be used. +# see https://docs.mautic.org/en/5.x/ + +MAUTIC_DB_HOST="${MYSQL_HOST}" +MAUTIC_DB_PORT="${MYSQL_PORT}" +MAUTIC_DB_DATABASE="${MYSQL_DATABASE}" +MAUTIC_DB_USER="${MYSQL_USER}" +MAUTIC_DB_PASSWORD="${MYSQL_PASSWORD}" + +MAUTIC_MESSENGER_DSN_EMAIL="doctrine://default" +MAUTIC_MESSENGER_DSN_HIT="doctrine://default" diff --git a/.docker/Dockerfile.apache b/.docker/Dockerfile.apache index a38e4b63..bc62c947 100644 --- a/.docker/Dockerfile.apache +++ b/.docker/Dockerfile.apache @@ -62,7 +62,7 @@ ENV DOCKER_MAUTIC_WORKERS_CONSUME_EMAIL=2 \ # Install NVM ENV NVM_DIR=/usr/local/nvm \ - NODE_VERSION=20.18.1 + NODE_VERSION=25.2.1 SHELL ["/bin/bash", "-o", "pipefail", "-c"] # hadolint ignore=SC1091 RUN mkdir -p /usr/local/nvm && \ diff --git a/.docker/Dockerfile.fpm b/.docker/Dockerfile.fpm index f09e76d0..5a8ecd14 100644 --- a/.docker/Dockerfile.fpm +++ b/.docker/Dockerfile.fpm @@ -1,4 +1,4 @@ -FROM php:8.1-fpm +FROM php:8.3-fpm LABEL vendor="Mautic" LABEL maintainer="LibreCode coop" @@ -56,7 +56,7 @@ ENV DOCKER_MAUTIC_WORKERS_CONSUME_EMAIL=2 \ # Install NVM ENV NVM_DIR=/usr/local/nvm \ - NODE_VERSION=20.18.1 + NODE_VERSION=25.2.1 SHELL ["/bin/bash", "-o", "pipefail", "-c"] # hadolint ignore=SC1091 RUN mkdir -p /usr/local/nvm && \ From 962bcc2be0b7dade292ce2bbe5ffa0a812fc0e37 Mon Sep 17 00:00:00 2001 From: henmohr Date: Thu, 28 May 2026 14:26:46 -0300 Subject: [PATCH 04/10] bump mautic to 7 --- .docker/.mautic_env | 2 +- .docker/scripts/entrypoint.sh | 2 +- .github/workflows/build_publish.yml | 4 ++-- README.md | 16 ++++++++-------- docker-compose.yml | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.docker/.mautic_env b/.docker/.mautic_env index 3c29a702..7a5da3f1 100644 --- a/.docker/.mautic_env +++ b/.docker/.mautic_env @@ -1,5 +1,5 @@ # use this file for environment variables that can be used. -# see https://docs.mautic.org/en/5.x/ +# see https://docs.mautic.org/en/7.x/ MAUTIC_DB_HOST="${MYSQL_HOST}" MAUTIC_DB_PORT="${MYSQL_PORT}" diff --git a/.docker/scripts/entrypoint.sh b/.docker/scripts/entrypoint.sh index 461fd00d..31661d06 100644 --- a/.docker/scripts/entrypoint.sh +++ b/.docker/scripts/entrypoint.sh @@ -17,7 +17,7 @@ elif [ "$DOCKER_MAUTIC_ROLE" = "mautic_web" ]; then nvm use default cd /var/www || { echo "Directory not found /var/www"; exit 1; } - COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_PROCESS_TIMEOUT=10000 composer create-project mautic/recommended-project:"${MAUTIC_VERSION:-5.x-dev}" html --no-interaction + COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_PROCESS_TIMEOUT=10000 composer create-project mautic/recommended-project:"${MAUTIC_VERSION:-7.x-dev}" html --no-interaction chown -R www-data: html cd html || { echo "Directory not found /var/www/html"; exit 1; } rm -rf var/cache/js diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index 401c585d..fe0b95ae 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -8,10 +8,10 @@ on: required: true overwrite_latest_major: type: boolean - description: "Overwrite latest major tag (e.g.`5`). This should only be checked if you're releasing the latest release." + description: "Overwrite latest major tag (e.g.`7`). This should only be checked if you're releasing the latest release." overwrite_latest_minor: type: boolean - description: "Overwrite latest minor tag (e.g.`5.0`). This should only be checked if you're releasing the latest release within the minor release." + description: "Overwrite latest minor tag (e.g.`7.0`). This should only be checked if you're releasing the latest release within the minor release." tag_as_latest: type: boolean description: "Tag this release as latest" diff --git a/README.md b/README.md index f28a9fc7..35f83fef 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # Mautic Docker image and examples > [!NOTE] -> _This version refers to Docker images and examples for Mautic 5. If you would like information about older versions, see https://github.com/mautic/docker-mautic/tree/mautic4._ +> _This version refers to Docker images and examples for Mautic 7. If you would like information about older versions, see https://github.com/mautic/docker-mautic/tree/mautic4._ > [!NOTE] > This fork was made to make possible use xdebug ## Versions -all Mautic 5 Docker images follow the following naming stategy. +all Mautic 7 Docker images follow the following naming stategy. `-` @@ -18,9 +18,9 @@ There are some defaults if parts are omitted: some examples: -* `5-apache`: latest stable version of Mautic 5 of the `apache` variant -* `5.0-fpm`: latest version in the 5.0 minor release in the `fpm` variant -* `5.0.3-apache`: specific point release of the `apache` variant +* `7-apache`: latest stable version of Mautic 7 of the `apache` variant +* `7.0-fpm`: latest version in the 7.0 minor release in the `fpm` variant +* `7.0.3-apache`: specific point release of the `apache` variant ## Variants @@ -73,8 +73,8 @@ The `examples` folder contains examples of `docker-compose` setups that use the You can build your own images easily using the `docker build` command in the root of this directory: ``` -docker build . -f Dockerfile.apache -t librecodecoop/mautic:6-apache -docker build . -f Dockerfile.fpm -t librecodecoop/mautic:6-fpm +docker build . -f Dockerfile.apache -t librecodecoop/mautic:7-apache +docker build . -f Dockerfile.fpm -t librecodecoop/mautic:7-fpm ``` ## Persistent storage @@ -144,7 +144,7 @@ See the general Mautic documentation for more info. ### Customization Currently this image has no easy way to extend Mautic (e.g. adding extra `composer` dependencies or installing extra plugins or themes). -This is an ongoing effort we hope to support in an upcoming 5.x release. +This is an ongoing effort we hope to support in an upcoming 7.x release. For now, please build your own images based on the official ones to add the needed dependencies, plugins and themes. diff --git a/docker-compose.yml b/docker-compose.yml index f4789e7a..7982276c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ x-mautic-volumes: &mautic-volumes - ./volumes/cron:/opt/mautic/cron:z x-mautic-environments: &mautic-environments - MAUTIC_VERSION: ${MAUTIC_VERSION:-5.x-dev} + MAUTIC_VERSION: ${MAUTIC_VERSION:-7.x-dev} TZ: ${TZ:-CET} HOST_UID: ${HOST_UID:-1000} HOST_GID: ${HOST_GID:-1000} @@ -19,7 +19,7 @@ x-mautic-environments: &mautic-environments services: mautic_web: - image: ghcr.io/librecodecoop/mautic:${MAUTIC_VERSION:-5.x-dev}-${IMAGE_TYPE:-apache} + image: ghcr.io/librecodecoop/mautic:${MAUTIC_VERSION:-7.x-dev}-${IMAGE_TYPE:-apache} # build: # context: .docker/ # dockerfile: Dockerfile.${IMAGE_TYPE:-apache} @@ -37,7 +37,7 @@ services: retries: 100 mautic_cron: - image: ghcr.io/librecodecoop/mautic:${MAUTIC_VERSION:-5.x-dev}-${IMAGE_TYPE:-apache} + image: ghcr.io/librecodecoop/mautic:${MAUTIC_VERSION:-7.x-dev}-${IMAGE_TYPE:-apache} # build: # context: .docker/ # dockerfile: Dockerfile.${IMAGE_TYPE:-apache} @@ -51,7 +51,7 @@ services: condition: service_healthy mautic_worker: - image: ghcr.io/librecodecoop/mautic:${MAUTIC_VERSION:-5.x-dev}-${IMAGE_TYPE:-apache} + image: ghcr.io/librecodecoop/mautic:${MAUTIC_VERSION:-7.x-dev}-${IMAGE_TYPE:-apache} # build: # context: .docker/ # dockerfile: Dockerfile.${IMAGE_TYPE:-apache} From bd27c3a696f31f226a73f7e6a8535e223e5de7ee Mon Sep 17 00:00:00 2001 From: henmohr Date: Thu, 28 May 2026 14:42:59 -0300 Subject: [PATCH 05/10] add env-based mautic auto install --- .docker/.mautic_env | 8 +++ .docker/scripts/entrypoint_mautic_web.sh | 69 ++++++++++++++++++++++-- README.md | 22 ++++++++ 3 files changed, 96 insertions(+), 3 deletions(-) diff --git a/.docker/.mautic_env b/.docker/.mautic_env index 7a5da3f1..336a8df4 100644 --- a/.docker/.mautic_env +++ b/.docker/.mautic_env @@ -9,3 +9,11 @@ MAUTIC_DB_PASSWORD="${MYSQL_PASSWORD}" MAUTIC_MESSENGER_DSN_EMAIL="doctrine://default" MAUTIC_MESSENGER_DSN_HIT="doctrine://default" + +MAUTIC_AUTO_INSTALL="false" +MAUTIC_SITE_URL="http://localhost" +MAUTIC_ADMIN_FIRSTNAME="Admin" +MAUTIC_ADMIN_LASTNAME="Mautic" +MAUTIC_ADMIN_USERNAME="admin" +MAUTIC_ADMIN_EMAIL="admin@example.com" +MAUTIC_ADMIN_PASSWORD="ChangeMe123!" diff --git a/.docker/scripts/entrypoint_mautic_web.sh b/.docker/scripts/entrypoint_mautic_web.sh index b6439e70..143bcaab 100644 --- a/.docker/scripts/entrypoint_mautic_web.sh +++ b/.docker/scripts/entrypoint_mautic_web.sh @@ -1,8 +1,42 @@ #!/bin/bash +set -e + chown -R www-data:www-data /var/www/html/config /var/www/html/var/logs /var/www/html/docroot/media -# wait untill the db is fully up before proceeding +mautic_site_url="${MAUTIC_SITE_URL:-http://localhost}" +mautic_admin_firstname="${MAUTIC_ADMIN_FIRSTNAME:-Admin}" +mautic_admin_lastname="${MAUTIC_ADMIN_LASTNAME:-Mautic}" +mautic_admin_username="${MAUTIC_ADMIN_USERNAME:-admin}" +mautic_admin_email="${MAUTIC_ADMIN_EMAIL:-admin@example.com}" +mautic_admin_password="${MAUTIC_ADMIN_PASSWORD:-ChangeMe123!}" +mautic_db_table_prefix="${MAUTIC_DB_TABLE_PREFIX:-}" +mautic_db_backup_tables="${MAUTIC_DB_BACKUP_TABLES:-true}" +mautic_db_backup_prefix="${MAUTIC_DB_BACKUP_PREFIX:-bak_}" + +install_mautic() { + su -s /bin/bash www-data -c 'php /var/www/html/bin/console mautic:install "$MAUTIC_SITE_URL" --force \ + --db_driver=pdo_mysql \ + --db_host="$MAUTIC_DB_HOST" \ + --db_port="$MAUTIC_DB_PORT" \ + --db_name="$MAUTIC_DB_DATABASE" \ + --db_user="$MAUTIC_DB_USER" \ + --db_password="$MAUTIC_DB_PASSWORD" \ + --db_table_prefix="$MAUTIC_DB_TABLE_PREFIX" \ + --db_backup_tables="$MAUTIC_DB_BACKUP_TABLES" \ + --db_backup_prefix="$MAUTIC_DB_BACKUP_PREFIX" \ + --admin_firstname="$MAUTIC_ADMIN_FIRSTNAME" \ + --admin_lastname="$MAUTIC_ADMIN_LASTNAME" \ + --admin_username="$MAUTIC_ADMIN_USERNAME" \ + --admin_email="$MAUTIC_ADMIN_EMAIL" \ + --admin_password="$MAUTIC_ADMIN_PASSWORD"' +} + +mautic_is_installed() { + php -r 'if (!file_exists("/var/www/html/config/local.php")) { exit(1); } include "/var/www/html/config/local.php"; exit(isset($parameters["db_driver"], $parameters["site_url"]) ? 0 : 1);' +} + +# wait until the db is fully up before proceeding while [[ $(mysqladmin --host="$MAUTIC_DB_HOST" --port="$MAUTIC_DB_PORT" --user="$MAUTIC_DB_USER" --password="$MAUTIC_DB_PASSWORD" ping) != "mysqld is alive" ]]; do sleep 1 done @@ -10,7 +44,6 @@ done # generate a local config file if it doesn't exist. # This is needed to ensure the db credentials can be prefilled in the UI, as env vars aren't taken into account. if [ ! -f /var/www/html/config/local.php ]; then - su -s /bin/bash www-data -c 'touch /var/www/html/config/local.php' cat <<'EOF' > /var/www/html/config/local.php @@ -29,11 +62,41 @@ $parameters = array( EOF fi +if [ "$MAUTIC_AUTO_INSTALL" = "true" ] && [ -f /var/www/html/config/local.php ]; then + if ! mautic_is_installed; then + rm -f /var/www/html/config/local.php + fi +fi + +if [ "$MAUTIC_AUTO_INSTALL" = "true" ] && [ ! -f /var/www/html/config/local.php ]; then + MAUTIC_SITE_URL="$mautic_site_url" \ + MAUTIC_ADMIN_FIRSTNAME="$mautic_admin_firstname" \ + MAUTIC_ADMIN_LASTNAME="$mautic_admin_lastname" \ + MAUTIC_ADMIN_USERNAME="$mautic_admin_username" \ + MAUTIC_ADMIN_EMAIL="$mautic_admin_email" \ + MAUTIC_ADMIN_PASSWORD="$mautic_admin_password" \ + MAUTIC_DB_TABLE_PREFIX="$mautic_db_table_prefix" \ + MAUTIC_DB_BACKUP_TABLES="$mautic_db_backup_tables" \ + MAUTIC_DB_BACKUP_PREFIX="$mautic_db_backup_prefix" \ + install_mautic +fi + # prepare mautic with test data if [ "$DOCKER_MAUTIC_LOAD_TEST_DATA" = "true" ]; then su -s /bin/bash www-data -c 'php /var/www/html/bin/console doctrine:migrations:sync-metadata-storage' # mautic installation with dummy password and email, as the next step (doctrine:fixtures:load) will overwrite those - su -s /bin/bash www-data -c 'php /var/www/html/bin/console mautic:install --force --admin_email willchange@mautic.org --admin_password willchange http://localhost' + if ! mautic_is_installed; then + MAUTIC_SITE_URL="$mautic_site_url" \ + MAUTIC_ADMIN_FIRSTNAME="$mautic_admin_firstname" \ + MAUTIC_ADMIN_LASTNAME="$mautic_admin_lastname" \ + MAUTIC_ADMIN_USERNAME="$mautic_admin_username" \ + MAUTIC_ADMIN_EMAIL="$mautic_admin_email" \ + MAUTIC_ADMIN_PASSWORD="$mautic_admin_password" \ + MAUTIC_DB_TABLE_PREFIX="$mautic_db_table_prefix" \ + MAUTIC_DB_BACKUP_TABLES="$mautic_db_backup_tables" \ + MAUTIC_DB_BACKUP_PREFIX="$mautic_db_backup_prefix" \ + install_mautic + fi su -s /bin/bash www-data -c 'php /var/www/html/bin/console doctrine:fixtures:load -n' fi diff --git a/README.md b/README.md index 35f83fef..adb05e66 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,12 @@ You can get all available environments looking at a docker-compose.yml file that - `DOCKER_MAUTIC_ROLE`: which role does the container has to perform. Defaults to `mautic_web`, other supported values are `mautic_worker` and `mautic_cron`. + - `MAUTIC_AUTO_INSTALL`: when `true`, the web container runs `mautic:install` automatically on first boot. + Defaults to `false`. + - `MAUTIC_SITE_URL`: site URL passed to the installer. + Defaults to `http://localhost`. + - `MAUTIC_ADMIN_FIRSTNAME`, `MAUTIC_ADMIN_LASTNAME`, `MAUTIC_ADMIN_USERNAME`, `MAUTIC_ADMIN_EMAIL`, `MAUTIC_ADMIN_PASSWORD`: admin account fields used by the automated install. + Defaults are `Admin`, `Mautic`, `admin`, `admin@example.com`, and `ChangeMe123!`. - `DOCKER_MAUTIC_LOAD_TEST_DATA`: should the test data be loaded on start or not. Defaults to `false`, other supported value is `true`. This variable is only usable when using the `web` role. @@ -141,6 +147,22 @@ Technically, every setting of Mautic you can set via the UI or via the `local.ph e.g. the `messenger_dsn_hit` can be set via the `MAUTIC_MESSENGER_DSN_HIT` environment variable. See the general Mautic documentation for more info. +#### Automated installation + +To install Mautic without using the browser installer, set `MAUTIC_AUTO_INSTALL=true` and provide the DB/admin variables through your environment or `.env` file. + +Example: + +```env +MAUTIC_AUTO_INSTALL=true +MAUTIC_SITE_URL=http://localhost +MAUTIC_ADMIN_FIRSTNAME=Admin +MAUTIC_ADMIN_LASTNAME=Mautic +MAUTIC_ADMIN_USERNAME=admin +MAUTIC_ADMIN_EMAIL=admin@example.com +MAUTIC_ADMIN_PASSWORD=ChangeMe123! +``` + ### Customization Currently this image has no easy way to extend Mautic (e.g. adding extra `composer` dependencies or installing extra plugins or themes). From b9e9de1d58b7ed21833ccce52792e703bc03cafd Mon Sep 17 00:00:00 2001 From: henmohr Date: Thu, 28 May 2026 15:04:05 -0300 Subject: [PATCH 06/10] fix mautic install bootstrap --- .docker/.mautic_env | 1 + .docker/scripts/entrypoint_mautic_web.sh | 49 ++++++++++++++++-------- README.md | 3 ++ docker-compose.yml | 12 ++++++ 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/.docker/.mautic_env b/.docker/.mautic_env index 336a8df4..c6a06a35 100644 --- a/.docker/.mautic_env +++ b/.docker/.mautic_env @@ -11,6 +11,7 @@ MAUTIC_MESSENGER_DSN_EMAIL="doctrine://default" MAUTIC_MESSENGER_DSN_HIT="doctrine://default" MAUTIC_AUTO_INSTALL="false" +MAUTIC_FORCE_INSTALL="false" MAUTIC_SITE_URL="http://localhost" MAUTIC_ADMIN_FIRSTNAME="Admin" MAUTIC_ADMIN_LASTNAME="Mautic" diff --git a/.docker/scripts/entrypoint_mautic_web.sh b/.docker/scripts/entrypoint_mautic_web.sh index 143bcaab..4ee53035 100644 --- a/.docker/scripts/entrypoint_mautic_web.sh +++ b/.docker/scripts/entrypoint_mautic_web.sh @@ -2,7 +2,12 @@ set -e -chown -R www-data:www-data /var/www/html/config /var/www/html/var/logs /var/www/html/docroot/media +prepare_install_dirs() { + mkdir -p /var/www/html/var/cache /var/www/html/var/logs + chown -R www-data:www-data /var/www/html/config /var/www/html/var /var/www/html/docroot/media +} + +prepare_install_dirs mautic_site_url="${MAUTIC_SITE_URL:-http://localhost}" mautic_admin_firstname="${MAUTIC_ADMIN_FIRSTNAME:-Admin}" @@ -13,23 +18,29 @@ mautic_admin_password="${MAUTIC_ADMIN_PASSWORD:-ChangeMe123!}" mautic_db_table_prefix="${MAUTIC_DB_TABLE_PREFIX:-}" mautic_db_backup_tables="${MAUTIC_DB_BACKUP_TABLES:-true}" mautic_db_backup_prefix="${MAUTIC_DB_BACKUP_PREFIX:-bak_}" +mautic_force_install="${MAUTIC_FORCE_INSTALL:-false}" install_mautic() { - su -s /bin/bash www-data -c 'php /var/www/html/bin/console mautic:install "$MAUTIC_SITE_URL" --force \ - --db_driver=pdo_mysql \ - --db_host="$MAUTIC_DB_HOST" \ - --db_port="$MAUTIC_DB_PORT" \ - --db_name="$MAUTIC_DB_DATABASE" \ - --db_user="$MAUTIC_DB_USER" \ - --db_password="$MAUTIC_DB_PASSWORD" \ - --db_table_prefix="$MAUTIC_DB_TABLE_PREFIX" \ - --db_backup_tables="$MAUTIC_DB_BACKUP_TABLES" \ - --db_backup_prefix="$MAUTIC_DB_BACKUP_PREFIX" \ - --admin_firstname="$MAUTIC_ADMIN_FIRSTNAME" \ - --admin_lastname="$MAUTIC_ADMIN_LASTNAME" \ - --admin_username="$MAUTIC_ADMIN_USERNAME" \ - --admin_email="$MAUTIC_ADMIN_EMAIL" \ - --admin_password="$MAUTIC_ADMIN_PASSWORD"' + local mautic_db_name="${MAUTIC_DB_DATABASE:-${MAUTIC_DB_NAME:-mautic}}" + local cmd + + printf -v cmd 'php /var/www/html/bin/console mautic:install %q --force --db_driver=pdo_mysql --db_host=%q --db_port=%q --db_name=%q --db_user=%q --db_password=%q --db_table_prefix=%q --db_backup_tables=%q --db_backup_prefix=%q --admin_firstname=%q --admin_lastname=%q --admin_username=%q --admin_email=%q --admin_password=%q' \ + "$mautic_site_url" \ + "$MAUTIC_DB_HOST" \ + "$MAUTIC_DB_PORT" \ + "$mautic_db_name" \ + "$MAUTIC_DB_USER" \ + "$MAUTIC_DB_PASSWORD" \ + "$mautic_db_table_prefix" \ + "$mautic_db_backup_tables" \ + "$mautic_db_backup_prefix" \ + "$mautic_admin_firstname" \ + "$mautic_admin_lastname" \ + "$mautic_admin_username" \ + "$mautic_admin_email" \ + "$mautic_admin_password" + + su -s /bin/bash www-data -c "$cmd" } mautic_is_installed() { @@ -62,6 +73,12 @@ $parameters = array( EOF fi +if [ "$mautic_force_install" = "true" ]; then + rm -f /var/www/html/config/local.php +fi + +prepare_install_dirs + if [ "$MAUTIC_AUTO_INSTALL" = "true" ] && [ -f /var/www/html/config/local.php ]; then if ! mautic_is_installed; then rm -f /var/www/html/config/local.php diff --git a/README.md b/README.md index adb05e66..11596628 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ You can get all available environments looking at a docker-compose.yml file that Defaults to `mautic_web`, other supported values are `mautic_worker` and `mautic_cron`. - `MAUTIC_AUTO_INSTALL`: when `true`, the web container runs `mautic:install` automatically on first boot. Defaults to `false`. + - `MAUTIC_FORCE_INSTALL`: when `true`, the web container clears any partial local install state and runs `mautic:install` again. + Defaults to `false`. - `MAUTIC_SITE_URL`: site URL passed to the installer. Defaults to `http://localhost`. - `MAUTIC_ADMIN_FIRSTNAME`, `MAUTIC_ADMIN_LASTNAME`, `MAUTIC_ADMIN_USERNAME`, `MAUTIC_ADMIN_EMAIL`, `MAUTIC_ADMIN_PASSWORD`: admin account fields used by the automated install. @@ -155,6 +157,7 @@ Example: ```env MAUTIC_AUTO_INSTALL=true +MAUTIC_FORCE_INSTALL=true MAUTIC_SITE_URL=http://localhost MAUTIC_ADMIN_FIRSTNAME=Admin MAUTIC_ADMIN_LASTNAME=Mautic diff --git a/docker-compose.yml b/docker-compose.yml index 7982276c..846052f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,18 @@ x-mautic-environments: &mautic-environments MAUTIC_DB_USER: ${MAUTIC_DB_USER:-mautic} MAUTIC_DB_PASSWORD: ${MAUTIC_DB_PASSWORD:-mautic} MAUTIC_DB_NAME: ${MAUTIC_DB_NAME:-mautic} + MAUTIC_DB_DATABASE: ${MAUTIC_DB_DATABASE:-mautic} + MAUTIC_DB_TABLE_PREFIX: ${MAUTIC_DB_TABLE_PREFIX:-} + MAUTIC_DB_BACKUP_TABLES: ${MAUTIC_DB_BACKUP_TABLES:-true} + MAUTIC_DB_BACKUP_PREFIX: ${MAUTIC_DB_BACKUP_PREFIX:-bak_} + MAUTIC_AUTO_INSTALL: ${MAUTIC_AUTO_INSTALL:-false} + MAUTIC_FORCE_INSTALL: ${MAUTIC_FORCE_INSTALL:-false} + MAUTIC_SITE_URL: ${MAUTIC_SITE_URL:-http://localhost} + MAUTIC_ADMIN_FIRSTNAME: ${MAUTIC_ADMIN_FIRSTNAME:-Admin} + MAUTIC_ADMIN_LASTNAME: ${MAUTIC_ADMIN_LASTNAME:-Mautic} + MAUTIC_ADMIN_USERNAME: ${MAUTIC_ADMIN_USERNAME:-admin} + MAUTIC_ADMIN_EMAIL: ${MAUTIC_ADMIN_EMAIL:-admin@example.com} + MAUTIC_ADMIN_PASSWORD: ${MAUTIC_ADMIN_PASSWORD:-ChangeMe123!} MAUTIC_RUN_CRON_JOBS: ${MAUTIC_RUN_CRON_JOBS:-true} XDEBUG_CONFIG: ${XDEBUG_CONFIG:-} MAUTIC_MESSENGER_DSN_EMAIL: ${MAUTIC_MESSENGER_DSN_EMAIL:-doctrine://default} From e88976923a271f6ba2ed182bd26e97961425832d Mon Sep 17 00:00:00 2001 From: henmohr Date: Thu, 28 May 2026 15:11:14 -0300 Subject: [PATCH 07/10] clarify auto install docs --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 11596628..9d5a95b6 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,8 @@ MAUTIC_ADMIN_EMAIL=admin@example.com MAUTIC_ADMIN_PASSWORD=ChangeMe123! ``` +Use `MAUTIC_FORCE_INSTALL=true` on the first boot when you want to skip the browser installer entirely, or when you are reusing a volume that already contains a partial install state. + ### Customization Currently this image has no easy way to extend Mautic (e.g. adding extra `composer` dependencies or installing extra plugins or themes). From 4d2a6c70a2c7dfc996d01e166856a8e2157ece59 Mon Sep 17 00:00:00 2001 From: henmohr Date: Thu, 28 May 2026 15:48:37 -0300 Subject: [PATCH 08/10] add crm bundle submodule --- .docker/scripts/entrypoint_mautic_web.sh | 7 +++++++ .gitmodules | 4 ++++ README.md | 6 ++++++ volumes/mautic/docroot/plugins/MauticCrmBundle | 1 + 4 files changed, 18 insertions(+) create mode 100644 .gitmodules create mode 160000 volumes/mautic/docroot/plugins/MauticCrmBundle diff --git a/.docker/scripts/entrypoint_mautic_web.sh b/.docker/scripts/entrypoint_mautic_web.sh index 4ee53035..08dce929 100644 --- a/.docker/scripts/entrypoint_mautic_web.sh +++ b/.docker/scripts/entrypoint_mautic_web.sh @@ -43,6 +43,10 @@ install_mautic() { su -s /bin/bash www-data -c "$cmd" } +install_mautic_plugins() { + su -s /bin/bash www-data -c 'php /var/www/html/bin/console mautic:plugins:install' +} + mautic_is_installed() { php -r 'if (!file_exists("/var/www/html/config/local.php")) { exit(1); } include "/var/www/html/config/local.php"; exit(isset($parameters["db_driver"], $parameters["site_url"]) ? 0 : 1);' } @@ -96,6 +100,8 @@ if [ "$MAUTIC_AUTO_INSTALL" = "true" ] && [ ! -f /var/www/html/config/local.php MAUTIC_DB_BACKUP_TABLES="$mautic_db_backup_tables" \ MAUTIC_DB_BACKUP_PREFIX="$mautic_db_backup_prefix" \ install_mautic + + install_mautic_plugins fi # prepare mautic with test data @@ -114,6 +120,7 @@ if [ "$DOCKER_MAUTIC_LOAD_TEST_DATA" = "true" ]; then MAUTIC_DB_BACKUP_PREFIX="$mautic_db_backup_prefix" \ install_mautic fi + install_mautic_plugins su -s /bin/bash www-data -c 'php /var/www/html/bin/console doctrine:fixtures:load -n' fi diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..d82349df --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "volumes/mautic/docroot/plugins/MauticCrmBundle"] + path = volumes/mautic/docroot/plugins/MauticCrmBundle + url = https://github.com/mautomic-com/mautic-crm-bundle.git + branch = main diff --git a/README.md b/README.md index 9d5a95b6..5c62c62d 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,12 @@ MAUTIC_ADMIN_PASSWORD=ChangeMe123! Use `MAUTIC_FORCE_INSTALL=true` on the first boot when you want to skip the browser installer entirely, or when you are reusing a volume that already contains a partial install state. +This repository also tracks the CRM bundle as a git submodule under `volumes/mautic/docroot/plugins/MauticCrmBundle`. If you clone the repository manually, initialize submodules before starting the stack: + +```bash +git submodule update --init --recursive +``` + ### Customization Currently this image has no easy way to extend Mautic (e.g. adding extra `composer` dependencies or installing extra plugins or themes). diff --git a/volumes/mautic/docroot/plugins/MauticCrmBundle b/volumes/mautic/docroot/plugins/MauticCrmBundle new file mode 160000 index 00000000..7d68d72e --- /dev/null +++ b/volumes/mautic/docroot/plugins/MauticCrmBundle @@ -0,0 +1 @@ +Subproject commit 7d68d72ecd099a88358851cf32107b9f8ccc672d From d5021e572624f756fbfdade53ab7400228bccb31 Mon Sep 17 00:00:00 2001 From: henmohr Date: Thu, 28 May 2026 15:58:19 -0300 Subject: [PATCH 09/10] document submodule clone --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 5c62c62d..d3a584a5 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ > [!NOTE] > This fork was made to make possible use xdebug +If you want the CRM plugin submodule checked out on clone, use: + +```bash +git clone --recurse-submodules https://github.com/LibreCodeCoop/mautic-docker.git +``` + ## Versions all Mautic 7 Docker images follow the following naming stategy. From 1705a0c2b4c7242cb0996b4196efdcf16f04fca1 Mon Sep 17 00:00:00 2001 From: henmohr Date: Wed, 12 Aug 2026 17:18:25 -0300 Subject: [PATCH 10/10] Fix ShellCheck warning in Mautic web entrypoint --- .docker/scripts/entrypoint_mautic_web.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.docker/scripts/entrypoint_mautic_web.sh b/.docker/scripts/entrypoint_mautic_web.sh index 08dce929..80a29760 100644 --- a/.docker/scripts/entrypoint_mautic_web.sh +++ b/.docker/scripts/entrypoint_mautic_web.sh @@ -48,6 +48,7 @@ install_mautic_plugins() { } mautic_is_installed() { + # shellcheck disable=SC2016 php -r 'if (!file_exists("/var/www/html/config/local.php")) { exit(1); } include "/var/www/html/config/local.php"; exit(isset($parameters["db_driver"], $parameters["site_url"]) ? 0 : 1);' }