Ofelia is a modern and low footprint job scheduler for docker environments, built on Go. Ofelia aims to be a replacement for the old fashioned cron.
It has been a long time since cron
was released, actually more than 28 years. The world has changed a lot and especially since the Docker
revolution. Vixie's cron works great but it's not extensible and it's hard to debug when something goes wrong.
Many solutions are available: ready to go containerized crons
, wrappers for your commands, etc. but in the end simple tasks become complex.
The main feature of Ofelia is the ability to execute commands directly on Docker containers. Using Docker's API Ofelia emulates the behavior of exec
, be in able to run a command inside of a running container. Also you can run the command in a new container destroying it at the end of the execution.
It uses a INI-style config file and the scheduling format is exactly the same from the original cron
, you can configure three different kind of jobs:
job-exec
: this job is executed inside of a running container.job-run
: runs a command inside of a new container, using a specific image.job-local
: runs the command inside of the host running ofelia.
[job-exec "job-executed-on-running-container"]
schedule = @hourly
container = my-container
command = touch /tmp/example
[job-run "job-executed-on-new-container"]
schedule = @hourly
image = ubuntu:latest
command = touch /tmp/example
[job-local "job-executed-on-current-host"]
schedule = @hourly
command = touch /tmp/example
The easiest way to deploy ofelia is using Docker.
docker run -it -v /my/ofelia.conf:/etc/ofelia.conf mcuadros/ofelia:latest
Don't forget to place your ofelia.conf
at your host machine.
If don't want to run ofelia using our Docker image you can download a binary from releases page.
Why the project is named Ofelia? Ofelia is the name of the office assistant from the Spanish comic Mortadelo y Filemón