run as daemon?
kylrth opened this issue · 6 comments
I know it's easy to just run this as a cron job, but being able to run goeland as a daemon or a Docker container would mean I can manage goeland along with all the other services I may have on the same machine.
I've created an example in this repo that demonstrates how I'm currently building goeland to run as a simple docker-compose service. This works just fine for me, but I wanted to bring it up here to see if you were interested in supporting this kind of usage.
Supporting this could be as simple as adding a goeland daemon
subcommand, if you aren't interested in supporting Docker.
Yes that's a very nice idea. Actually I always wanted to have a proper docker/daemon support, but I didn't take the proper time to do it. Your example is good, however I envision that some people would like more a cron-like way to describe the schedule (in your example, if INTERVAL
is 300 and the output is an email then an email would be sent every 5 hours, but maybe you want that only some days etc...).
I'll check if I can find a nice golang package to have cron schedule and then we can add a goeland daemon [--config-file=file.config]
type command that would read it.
It goes along with another issue I would like to address: an easy way to have many sources/pipes in one config file. It's already possible in the current format with the pipes and all, but you have to repeat quite a bit of information. Ideally, in daemon mode you would have only one config file and then do everything from it.
From this point, I would also auto build docker images on goeland tags.
I will not have time in the immediate next week, but I'll definitively look into it. Thanks for the suggest!
I'm also willing to help with this if you aren't able to get around to it sometime soon. I'm busy through April but after that I might be able to work on this.
Hello,
Sorry real life went inbetween. Since commit 1b0897b there is a 'daemon' command.
You can now specify a value 'cron' on every pipe, for example
[pipe.hackernews]
cron = "@every 5h"
and then run with goeland daemon
.
I haven't made a release yet but feel free to test it and discuss if it helps with your use case.
Hey I've just got this set up and it looks good so far. One suggestion I have as of now: maybe if the user specifies an @every
cron it should run once at the beginning as well? That's probably not what the cron package does by default so I'd understand if you don't want to modify the behavior.
Nice! So I have added an additional flag to the daemon command, --run-at-startup
. This way, I won't introduce non standard cron behaviour while maintaining the possibility of having a run at the beginning.
Currently debugging a weird issue with reddit rss feeds and I will publish a release.