Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

netresearch/docker-mautic

 
 

Repository files navigation

Netresearch Mautic Container Image

Mautic logo

netresearch/docker-mautic provides a basic environment for Mautic to run correctly.

Quick start

Clone this git repo and run docker compose up, wait for it to initialize completely, and visit https://localhost or https://host-ip.

Contents

This main container image is a multipurpose image for running the httpd or RTE for Mautic.

The container image will be used to start the Mautic application itself as a container and the httpd as a separate container.

For this to work, you need to provide CMD and ENTRYPOINT when starting the containers.

See docker-compose.yml for details.

Components

  • Application
    • Mautic
  • RTE
    • PHP 7.4, 8.0, (ToDo 8.1)
  • httpd
    • nginx mainline
  • Scheduler
    • ofelia
  • Database Management System
    • MariaDB 10
  • ToDo: WAF
    • nginx + mod_security
  • ToDo: buildbox
    • composer, git, ...
  • Caching
    • Redis
  • Queueing
    • beanstalkd
  • ToDo: Logging - everything to stdout
    • Logging in Mautic is special - maybe needs some PR
  • ToDo: run rector (on themes on upgrade)

Pulling netresearch/docker-mautic

If you want to pull the latest stable v4 image from netresearch/docker-mautic:

docker pull ghcr.io/netresearch/mautic:4

This container image is built with latest released Mautic 4 version.

Older Mautic Versions

There are also previous minor versions available, f.e.:

  • ghcr.io/netresearch/mautic:4.0
    • ghcr.io/netresearch/mautic:4.0.0
  • ghcr.io/netresearch/mautic:4.1
    • ghcr.io/netresearch/mautic:4.1.2
  • ghcr.io/netresearch/mautic:4.2
    • ghcr.io/netresearch/mautic:4.2.5

These container images are built for every Mautic 4 release.

Specific RTE

Every Mautic release has a preferred RTE, but there are also images available for every supported RTE:

  • ghcr.io/netresearch/mautic:4-php7.4
  • ghcr.io/netresearch/mautic:4.0.1-php8.1
  • ghcr.io/netresearch/mautic:4.1-php8.0

Development Builds

ToDo: There also builds from development branches of Mautic available:

  • ghcr.io/netresearch/mautic:4.0-dev
  • ghcr.io/netresearch/mautic:4.1-dev
  • ghcr.io/netresearch/mautic:4.2-dev

Runtime Configuration

You can pass any Mautic configuration option as environment variable. You just need to uppercase the configuration settings name and prefix it with 'MAUTIC_'.

Database Option Examples

  • MAUTIC_DB_HOST=dbms Database host name
  • MAUTIC_DB_USER=mautic Database user name
  • MAUTIC_DB_PASSWORD=mautic Database user password
  • MAUTIC_DB_NAME=mautic Database name
  • MAUTIC_DB_TABLE_PREFIX= Add prefix do Mautic tables. Very useful when migrate existing databases from another server to docker.

Trusted Proxy Example

  • MAUTIC_TRUSTED_PROXIES= If Mautic is behind a reverse proxy you can set a list of comma-separated CIDR network addresses, it sets those addresses as trusted proxies. You can use ["0.0.0.0/0"] or See documentation

Cron

Cron jobs are executed by ofelia service: https://github.com/mcuadros/ofelia

See docker-compose.yml service 'mautic' labels to configure cron jobs.

PHP

ToDo: Mount a custom.ini into container:/etc/php/custom.ini

Persistence

Mautic has no separation of user content and delivered/vanilla source code. The whole application folder (/var/www/html) is placed in a volume.

Upgrade / Update

You need ot differentiate here between upgrade of the environment and upgrade of Mautic

Upgrade / Update Mautic

Replacing your container image with a newer one does not automatically update or upgrade your Mautic instance. You need to do it manually.

To update or upgrade to a newer version of Mautic, you have to use the CLI updater:

https://docs.mautic.org/en/setup/how-to-update-mautic/updating-at-command-line

f.e.:

docker compose exec mautic
/var/www/html # php bin/console mautic:update:find
/var/www/html # php bin/console mautic:update:apply
/var/www/html # php bin/console mautic:update:apply --finish

Upgrade / Update Runtime Environment

To update the Runtime Environment, f.e. to latest PHP 7.4.x version, you just need to re-pull the container image you are currently using, they will be rebuild periodically to include latest version of all built-in components, including PHP:

docker compose pull

The above command will pull all container images in docker-compose.yml.

docker compose up -d

The above command will restart containers from new images.

To upgrade your environment, you need to switch your container image to a newer version, f.e. replace mautic:4 or mautic:4-php7 with mautic:4-php8

Add SSL to your Mautic

Built in nginx

To enable SSL support in bundled nginx service, you need to mount your certificates into the nginx service container and include /etc/nginx/conf.d/https.conf in /etc/nginx/nginx.conf

SSL Proxy/LB

If you run a proxy or LB with SSL termination, you need to configure Mautic accordingly:

Set Site Address of Mautic General Settings tab to HTTPS

Add your SSL proxy/LB IP address as trusted proxy: see Proxies

Developer notes

Requirements

Configuration

User Feedback

Issues

If you have any problems with or questions about this image, please contact us through a GitHub issue.

You can also reach the Mautic community through its online forums or the Mautic Slack channel.

Contributing

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.

Building

This is a multi-stage Dockerfile, therefore you require buildkit or buildx enabled to be able to build your own container image.

See workflows/docker-publish.yml for examples on how to build your own image.

Mautic Versioning

The Dockerfile has two ARG where you can specify the version to be built into container image:

  • MAUTIC_VERSION
  • MAUTIC_SHA1

You can update the default values for this to the latest version by running update_mautic_version.sh in folder ./mautic

Or you can override this during build with --build-arg to build Mautic 3.0.2 or 3.1.2

PHP Version

The Dockerfile has an ARG PHP_VERSION, which defaults to "8.0".

  • PHP_VERSION

You can override this during build with --build-arg PHP_VERSION=7.4

See docker-compose.dev.yml for examples.

References

ToDo

Put only user content data on volume: