autorestic icon indicating copy to clipboard operation
autorestic copied to clipboard

Support Cron in docker image

Open FarisZR opened this issue 2 years ago • 12 comments

This PR adds the ability to use cron inside the docker image. Autorestic Cronjob would run every minute, checking for any backups due in $CRON_CONFIG_DIR

Cron is only enabled if $CRON_CONFIG_DIR is set.

It wouldn't affect existing users, since they would override the CMD option with their custom Command.

FarisZR avatar Mar 19 '22 00:03 FarisZR

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/cupcakearmy/autorestic/HKgT4UL7kgf1VupvUPoJUNjseB5L
✅ Preview: https://autorestic-git-fork-fariszr-master-cupcakearmy.vercel.app

vercel[bot] avatar Mar 19 '22 00:03 vercel[bot]

@cupcakearmy Anything stopping this from being merged ?

FarisZR avatar Mar 22 '22 14:03 FarisZR

Hey there, not really and thanks for the contribution!! I need to test a few things but I'm having exams rn so don't have much time to test it. Can it wait until start of April?

cupcakearmy avatar Mar 22 '22 14:03 cupcakearmy

Sure!, no problem. I would use my fork until this is merged.

FarisZR avatar Mar 22 '22 14:03 FarisZR

Any updates? i got another PR pending on this to add the ability to manage docker containers from inside the container too, By adding the docker && docker compose if enabled.

FarisZR avatar Apr 12 '22 20:04 FarisZR

Hey, i'm finally coming around to getting autorestic up to date again :) Will look at it tomorrow :)

cupcakearmy avatar Apr 12 '22 20:04 cupcakearmy

There is something missing in the .dockerignore file. Otherwise it won't build.

!/*.sh

Need to go out now, will check rest later :)

cupcakearmy avatar Apr 13 '22 15:04 cupcakearmy

Fixed

FarisZR avatar Apr 23 '22 04:04 FarisZR

What's up with this pull request, it seems everything is working is there a specific reason it still isn't merged? @cupcakearmy

tom2199 avatar Jan 03 '23 00:01 tom2199

I think having an image with cron built in will be useful to many. I do want to bring up that orchestration tools such as Kubernetes and Nomad have native ways for running reoccurring tasks, CronJob objects and the periodic job spec block, respectively. In these cases I think it would be nice to still provide an image that doesn't run cron. What do you think about updating this PR to build images both with and without cron?

drewgingerich avatar Mar 23 '23 22:03 drewgingerich

I don't think building 2 images would be the optimal way. Implementing Cron and introducing a variable like ENABLE_CRON with default set to false would be sufficient and satisfy all requirements for any container orchestration platform.

The image now is practically unusable (except when using additional containers that execute it as a one-shot job) on Docker Swarm. Users who need Cron (where you can't use local Cron to launch it) are now basically stuck on Resticker, myself included.

mihakrumpestar avatar May 19 '23 14:05 mihakrumpestar

@mihakrumpestar I use PremoWeb/chadburn to schedule ephemeral docker containers like autorestic.

mpfl avatar Dec 22 '23 21:12 mpfl