I have a dockerized application currently running on CentOS/ CoreOS, lifetime cycle of all containers is maintained by systemd. I would like to try RancherOS. My idea is to get rid of systemd and just use docker-compose to setup and start the application.
The only issue I have is that the application has also few scheduled tasks (some containers run every 5 minutes, others run once a day). In the original solution, systemd timers are used to schedule these tasks. I wanted to ask if the RancherOS has any built-in scheduler like crontab which could be use for this. If not, what would be a best practice to achieve this?
I have decided that all scheduled jobs will run inside a single docker application container. All jobs will be dispatched by a lightweight cron system running in foreground. Stdout and stderr of running commans is redirected to the command’s stdout/ stderr, so the job output is not lost.
For that purpose I developed this simple cron implementation in Go:
It takes YAML file which describes jobs to be scheduled.
Please note that this program is my first in Go after few hours of reading tutorials, so it is probably no production ready. Feel free to fork.