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

[Feature Request] container startup and teardown job #68

Closed martindmtrv closed 8 months ago

martindmtrv commented 9 months ago

Since chadburn is able to dynamically pull the Docker configs perhaps there is a new use case where jobs can be ran a single time on startup / shutdown of containers

A simple use case could be a script that on startup sends a notification like "container x started" but we only want to run the script once, not on an interval

There may be a way to do this with Docker compose already (override command / entry point). This feature is different since I'm suggesting that this could be useful for other commands that we don't want to execute from within the container that we just started but on a different container or the host machine

Another reason this is useful is we could essentially define event driven actions (container start, stop, health status change?) directly in Docker compose files which would be pretty sweet for managing stacks in portainer

maietta commented 9 months ago

This is a very good feature request.

Docker Events emits start/stop notices for containers, so implementation seems like it might be pretty straightforward.

Assigning a label to designate that something should only run once, would be do-able, but Chadburn could update a label for a service to signal that it has in fact, been run.

Thanks for the suggestion.