hubot-archive / hubot-heroku-keepalive Goto Github PK
View Code? Open in Web Editor NEWA hubot script that keeps the hubot Heroko web dyno alive
A hubot script that keeps the hubot Heroko web dyno alive
In the past few days, Heroku made this announcement:
Another important change has to do with dyno idling, or ‘sleeping’. While non-paid apps have always slept after an activity timeout, some apps used automatic pinging services to prevent that behavior. free dynos are allowed 18 hours awake per 24 hour period, and over the next few weeks we will begin to notify users of apps that exceed that limit
- Heroku
How should we take this into account? set a variable for hubot's "waking hours"?
I set the environment variables as follows
HUBOT_HEROKU_WAKEUP_TIME = '8:00'
HUBOT_HEROKU_SLEEP_TIME = '2:00'
but hubot puts INFO Skipping keep alive, time to rest
log out and sleeps soon.
(I think this line decides the behavior.)
Does anyone know the way to avoid this problem?
Hey guys,
Not sure if something's changed regarding how the script or heroku works but I noticed over the past while hubot has been falling asleep and then not waking up. I currently have the sleep time on the script to sleep from 22:00 to 7:00.
I have Heroku Scheduler running with the following parameters: (maybe this is conflicting with the script?)
Dyno size | Frequency | Last run | Next due |
---|---|---|---|
Free | Daily | Nov 21 9:00 UTC | Nov 22 9:00 UTC |
Log:
2016-11-21T09:00:39.315430+00:00 heroku[scheduler.2640]: Process exited with status 0 2016-11-21T09:05:38.022935+00:00 app[web.1]: [Mon Nov 21 2016 05:05:38 GMT-0400 (AST)] INFO keepalive ping 2016-11-21T09:05:38.023082+00:00 app[web.1]: [Mon Nov 21 2016 05:05:38 GMT-0400 (AST)] INFO Skipping keep alive, time to rest 2016-11-21T09:10:38.022657+00:00 app[web.1]: [Mon Nov 21 2016 05:10:38 GMT-0400 (AST)] INFO keepalive ping 2016-11-21T09:10:38.022736+00:00 app[web.1]: [Mon Nov 21 2016 05:10:38 GMT-0400 (AST)] INFO Skipping keep alive, time to rest 2016-11-21T09:15:38.023198+00:00 app[web.1]: [Mon Nov 21 2016 05:15:38 GMT-0400 (AST)] INFO keepalive ping 2016-11-21T09:15:38.023269+00:00 app[web.1]: [Mon Nov 21 2016 05:15:38 GMT-0400 (AST)] INFO Skipping keep alive, time to rest 2016-11-21T09:20:38.028584+00:00 app[web.1]: [Mon Nov 21 2016 05:20:38 GMT-0400 (AST)] INFO keepalive ping 2016-11-21T09:20:38.028724+00:00 app[web.1]: [Mon Nov 21 2016 05:20:38 GMT-0400 (AST)] INFO Skipping keep alive, time to rest 2016-11-21T09:25:38.033125+00:00 app[web.1]: [Mon Nov 21 2016 05:25:38 GMT-0400 (AST)] INFO keepalive ping 2016-11-21T09:25:38.033189+00:00 app[web.1]: [Mon Nov 21 2016 05:25:38 GMT-0400 (AST)] INFO Skipping keep alive, time to rest 2016-11-21T09:30:38.037565+00:00 app[web.1]: [Mon Nov 21 2016 05:30:38 GMT-0400 (AST)] INFO Skipping keep alive, time to rest 2016-11-21T09:30:38.037409+00:00 app[web.1]: [Mon Nov 21 2016 05:30:38 GMT-0400 (AST)] INFO keepalive ping 2016-11-21T09:35:38.041859+00:00 app[web.1]: [Mon Nov 21 2016 05:35:38 GMT-0400 (AST)] INFO keepalive ping 2016-11-21T09:35:38.041911+00:00 app[web.1]: [Mon Nov 21 2016 05:35:38 GMT-0400 (AST)] INFO Skipping keep alive, time to rest 2016-11-21T09:37:28.820046+00:00 heroku[web.1]: Idling 2016-11-21T09:37:28.820566+00:00 heroku[web.1]: State changed from up to down 2016-11-21T09:37:29.429852+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2016-11-21T09:37:29.543054+00:00 heroku[web.1]: Process exited with status 0
We should build the HUBOT_HEROKU_KEEPALIVE_URL
if possible:
https://devcenter.heroku.com/articles/dyno-metadata
Why not just add the trailing slash if it's not there? Further, why not just allow someone to use the app name slug?
I ask not rhetorically, but because I suspect there might be good reason :)
Should I switch this to just http instead of https for my keep alive url?
If you have this in your external-scripts.json
in development without HUBOT_HEROKU_KEEPALIVE_URL or HEROKU_URL, it will log a warning every startup which is kind of annoying.
I'm open to suggestions about shushing it. Some ideas:
In hubot project repository, I run npm install hubot-heroku-keepalive --save
, and add the hubot-heroku-keepalive
to my external-scripts.json, there exists hubot-heroku-keepalive under node_modules directory, but when run heroku apps:info
, it said heroku: command not found
, why? Thanks!
I was hoping that you could help me understand your hubot heroku keepalive script a little better. I am struggling to have my hubot wake up during a sleep period (or verifying if your plugin is working at all) -- specifically, i'm not sure what you mean by "accessing your Hubot during a sleep period will wake it, but it will return to sleep after 30 minutes". Does "accessing my hubot" mean simply chatting to it -- because that has not been working for me.
Hubot doesn't wakeup after going to sleep.
My config is
HUBOT_HEROKU_KEEPALIVE_URL: https://caari.herokuapp.com/
HUBOT_HEROKU_SLEEP_TIME: 1:10
HUBOT_HEROKU_WAKEUP_TIME: 1:40
TZ: Asia/Karachi
Logs:
» 29 Apr 2017 01:34:04.684 102 <45>1 2017-04-28T20:34:04.324911+00:00 heroku web.1 - - Idling
» 29 Apr 2017 01:34:04.749 125 <45>1 2017-04-28T20:34:04.325568+00:00 heroku web.1 - - State changed from up to down
» 29 Apr 2017 01:34:05.201 131 <45>1 2017-04-28T20:34:05.130888+00:00 heroku web.1 - - Stopping all processes with SIGTERM
» 29 Apr 2017 01:34:05.812 124 <45>1 2017-04-28T20:34:05.430702+00:00 heroku web.1 - - Process exited with status 0
» 29 Apr 2017 02:27:02.404 104 <45>1 2017-04-28T21:27:02.008938+00:00 heroku web.1 - - Unidling
» 29 Apr 2017 02:27:02.471 131 <45>1 2017-04-28T21:27:02.009285+00:00 heroku web.1 - - State changed from down to starting
There was HTTP post request at 2:27, which started the dyno again.
I think bot should have been up at 1:40, is there something I'm missing?
Will heroku accept the env var? or should I put the actual one?
Still a trailing slash/ if manual, right?
http or https?
Sorry dumb questions, but my keepalive isn't working
I am having an issue that I am hoping you might be able to give me some pointers on...
I have 4 apps set up in Heroku, each of them is a Hubot instance, that is linked to a Gitter chat room. The Hubot instance itself is working as I would expect them to, however, 2 out of the 4 applications fail to come back to life each morning. As you can see here:
From what I can tell, each application is configured exactly the same way, so I can't understand why two of them don't wake up.
Can you suggest anything that I can look into? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.