-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using a dedicated cron package #268
Comments
That |
This https://github.com/dubiousjim/dcron seems to exist and is closer to what's needed. It can be added using |
Also https://github.com/aptible/supercronic, but this seems way to heavy. |
FWIW these are all packages in the apk index containing the string |
What about adding an additional command like |
I'm not entirely sure how this would work when people use
I couldn't find anything in the docs: do you know if this supports |
Run the
Dug a little in the source code. They use robfig/cron for parsing which indeed supports this (docs). |
Trouble is each conf file will have it's own
Sounds like an option then. I'd still like to have a look if we can get a dedicated cron into the image as this would be the easiest and would keep surface area around here smaller. I wonder if it's possible to compile "Vixie" cron in Alpine and use it. Then again, there's probably a reason it does not exist on the apk index.
Do you already have something in mind that could be done that's not possible with cron? |
Why wouldn't it be easy? Right now,
I understand, a simple drop-in replacement for the cron daemon would be the most efficient route.
Nothing specific, just thought about #93 and the general idea of being able to add additional rules if they can't be done with plain cron syntax. |
#270 would probably be another good argument for a non-cron/roll your own scheduling solution |
The above mentioned robfig/cron package seems to be a good fit for this task. From what I've seen out of the box it would support the already supported syntax, but it also allows us to create our own parser if needed. Another issue is related to the manual call to the backup script. It would be possible to introduce a flag, |
@pixxon If you would like to start working on this, please feel free and go ahead. I think Adding subcommands is probably needed then, but it should be pretty straightforward using the default Go Let me know if you need any further input. |
One more thing I just thought of is: Now that there soon shall be no need to run |
Could also make the whole tool more lightweight by using minimal docker image: FROM golang:1.21.6-alpine as builder
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT=""
ENV CGO_ENABLED=0 \
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} \
GOARM=${TARGETVARIANT}
WORKDIR /build
COPY . .
RUN go build -ldflags "-w -extldflags '-static' " -o backup /build/cmd/backup
FROM gcr.io/distroless/static:nonroot
COPY --from=builder --chown=nonroot:nonroot /build/backup /backup
ENTRYPOINT [ "/backup", "-foreground" ] |
Do you have numbers on how much smaller this will be? I have to admit I'm not a big fan of distroless images as they really suck when you need to debug things going wrong. In such case it's nice to have a proper userland as supplied by busybox. |
I used my local branch with the cron modifications, there the original one is 32.1MB while the distroless is 19.5MB. ( Seems like the binary size got a bit chunkier with those changes, since on the dockerhub the image is only 15MB. Or I am doing something wrong with the builds. ) |
One thing that just occured to me is that using a distroless image would be a breaking change because:
Maybe it's better to stick to alpine for now. |
The limitations of BusyBox's cron implementation when it comes to defining schedules crop up again and again e.g. #267 #185 #117
There seems to be a standalone apk package for cron https://pkgs.alpinelinux.org/package/edge/main/x86/apk-cron which seems lightweight enough to install it in the image if:
\
or-
Since this the core feature of this image, possible incompatibilities should be scrutinized closely before actually implementing.
The text was updated successfully, but these errors were encountered: