Pingu is a tiny little Heroku app pinger that prevents your dynos from falling asleep.
Kinda like that horrible guard guy on Reykjavik airport.
- Create a heroku app (with the name of your choice).
- Clone Pingu and push (deploy) it as that Heroku app.
heroku config:set HEROKU_API_KEY=<key> -a <pingu-app-name>
- Tell pingu to run a dummy node server and loop forever:
heroku config:set KEEP_RUNNING=true -a <pingu-app-name>
- Profit!
You can set the pinging interval via LOOP_INTERVAL
env var (set it to ms between pings). It defaults to 30 minutes.
-
Run
npm install -g pingu
. -
Create a pingu user.
-
Save your Heroku API token somewhere in pingu user's
${HOME}
and make sure you limit access (only make it readable by pingu)! You can source it in your pingu user~/.bashrc
file. -
Create a Cron job that runs pingu and pass it the Heroku token. Run
crontab -e
as pingu and add something like:*/30 * * * * HEROKU_API_KEY=${HEROKU_API_KEY} pingu
-
Profit!