Unofficial Mautic docker image for cloud infrastructure deployments.
The official docker image is not suited for running in cluster environments. This project aims to improve that by focusing on a strict 'composer only' setup with a few config modifications and a customizable startup routine.
- dedicated docker user (no root execution)
- fixuid for development context (mounted source)
- dedicated directories for config and cache data (outside of document root)
- cloud ready startup routine with composer install and database migrations
- Move config and cache data away from the document root.
- Automatically run composer install on each startup (optional)
- Automatically run Mautic migrations on each startup (optional)
- Setup cron jobs (optional)
You may add custom startup scripts via volume mounts or project-specific images to configure Mautic accordingly to your needs. The scripts are executed in alphabetical order. We recommend to add a number to the file name. For instance: 100_hello-world.sh
.
#!/bin/sh
echo "hello world"
exit 0
The image does not contain a composer.json or composer.lock file. It is recommended to use this image as a base image for "custom project" or "fixed version" images.
Mount a composer.json configuration and start the container:
docker run -it -p 8001:80 -v "$(pwd)"/composer.json:/data/composer.json mautic-composer
If you would like to use the image to improve Mautic itself, or if you are working on a customer project, you just have to mount the document root folder and the config folder for persistence:
version: '3.7'
services:
mautic:
image: garagist/mautic:composer-8.0
environment:
- MAUTIC_CONTEXT=Development
- MAUTIC_DOMAIN=mautic.your.domain
- MAUTIC_DB_HOST=db
- MAUTIC_DB_USER=db-user
- MAUTIC_DB_PASSWORD=db-password
- MAUTIC_DB_NAME=db-name
volumes:
- ./:/data
- .mautic/config:/mautic/config
Set the MAUTIC_CONTEXT to production and you are ready to go
version: '3.7'
services:
mautic:
image: garagist/mautic:composer-8.0
environment:
- MAUTIC_CONTEXT=Production
- MAUTIC_DOMAIN=mautic.your.domain
- MAUTIC_SSL_ENABLED=True
- MAUTIC_TLS_EMAIL=your@your.domain
- MAUTIC_DB_HOST=db
- MAUTIC_DB_USER=db-user
- MAUTIC_DB_PASSWORD=db-password
- MAUTIC_DB_NAME=db-name
volumes:
- .mautic/config:/mautic/config
-
MAUTIC_CONTEXT=Development # Development or Production
-
MAUTIC_CRON_RUN_JOBS=True # Whether to run cron jobs or not
-
MAUTIC_RUN_COMPOSER_INSTALL=true # Whether to run composer install or not
-
MAUTIC_RUN_MIGRATION=True # Whether to run database migrations or not
-
MAUTIC_DOMAIN=foo.com bar.com # Domains to be used for the vhost (string list)
-
MAUTIC_SSL_ENABLED=False # Whether to enable SSL or not
-
MAUTIC_TLS_EMAIL=none # Email address for Let's Encrypt
-
MAUTIC_DB_HOST=db # Database host
-
MAUTIC_DB_USER=db-user # Database user
-
MAUTIC_DB_PASSWORD=db-password # Database password
-
MAUTIC_DB_NAME=db-name #
-
PHP_TIMEZONE=UTC
-
PHP_MEMORY_LIMIT=512M
-
PHP_UPLOAD_MAX_FILESIZE=256M
-
PHP_UPLOAD_MAX_FILESIZE=256M
-
PHP_ALLOW_URL_INCLUDE=1
-
PHP_MAX_EXECUTION_TIME=240
-
PHP_MAX_INPUT_VARS=1500
Update your composer configuration accordingly, check your custom plugins for compatibility and restart the container. Just make sure MAUTIC_RUN_MIGRATION
is enabled.
https://packagist.org/packages/mautic/recommended-project
- Test oAuth support
This image is heavily inspired by the awesome work of ttree/flowapp. Thx for sharing :-)