- Notifications
You must be signed in to change notification settings - Fork5
Simple and lightweight service which can execute services from the same file based on cron expression.
License
reddec/compose-scheduler
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Simple and lightweight service which can executedocker compose run ...
services from the same file based on cronexpression.
Features:
- Zero-configuration by-default
- Designed for docker compose (auto-detect, respects namespace)
- HTTP notifications with retries
Inspired byofelia.
services:web:image:"nginx"labels: -"net.reddec.scheduler.cron=@daily" -"net.reddec.scheduler.exec=nginx -s reload"date:image:busyboxrestart:"no"labels: -"net.reddec.scheduler.cron=* * * * *"scheduler:image:ghcr.io/reddec/compose-scheduler:1.0.0restart:unless-stoppedvolumes: -/var/run/docker.sock:/var/run/docker.sock:ro
Supports two modes:
- plain
docker compose run
- exec command inside service (extra label
net.reddec.scheduler.exec
)
Application Options: --project= Docker compose project, will be automatically detected if not set [$PROJECT]HTTP notification: --notify.url= URL to invoke [$NOTIFY_URL] --notify.retries= Number of additional retries (default: 5) [$NOTIFY_RETRIES] --notify.interval= Interval between attempts (default: 12s) [$NOTIFY_INTERVAL] --notify.method= HTTP method (default: POST) [$NOTIFY_METHOD] --notify.timeout= Request timeout (default: 30s) [$NOTIFY_TIMEOUT] --notify.authorization= Authorization header value [$NOTIFY_AUTHORIZATION]Help Options: -h, --help Show this help message
Scheduler will send notifications after each job ifNOTIFY_URL
env variable or--notify.url
flag set. Eachnotification is a simple HTTP request.HTTP method, attempts number, and interval between attempts can be configured.Authorization viaAuthorization
header also supported.
Scheduler will stop retries if at least one of the following criteria met:
- reached maximum number of attempts
- server returned any
2xx
code (ex:200
,201
, ...)
Outgoing custom headers:
Content-Type: application/json
User-Agent: scheduler/<version>
, where<version>
is build versionAuthorization: <value>
(if set)
Payload:
{"project":"compose-project","service":"web","container":"deadbeaf1234","schedule":"@daily","started":"2023-01-20T11:10:39.44006+08:00","finished":"2023-01-20T11:10:39.751879+08:00","failed":true,"error":"exit code 1"}
field
error
exists only iffailed == true
About
Simple and lightweight service which can execute services from the same file based on cron expression.