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

Mautic_cron can't access database due to no env variables in cron jobs

Open adamchemiawppl opened this issue 1 year ago • 7 comments

Hi,

When running cron jobs, env vars are not available to cron job script. This is caused by the fact, that /tmp/cron.env does not include ENV vars available to mautic_web or mautic_worker.

Because of that mautic_worker has no access to e.g. DB username or DB password, if they are set via ENV vars - therefore cron commands fail.

The solution to that is adding those vars to tmp/cron.env inside entrypoint_mautic_cron.sh.

"Quick fix" for me is custom dockerfile with additional step: RUN sed -i '/declare -p | grep '\''PHP_INI_VALUE_'\'' > \/tmp\/cron.env/a env | grep MAUTIC | awk '\''{print "declare -x " $0}'\'' >> /tmp/cron.env' /entrypoint_mautic_cron.sh

adamchemiawppl avatar Jun 01 '24 12:06 adamchemiawppl

Related #251

O-Mutt avatar Jul 19 '24 11:07 O-Mutt

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

Hey @O-Mutt ,

Could you please validate this issue? Thanks!

cibero42 avatar May 05 '25 07:05 cibero42