Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adamchemiawppl opened this issue Jun 1, 2024 · 1 comment

Comments

@adamchemiawppl
Copy link

adamchemiawppl commented Jun 1, 2024

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

@O-Mutt
Copy link

O-Mutt commented Jul 19, 2024

Related #251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants