• Stars
    star
    206
  • Rank 190,451 (Top 4 %)
  • Language
    CoffeeScript
  • Created about 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A hubot script that keeps the hubot Heroko web dyno alive

hubot-heroku-keepalive

A hubot script that keeps the hubot Heroku free web dyno alive.

Note that a free Heroku dyno can only run for 18 hours/day, so it will be required to sleep for at least 6 hours. Accessing your Hubot during a sleep period will wake it, but it will return to sleep after 30 minutes.

Installation

In hubot project repository, run:

npm install hubot-heroku-keepalive --save

Then add hubot-heroku-keepalive to your external-scripts.json:

[
  "hubot-heroku-keepalive"
]

Configuring

hubot-heroku-keepalive is configured by four environment variables:

  • HUBOT_HEROKU_KEEPALIVE_URL - required, the complete URL to keepalive, including a trailing slash.
  • HUBOT_HEROKU_WAKEUP_TIME - optional, the time of day (HH:MM) when hubot should wake up. Default: 6:00 (6 am)
  • HUBOT_HEROKU_SLEEP_TIME - optional, the time of day (HH:MM) when hubot should go to sleep. Default: 22:00 (10 pm)
  • HUBOT_HEROKU_KEEPALIVE_INTERVAL - the interval in which to keepalive, in minutes. Default: 5

You must set HUBOT_HEROKU_KEEPALIVE_URL and it must include a trailing slash – otherwise the script won't run. You can find out the value for this by running heroku apps:info. Copy the Web URL and run:

heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=PASTE_WEB_URL_HERE

If you want to trust a shell snippet from the Internet, here's a one-liner:

heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web.url | cut -d= -f2)

HUBOT_HEROKU_WAKEUP_TIME and HUBOT_HEROKU_SLEEP_TIME define the waking hours - between these times the keepalive will ping your Heroku app. Outside of those times, the ping will be suppressed, allowing the dyno to shut down. These times are based on the timezone of your Heroku application which defaults to UTC. You can change this with:

heroku config:add TZ="America/New_York"

Waking Hubot Up

This script will keep the dyno alive once it is awake, but something needs to wake it up. You can use the Heroku Scheduler to wake the dyno up. Add the scheduler addon by running:

heroku addons:create scheduler:standard

The scheduler must be manually configured from the web interface, so run heroku addons:open scheduler and configure it to run curl ${HUBOT_HEROKU_KEEPALIVE_URL}heroku/keepalive at the time configured for HUBOT_HEROKU_WAKEUP_TIME.

Heroku Scheduler Screenshot

Note that the Scheduler's time is in UTC. If you changed your application's timezone with TZ, you'll need to convert that time to UTC for the wakup job. For example, if HUBOT_HEROKU_WAKEUP_TIME is set to 06:00 and TZ is set to America/New_York, you'll need to set the Scheduler to run at 10:00 AM UTC.

Legacy Support

Hubot has for a long time had it's own builtin way to keep its web dyno alive, but this is an extraction of that behavior.

The legacy support uses the HEROKU_URL environment variable instead of HUBOT_HEROKU_KEEPALIVE_URL, so for forward compatability, hubot-heroku-keepalive will also use HEROKU_URL if it's present, and will also disable the legacy keepalive behavior if it's present.

Development

The best way is to use npm link and make sure to point HUBOT_HEROKU_KEEPALIVE_URL at the right place:

hubot-heroku-keepalive$ npm link
hubot-heroku-keepalive$ cd /path/to/your/hubot
hubot$ npm link hubot-heroku-keepalive
hubot$ export HUBOT_HEROKU_KEEPALIVE_URL=http://localhost:8080/
hubot$ bin/hubot

More Repositories

1

hubot-auth

Assign roles to users and restrict command access in other scripts
CoffeeScript
148
star
2

hubot-google-images

A hubot script that interacts with the Google Images API
CoffeeScript
123
star
3

hubot-business-cat

Business cat is summoned when business jargon is used
CoffeeScript
105
star
4

packages

DEPRECATED, see README.md for details
82
star
5

hubot-pager-me

PagerDuty integration for Hubot
JavaScript
75
star
6

hubot-google-translate

Allows Hubot to know many languages using Google Translate
CoffeeScript
63
star
7

hubot-google-hangouts

/hangout me command for Hubot
CoffeeScript
63
star
8

hubot-github-repo-event-notifier

Notifies about any GitHub repo event available via webhook.
CoffeeScript
57
star
9

hubot-example

An example script package for Hubot
54
star
10

hubot-youtube

A hubot script for searching YouTube
JavaScript
35
star
11

hubot-devops-reactions

CoffeeScript
28
star
12

hubot-sentimental

A hubot adapter for tracking happiness levels of users in an IRC channel via the Sentimental database
CoffeeScript
28
star
13

hubot-tell

Hubot plugin to send a user a message the next time they are present in the room
CoffeeScript
27
star
14

hubot-circleci

Hubot CircleCI integration
CoffeeScript
27
star
15

hubot-darksky

A script to grab the forecast information from Dark Sky for Hubot
CoffeeScript
26
star
16

hubot-seen

A hubot script that tracks when/where users were last seen.
CoffeeScript
24
star
17

hubot-pugme

Pugme is the most important hubot script
CoffeeScript
22
star
18

hubot-chef

A hubot chef/knife wrapper script
CoffeeScript
22
star
19

hubot-ambush

A hubot script to leave messages for people
CoffeeScript
20
star
20

hubot-http-status

HTTP Status/Error lookup for Hubot
CoffeeScript
19
star
21

hubot-thank-you

A hubot script that accepts your thanks
CoffeeScript
18
star
22

hubot-qr

Turn any url into a QR Code
CoffeeScript
18
star
23

hubot-codinglove

Hubot script to display meme from http://thecodinglove.com and http://lesjoiesducode.tumblr.com
CoffeeScript
17
star
24

hubot-yubikey-invalidation

Sends any accidental YubiKey presses to Yubico so they are invalidated
CoffeeScript
17
star
25

hubot-thesimpsons

A Simpsons Quote and Image Generator for Hubots.
CoffeeScript
17
star
26

hubot-shipit

A hubot script that provides easy access to the shipit squirrel and its kin
CoffeeScript
16
star
27

hubot-slack-invite-request

DEPRECATED β€” Use slack-invite-request instead:
HTML
14
star
28

hubot-victory

Time to see some victorious images!
CoffeeScript
13
star
29

hubot-fliptable

Sometimes you just want to flip a damn table.
JavaScript
13
star
30

hubot-basecamp

Expands Basecamp URLs in chat with more useful information.
CoffeeScript
13
star
31

hubot-reaction

CoffeeScript
12
star
32

hubot-explainshell

A quick way to get a link to explainshell
CoffeeScript
10
star
33

hubot-mailchimp

Mailchimp hubot script as an NPM package
JavaScript
8
star
34

hubot-motivate

A port of http://motivate.im/
CoffeeScript
8
star
35

hubot-principles

Hubot script that gives out advise about relationships and communication
CoffeeScript
8
star
36

hubot-freshdesk

Freshdesk support tickets integration right into your company chat room.
CoffeeScript
7
star
37

hubot-partyline

Decentralized P2P partyline support for Hubot
CoffeeScript
7
star
38

hubot-heroku-deploy-notifier

A hubot script that notifies of heroku app deploys
CoffeeScript
7
star
39

hubot-diabetes

A diabetes script package for Hubot.
CoffeeScript
7
star
40

hubot-2048

A 2048 Game Engine for Hubot
CoffeeScript
6
star
41

hubot-worldcup

CoffeeScript
6
star
42

hubot-darts

CoffeeScript
5
star
43

hubot-ttc-alerts

CoffeeScript
5
star
44

hubot-nationalrail

Get National Rail Live departure information
CoffeeScript
4
star
45

hubot-uptimerobot

A hubot script to list/add monitors for the Uptime Robot service.
CoffeeScript
4
star
46

hubot-cute-me

CoffeeScript
4
star
47

hubot-gh-token

Stores GitHub Personal Access Tokens in Hubot's brain
CoffeeScript
4
star
48

hubot-gh-issues

Hubot interface for GitHub issues
CoffeeScript
4
star
49

hubot-whiteboardcleaner

Automatically optimise photos of your whiteboard
CoffeeScript
4
star
50

hubot-express

experimental express provider
CoffeeScript
3
star
51

hubot-statuscake

Use hubot to send StatusCake status messages to your chat room.
CoffeeScript
3
star
52

hubot-pagerduty-github

Deprecated. See link...
CoffeeScript
3
star
53

hubot-ghe

Access your GitHub Enterprise instance through Hubot.
CoffeeScript
3
star
54

hubot-assembla

hubot script for interacting with Assembla API
CoffeeScript
3
star
55

hubot-chartbeat

Hubot: Chartbeat Script
CoffeeScript
2
star
56

hubot-di

Get currently playing tracks from DI.fm
CoffeeScript
2
star
57

hubot-github-hooks

Add and remove GitHub repository service hooks (only Campfire at the minute)
CoffeeScript
2
star
58

hubot-euphemism

CoffeeScript
2
star
59

hubot-dynstatus

A hubot script to parse the RSS status page for dyndns
CoffeeScript
2
star
60

hubot-freshdesk-ticket-notifier

A hubot script for tracking any webhook events from the Freskdesk support tool.
CoffeeScript
2
star
61

hubot-bikeshed

Hubot has an opinion on your bikeshed color
CoffeeScript
2
star
62

hubot-hearthstone

CoffeeScript
1
star
63

hubot-andrews-and-arnold

Get your ISP Quota from Andrews & Arnold's API
CoffeeScript
1
star
64

hubot-timezoneio

Hubot interface for timezone.io
CoffeeScript
1
star
65

owners

DEPRECATED, see https://github.com/hubot-scripts/packages/blob/master/README.md
1
star