docker-mautic icon indicating copy to clipboard operation
docker-mautic copied to clipboard

Mautic need to become stateless in the Docker image

Open EnziinSystem opened this issue 3 years ago • 5 comments

Important:

After running Mautic in docker I noticed a problem with state data retention. The current scenario is that on boot entry point checks the /var /www/html directory and will copy the source code from /usr/src/mautic if this directory is empty.

# docker-entrypoint.sh
if ! [ -e index.php -a -e app/AppKernel.php ]; then
        echo >&2 "Mautic not found in $(pwd) - copying now..."

        if [ "$(ls -A)" ]; then
                echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!"
                ( set -x; ls -A; sleep 10 )
        fi

        tar cf - --one-file-system -C /usr/src/mautic . | tar xf -

        echo >&2 "Complete! Mautic has been successfully copied to $(pwd)"
fi

Next will be the new installation and setting up of admin accounts, database information ... To save the installed information we need to mount the /var/www/html directory with the directory on the server.

So we cannot run multiple Mautic instances in a container-orchestration.

This is an old mindset and doesn't fit the trend of dockerize and run in modern container-orchestration like Kubernetes.

I suggest passing the installed information into the database so that when a new container starts up it runs with the existing database instead of going through the new installation.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

EnziinSystem avatar Dec 26 '20 07:12 EnziinSystem

I think this is caused by https://github.com/mautic/docker-mautic/issues/90 (and there's quite a bit of discussion about this on that issue)

mausch avatar Feb 16 '21 11:02 mausch

I am going to work on this. I just does not know Mautic, could you please help me what to not forget about?

Everything else could be empheral - could be deleted any time and is compatible with horizontal scaling (each container will have own empheral storage).

Is it all what I have to care about?

iBobik avatar May 14 '21 15:05 iBobik

About database schema upgrades, I can not find info how it works in Mautic. Is there some script to run on each container start?

iBobik avatar May 14 '21 15:05 iBobik

I am also going to use Mautic v4 only.

iBobik avatar May 14 '21 15:05 iBobik

About database schema upgrades, I can not find info how it works in Mautic. Is there some script to run on each container start?

You could use an custom shell script which would run the necessary Symfony commands to apply database update after a container reboot.

wucherpfennig avatar May 25 '21 20:05 wucherpfennig