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

Chadburn is not picking up any tasks #46

Closed dakky closed 2 years ago

dakky commented 2 years ago

Setup:

docker-compose chadburn:

version: "3"
services:
  chadburn:
    image: premoweb/chadburn:latest
    container_name: chadburn
    restart: always
    command: daemon
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

    networks:
      - traefik

networks:
  traefik:
    external:
      name: traefik-network

docker-compose influxdb

version: '3.7'

services:
  influxdb:
    image: arm64v8/influxdb:2.2
    container_name: influxdb
    restart: always
    labels:
      chadburn.enabled: true
      chadburn.job-exec.backup-influxdb.schedule: "38 8 * * *"
      chadburn.job-exec.backup-influxdb.command: "/backup/backup.sh"
[....]

docker inspect of the container

❯ docker inspect influxdb | jq ".[].Config.Labels"
{
  "chadburn.enabled": "True",
  "chadburn.job-exec.backup-influxdb.command": "/backup/backup.sh",
  "chadburn.job-exec.backup-influxdb.schedule": "38 8 * * *",
  "com.docker.compose.config-hash": "5e307b1e77c4fd6682759977b4a9472868ed6d75fd76d30a7492bc328eb5c14d",
  "com.docker.compose.container-number": "1",
  "com.docker.compose.oneoff": "False",
  "com.docker.compose.project": "influxdb2",
  "com.docker.compose.project.config_files": "docker-compose.yaml",
  "com.docker.compose.project.working_dir": "/opt/influxdb2",
  "com.docker.compose.service": "influxdb",
  "com.docker.compose.version": "1.29.2"
}

Logs of chadburn

Attaching to chadburn
chadburn    | daemon.go:47 ▶ DEBUG Config file: /etc/chadburn.conf not found
chadburn    | scheduler.go:101 ▶ DEBUG Starting scheduler
chadburn    | cron_utils.go:13 ▶ DEBUG start

Do I miss something?

maietta commented 2 years ago

The only thing I see interesting here is the label for chadburn.enabled being "True" and not "true". You may need to wrap your true label with quotes like "true". I'm not actually sure about this.

From the architecture referenced, I'm curious if you are running this on a Raspberry Pi 4?

Also, your schedule appears to me to be in a native CRON syntax. Chadburn uses a project under the hood that requires a slightly different format. Currently, it appears your tasks are set to be run every 38 seconds after the minute instead of at 38 minutes after the hour. Please see: https://pkg.go.dev/github.com/robfig/cron.

dakky commented 2 years ago

thats it. It has to be "true" as String and not Boolean.

I'll try the go version of cron definition.

and yes: i'm running on a raspberry pi 4 ;-)

maietta commented 2 years ago

Fingers crossed here that's the problem.

dakky commented 2 years ago

At least using "true" as String triggers Chadburn. but the task is not executed. And the behavior with the different cron syntaxes is ... unpredictable a least ;-)

Here my log, commented lines are my notes

### added job with 5 field syntax, log messages are fine, there are resgistration and deregistration entries
chadburn    | cron_utils.go:13 ▶ DEBUG added
chadburn    | scheduler.go:89 ▶ NOTICE New job registered "backup-influxdb" - "/backup/backup.sh" - "50 20 * * *" - ID: 4
### here the job should have been executed, no job execution happened
### now ich switched to 6 field syntax, there is NO registration entry and job does not get exectued
chadburn    | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "backup-influxdb" - "/backup/backup.sh" - "50 20 * * *" - ID: 4
chadburn    | cron_utils.go:13 ▶ DEBUG removed
### here I disabled chadburn via label on the influx container, a deregistration entry appears, no matching registration
chadburn    | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "backup-influxdb" - "/backup/backup.sh" - "0 58 20 * * *" - ID: 0
chadburn    | cron_utils.go:13 ▶ DEBUG removed
dakky commented 2 years ago

now its working finally. bugs: