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

Mautic seems to reinstall intself after taking pod down

Open aleskinen opened this issue 2 years ago • 8 comments

I have tried both with whole html as persistent, and suggested config/logs/media. If I only use recommended folders, mautic seems to redirect forever. I I'll use whole html as persistent, it will reinstall itself after every deployment. I am using apache version. If I take tar of html and restore it after deployment works, but still gets reinstalled. How to stop mautic from reinstalling itself after deployment? I am using current apache version 5 from docker hub.

aleskinen avatar Mar 27 '24 11:03 aleskinen

I can confirm 100% you are correct and i'm using Podman. I fought this for literally 20 hours. What happened was this:

———

WHAT WAS HAPPENING

Everything went well on initial podman-compose up -d command but here is the flow of what I did and where I finally got stumped:

podman stop webserver <- simply stopped container localhost:8890 <-test connection - dead as expected (webserver is down) podman-compose up -d <- was expecting this to create a problem like before, but it didnt... localhost:8890 <-test connection - worked as expected podman stop mysql <-simply stopped the database container localhost:8890 <- test connection, dead as expected (db down) podman-compose up-d <- was expecting fail, but again it worked, no data lost localhost:8890 <-test connection - worked as expected podman-compose down <- tears down BOTH containers to the ground podman-compose up -d <- Build both containers back up (they are both in same podman-compose.yaml file) - starts up BOTH containers localhost:8890 <- Test connection. Back to the initial installer / db connection page. After running through install page and connecting to database again with same credentials, no data is found, all data is lost.

When I ran podman volume ls I would have the two named volumes and 3 random hash-like volumes which were not able to keep any of the configs, logs, etc, effectively killing the persistence of the container.

SOLUTION

final solution was from a wonderful community member in the podman community matrix group who gave me this to add to my compose.yml file:

mautic:
  volumes:
    - mautic_config:/var/www/html/config
    - mautic_logs:/var/www/html/var/logs
    - mautic_media:/var/www/html/docroot/media
volumes:
  mautic_config:
  mautic_logs:
  mautic_media:

By adding these three extra volumes which mautic requires, everything now works as expected.

I can now do both podman-compose up -d and podman-compose down and everything goes up and down again with persistence.

wayneoutthere avatar Oct 28 '24 23:10 wayneoutthere

Hey there! I'm helping the new maintainers of this repository. It was neglected for some time but that changes now! Could you please re-test if you are still getting this issue so we could focus our limited time on the issues that are still relevant? If there will be no response we'll close this issue in 1 week. It can always be re-opened later on.

IonutOjicaDE avatar Apr 15 '25 16:04 IonutOjicaDE

Hello, we'll have a look on it after dealing with some priorities!

cibero42 avatar Apr 17 '25 14:04 cibero42

Hello @aleskinen, could you please provide use your docker-compose.yml?

cibero42 avatar Apr 23 '25 18:04 cibero42

@cibero42 Same problem here. Some people who don't use the docker version seem to add $_SERVER['HTTPS'] = 'on'; to their index.php. I also found https://github.com/mautic/docker-mautic/issues/181#issuecomment-739061852 , saying that it's a caching problem? I tried changing 'site_url' => 'https://mautic.example.com' to 'site_url' => 'http://mautic.example.com' in config/local.php, which kind of worked. No 301 redirect loop anymore, BUT when I changed it back to https.://mautic.example.com I got the 301-loop again. Using the basic docker-compose.yml from https://github.com/mautic/docker-mautic/tree/mautic5/examples/basic I have my mautic container behind a nginx reverse proxy using Nginx Proxy Manager.

nepomuc avatar May 01 '25 14:05 nepomuc

Hello @nepomuc ,

That's related to a security feature from Mautic.

Inside "Miscellaneous Settings", on the webinterface, search for the option "Trusted Proxies". Put your proxy IP / Docker subdomain there to correctly address this issue.

cibero42 avatar May 20 '25 13:05 cibero42

I had a similar issue. Every time I docker compose down and up, Mautic restarts installation. The database has all the data, but local.php file is empty and Mautic thinks it is reinstall. My work around was to bind mount local.php based on the values I have after an installation. After that restarting the container did not restart installation. Here is my docker-compose.yml:

services: mautic: image: mautic/mautic:5-apache restart: always ports: - "8888:80" environment: - VIRTUAL_HOST=xxxxx.xxx.com - LETSENCRYPT_HOST=xxxxx.xxx.com - [email protected] - MAUTIC_DB_HOST=mauticdb - MAUTIC_DB_USER=mautic_user - MAUTIC_DB_PASSWORD=mautic_secure_password - MAUTIC_DB_NAME=mautic_db depends_on: - mauticdb volumes: - mautic_data:/var/www/html - /home/xxxx/mautic/config/local.php:/var/www/html/config/local.php networks: - shared_network

mauticdb: image: mysql:8.0 restart: always environment: - MYSQL_ROOT_PASSWORD=mautic_root_password - MYSQL_DATABASE=mautic_db - MYSQL_USER=mautic_user - MYSQL_PASSWORD=mautic_secure_password volumes: - mautic_db_data:/var/lib/mysql networks: - shared_network

volumes: mautic_data: mautic_db_data:

networks: shared_network: external: true

rafaii avatar May 24 '25 05:05 rafaii

Hello @rafaii,

It looks like you're not using the proper docker compose for v5.

Could you please adapt your compose to one of the examples from here and tell us if that solved your issue?

Thanks!

cibero42 avatar Jun 06 '25 18:06 cibero42