Skip to content

gertig/Pulse

Repository files navigation

What is Pulse?

Pulse is a Sinatra application that can be used to check to see if a website is currently up or down and then send you a Text message to alert of its change in status.

Getting Started

Start application with:

$ git clone git://github.com/AndrewGertig/pulse.git
$ cd pulse
$ bundle
$ createdb yourappname

Using Foreman, .env, and a Procfile

$ foreman start

To access and change data via the console

$ irb
$ require './app.rb'

Create your first Site

$ Site.create(url: "http://andrewgertig.com")

Open your browser to whichever PORT you are using, (for me I have it set to PORT=5002 in my .env file so http://localhost:5002) and you should see something like this:

Heroku Scheduler

Green means the site is up, Red means it's down. I used to own two.io but couldn't ever figure out what to do with it 😞

Twilio Setup

  1. Get a Twilio SMS account
  2. Add your phone number and keys to your .env file
  3. Add your Twilio keys to Heroku config
$ heroku config:add MY_TWILIO_NUM=5558675309 TWILIO_ACCOUNT_SID=XXXXXXXXXSIDXXXXXXXX TWILIO_ACCOUNT_TOKEN=XXXXXXXXTOKENXXXXXXXX

SendGrid Setup

If you want emails to be sent, configure SendGrid.

  1. Run heroku addons:add sendgrid:starter
  2. Set your email address ENV variable: heroku config:add [email protected] [email protected]

Mandrill Setup

If you want emails to be sent by Mandrill by MailChimp setup the Heroku addon like this.

  1. Run heroku addons:add mandrill:starter
  2. Set your email address ENV variable: heroku config:add [email protected] [email protected]

Heroku Scheduler

In order to check to see if a site is "UP" or "DOWN" you will need to setup a scheduled rake task using Heroku's Scheduler

$ heroku addons:add scheduler:standard
$ heroku addons:open scheduler

Create a Job that runs "rake check_sites" every 10 minutes, it should look like this once you are done:

Heroku Scheduler

Configuring Your Heroku Instance

To use the Datamapper methods (below), you need to remotely connect to the console on Heroku. To do this, run: heroku run console then require './app.rb'

Datamapper Basics

Create

$ Site.create(url: "http://andrewgertig.com")

Find

$ Site.get(1)
$ Site.first(:url => "http://andrewgertig.com")

Update

$ Site.get(1).update(url: "http://gertig.com")

Destroy

$ site = Site.get(5)
$ site.destroy  # => true

About

Your own pingdom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •