dokkumautic

Dokku - persistent volumes?


I'm attempting to set up Mautic (https://github.com/mautic/docker-mautic) on Dokku. I have everything working well except for the mounted volume. Mautic stores config files in the volume, so every time the container restarts it needs to be reconfigured if the volume is not set up. The instructions on the above page are:

$ docker volume create mautic_data

$ docker run --name mautic -d \
    --restart=always \
    -e MAUTIC_DB_HOST=127.0.0.1 \
    -e MAUTIC_DB_USER=root \
    -e MAUTIC_DB_PASSWORD=mypassword \
    -e MAUTIC_DB_NAME=mautic \
    -e MAUTIC_RUN_CRON_JOBS=true \
    -e MAUTIC_TRUSTED_PROXIES=0.0.0.0/0 \
    -p 8080:80 \
    -v mautic_data:/var/www/html \
    mautic/mautic:latest

I have created a persistent volume in dokku with

dokku storage:mount mautic /var/lib/dokku/data/storage/mautic:/mautic_data

this is confirmed:

root@apps:/var/lib# dokku storage:report mautic
=====> mautic storage information
       Storage build mounts:                                   
       Storage deploy mounts:         -v /var/lib/dokku/data/storage/mautic:/mautic_data 
       Storage run mounts:            -v /var/lib/dokku/data/storage/mautic:/mautic_data 

However the config file is not saved. Can anyone point out where I am going wrong?


Solution

  • It looks like the directory that the config files are stored in is /var/www/html instead of /mautic_data. In the docker command referenced, mautic_data in -v mautic_data:/var/www/html is the name of the volume on the host created by docker volume create mautic_data, not the directory inside the container.

    Try using:

    dokku storage:mount mautic /var/lib/dokku/data/storage/mautic:/var/www/html
    

    This will bind /var/lib/dokku/data/storage/mautic in the host computer to /var/www/html inside the container.