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] Add replacers/variables to ease configuration #66

Closed ThaDaVos closed 8 months ago

ThaDaVos commented 11 months ago

I am currently setting up a job-local to hourly restart a container (it's needed) - but to do that, I defined the labels on the container but I also had to fully type out the full container name in the command because as far as I know, there's no support for replacers/variables which are resolved to the targeted container - so, maybe this can be included? Or maybe a new job type for the usecase of interacting with a containers state, maybe like job-docker?

maietta commented 11 months ago

That's a good feature request.

This will get added to version 2.x in the works. I have been quite busy and being that this is an unpaid project, it's not of real high priority.

I don't have an exact timeline, but I think I should be able to get back to work on it within a couple weeks.

ThaDaVos commented 11 months ago

Am I right that job-local can't be set using labels on the target container?

ThaDaVos commented 11 months ago

I just checked, apparently job-local isn't supported through labels - but how does one even restart a docker container if there's not even docker inside the Chadburn container?

ThaDaVos commented 11 months ago

~Done it through CURL:~ ~curl --silent --unix-socket /var/run/docker.sock -X POST http://v1.43/containers/{CONTAINER_NAME_OR_ID}/restart~

Tried curl... not available...

maietta commented 11 months ago

I just checked, apparently job-local isn't supported through labels - but how does one even restart a docker container if there's not even docker inside the Chadburn container?

The current version of Chadburn, like Ofelia, the project this one was forked from, uses a 3rd party library to talk to Docker over an API. The next big version when I can get to it, will remove this 3rd party library and talk directly to the Docker API.

There is no docker socket inside the local container.

ThaDaVos commented 11 months ago

Actually there is a docker.socket as you have to mount it for label support - so I hoped there was curl too as you can send commands to docker through curl - for now using a job-run with docker image to call docker commands