Coder Social home page Coder Social logo

heroku-ping's Introduction

heroku-ping: keep your heroku websites alive

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.

Deploy

Usage

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 protected]: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 heroku logs.

Environment variables

Name Expected value Description Example
PING_URL URI (with scheme) One or multiple URLs to ping. A , character is treated as delimeter when passing more than one value http://www.google.com,https://github.com
PING_METHOD HEAD (default) or GET HTTP request method used for pinging GET
PING_INTERVAL Integer number (default is 1200) Time between pings. Specified in seconds 60
PING_VERIFY_SSL 0 (default) or 1 Should we expect valid SSL certificate if URI begins with https? 1

Join in

Be sure to read the contributing guidelines. File bugs in the GitHub issue tracker.

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

Authors

See AUTHORS.txt.

License

MIT. See LICENSE.txt for terms of copyright and redistribution.

heroku-ping's People

Contributors

thoughtpolice avatar aleksandrs-ledovskis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.