Like some people, I use heroku to keep my homepage alive. Unfortunately, the heroku dynos are powered down if they don't get requests in a certain amount of time, meaning visitors to your site often experience a nasty delay.
This is a heroku application that pings a URL every 20 minutes to fix that. No more, no less.
Clone the repo, create an app.
$ git clone https://github.com/thoughtpolice/heroku-ping.git $ cd heroku-ping $ heroku create ping-MYAPP Creating ping-MYAPP... done, stack is cedar http://ping-MYAPP.herokuapp.com/ | email@example.com:ping-MYAPP.git Git remote heroku added
Now add the URL of the heroku application you want to ping using the
PING_URL environment variable.
See list of accepted variables below
$ heroku config:add PING_URL=http://MYAPP.herokuapp.com Setting config vars and restarting ping-MYAPP... done, v3 PING_URL: http://MYAPP.herokuapp.com
Now push, and scale the worker to 1 instance.
$ git push heroku master ... -----> Ruby app detected -----> Installing dependencies using Bundler version 1.3.0.pre.5 ... -----> Discovering process types Procfile declares types -> worker Default types for Ruby -> console, rake -----> Compiled slug size: 688K -----> Launching... done, v5 http://ping-aseipp.herokuapp.com deployed to Heroku ... $ heroku ps:scale worker=1 Scaling worker processes... done, now running 1
You're done. Now your web application will be kept alive! You can make
sure it's working by checking
PING_URLURI (with scheme) One or multiple URLs to ping. A
,character is treated as delimeter when passing more than one value
GETHTTP request method used for pinging
PING_INTERVALInteger number (default is
1200) Time between pings. Specified in seconds
1Should we expect valid SSL certificate if URI begins with
Master git repository:
git clone https://github.com/thoughtpolice/heroku-ping.git
There's also a BitBucket mirror:
git clone https://bitbucket.org/thoughtpolice/heroku-ping.git
MIT. See LICENSE.txt for terms of copyright and redistribution.