Increasingly, cron is used to run useful tools for myself. You can use cron, but I want to check or stop JOB on the WEB. Since it runs on its own server, I want to run it on Docker. I don't do clusters or multi-configuration.
It seems to be an easy and reliable Cron job
Install Since there is an official image, it can be started with a Docker command. About options Forward web port as is with 8080 Mount the dkron.data volume because I want to keep the job information out Set the mounted volume to the dkron boot option (--data-dir) Bootstrap-expect is 1 because it is not in a cluster configuration If you do not give a node name, it will be a random name docker rm dkron → docker run If you try, the previous information can not be inherited well, so give it appropriately (node-name)
docker run --name dkron -p 8080:8080 -d -v dkron.data:/dkron.data dkron/dkron agent --server --bootstrap-expect=1 --data-dir=/dkron.data --node-name=node1
Transition to the dashboard from the following URL and register the JOB. Note that the old dkron was confused because/dashboard seemed to be the path.
http://localhost:8080/ui
Of course, you can register JOB even if you poke API from HTTP
curl localhost:8080/v1/jobs -XPOST -d '{
"name": "job1",
"schedule": "@every 10s",
"timezone": "Europe/Berlin",
"owner": "Platform Team",
"owner_email": "[email protected]",
"disabled": false,
"tags": {
"server": "true:1"
},
"metadata": {
"user": "12345"
},
"concurrency": "allow",
"executor": "shell",
"executor_config": {
"command": "date"
}
}'
Check from the following URL. It seems that job1 registered with the API earlier is running every 10 seconds.
http://localhost:8080/ui/#/jobs/job1/show/executions