I come across the situation where I want to re-run a Ruby script every so often. I'd like to know the simplest way to run this in the cloud. All it...
For further actions, you may consider blocking this person and/or reporting abuse
What about Now + Docker?
Maybe you can deploy a Ruby script + a Dockerfile with cron configured and run a script repeatedly.
Anytime you change the script or the scheduling configuration you can just deploy a new one.
Another option could be Microsoft Azure time triggered functions but it doesn't support Ruby
I was actually going to suggest a cron job as well lol.
I know it's not what you asked, but I'm curious about the nature of what the script's trying to achieve, sometimes recurring event type things can benefit from being redesigned.
Keep-alive or "ping this endpoint" type recurring things meant to cause side-effects aren't ideal, and the orgs have moved away from un-trackable, invisible Cron job type work.
The scripts are definitely in the realm of "ping this endpoint" kind of scripts. I could see how this would be a problem at a certain scale, but for automating flows of my own the downside doesn't seem so troubling.
That's my defense of the idea, but I'd love some elaboration on your general concern.
The general concern is this:
Something that is necessary to the life of an app or process shouldn't live separate from it, both in codebase and infrastructure. That gets lost among teams / individuals. They tend to go undocumented, forgotten by time, and then you're dependent on something without realizing it. I've had to deal with lots of legacy migrations that get thwarted and delayed by something.
Typically there are better ways to achieve something set up like this. If it's a keep awake ping, there are almost always better ways of configuring Always Awake.
Sometimes it's unavoidable, it's possible that this doesn't fit your situation, and also maybe it isn't a critical thing. But if you can keep it closer to where it's necessary, future you / future devs will appreciate it being clearer, and it won't be an ambush when it's gone.
I was previously looking at doing almost exactly this a year or so back.
Rancher has container-crontab which will perform actions on a docker container based on a cron schedule.
Dockron allows scheduled
docker run
s but it is kind of stale. Last commit was in 2015.AWS Elastic Container Service also supports service scheduler, but I have no context for the overhead required to use that service.
Just create a free Heroku machine and use the Scheduller add-on.
dev.to/marcuscreo/the-4-letter-wor...
:)
I get your point. But, in this context, the "just" was in reference to the other answers given, that involved quite more convoluted methods to solve the same problem.
Scheduling / executing is probably less complex than wiring it into whatever it acts upon? Follow the data...?
If (as alluded to) you are 'pinging an endpoint' then I'd be tempted to find a solution outside your own code, there are many good monitoring services to choose from.
Do we get more details @ben , or is part of the fun us guessing what you are actually doing here? :)
Assuming that whatever gems you need to depend on are supported by Java, you could just use JRuby, compile your script to a JAR, and run it periodically on AWS Lamda.
I may be wrong but I think rake tasks + heroku can do this
docs.hyper.sh/Feature/container/cr... looks nice. Haven't used it though.