wodby / drupal-php

PHP docker container image for Drupal
https://wodby.com/stacks/drupal
MIT License
60 stars 80 forks source link

Crontabs not working as expected #80

Open michael-niemand opened 3 years ago

michael-niemand commented 3 years ago

using wodby/drupal-php:7.3-dev-4.15.9

I'm having a hard time understanding how the crontabs are supposed to work.

in the docker-entrypoint.sh there is the following snippet:

# @deprecated will be removed in favor of bind mounts (config maps).
init_crond() {
    if [[ -n "${CRONTAB}" ]]; then
        _gotpl "crontab.tmpl" "/etc/crontabs/www-data"
    fi
}

Ok, using env var CRONTAB is deprecated, so lets use a crontab file mounted at /etc/crontabs/www-data instead ... but then there is this snipped in the /usr/local/bin/init_container script, which is called as sudo from the entrypoint script:

if [[ -f /etc/crontabs/www-data && -z "${CRONTAB}" ]]; then
    chown root:www-data /etc/crontabs/www-data
    chmod 660 /etc/crontabs/www-data
fi

this fails of course, when the crontab is mounted as a configmap like I did:

chown: /etc/crontabs/www-data: Read-only file system

In the official documentation I only found small snippets that don't really explain how to actually get a working crontab into the container. Please advise, anything helps. Thank you!