PremoWeb / chadburn

Chadburn is a scheduler alternative to cron, built on Go and designed for Docker environments.
MIT License
36 stars 4 forks source link

docker-compose example with job-run and labels #70

Closed s-celles closed 8 months ago

s-celles commented 8 months ago

Hello,

I'm trying to run a job periodically using job-run (and not job-exec)

I did a separate docker-compose.yml file like so

version: "3"
services:
  alpine:
    image: alpine
    labels:
      chadburn.enabled: "true"
      chadburn.job-run.datecron.schedule: "@every 5s"
      chadburn.job-run.datecron.command: "uname -a"

but I'm getting nothing in chadburn logs

I changed it to

version: "3"
services:
  alpine:
    image: alpine
    command: uname -a
    labels:
      chadburn.enabled: "true"
      chadburn.job-run.datecron.schedule: "@every 5s"

when I'm doing

docker compose up -d 

I see in alpine-alpine-1 ... Linux... but this command in not run again every 5 seconds.

Can you help me?

I could send a PR to improve doc if you think that it could help your users

Kind regards

maietta commented 8 months ago

The job type you specified in your labels are to run the job inside the existing containers.

However, by moving the command up to the command declarative for docker compose, rather than the label, the reason it appears to work is because it's now being invoked automatically at each run of the container.

I imagine this scenario is fine, but I do agree it should be clarified in the readme.

After I take care of somethings today, perhaps I can get an official docs website launched later today.