polydigital / backdrop-civicrm-docker

0 stars 1 forks source link

set up cron jobs #14

Closed tabroughton closed 5 years ago

tabroughton commented 5 years ago

we would need a basic set of default cron jobs setting up in both civicrm and os see https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/

tabroughton commented 5 years ago

It is debatable whether the host or the container (or another container) is best to run cron tasks.

eg https://nickjanetakis.com/blog/docker-tip-40-running-cron-jobs-on-the-host-vs-in-a-container

tabroughton commented 5 years ago

Options: 1. Within the PHP container The php container running the crm can have cron added to it and a cront tab setting up

2. From the host The host machine can call a docker exec command with the respective crm job through the civicrm-api.

3. From another docker container If another container had cron installed and configured it could call the cron job via a url (note, it could also run docker exec if it had access to the docker socket but this has a greater attack vector for very little benefit).

Design Decision: Because we will want to install this with least friction on dev host machines and servers we and we want to continue with the aim of single purpose docker containers then we will go with option 3 for now.

tabroughton commented 5 years ago

A further option rather than to use cron is to use Jobber, this has a useful job definition and a few extra options to cron. Maybe worth looking at for production though it might be over engineered solution for what we need.

https://dshearer.github.io/jobber/doc/v1.4/ https://hub.docker.com/_/jobber

tabroughton commented 5 years ago

this depends on getting #28 closed first

tabroughton commented 5 years ago

We will run the cron in the foreground in the container and specify logs in the crontab https://stackoverflow.com/questions/37458287/how-to-run-a-cron-job-inside-a-docker-container/46220104#46220104

tabroughton commented 5 years ago

I'm going to update the install scripts for drush so that this is an optional parameter.

tabroughton commented 5 years ago

PR has been made to make site_key an optional parameter on install

https://github.com/civicrm/civicrm-backdrop/pull/97