๐Ÿ“ฆ gertig / Pulse

Your own pingdom

โ˜… 17 stars โ‘‚ 2 forks ๐Ÿ‘ 17 watching
๐Ÿ“ฅ Clone https://github.com/gertig/Pulse.git
HTTPS git clone https://github.com/gertig/Pulse.git
SSH git clone git@github.com:gertig/Pulse.git
CLI gh repo clone gertig/Pulse
Andrew Gertig Andrew Gertig Merge pull request #4 from stevemoser/patch-1 3c0e55f 7 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ assets
๐Ÿ“ public
๐Ÿ“ tasks
๐Ÿ“ views
๐Ÿ“„ .gitignore
๐Ÿ“„ .ruby-gemset
๐Ÿ“„ .ruby-version
๐Ÿ“„ app.rb
๐Ÿ“„ config.ru
๐Ÿ“„ Gemfile
๐Ÿ“„ Gemfile.lock
๐Ÿ“„ Procfile
๐Ÿ“„ Rakefile
๐Ÿ“„ README.md
๐Ÿ“„ README.md

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 :disappointed:

Twilio Setup

  • Get a Twilio SMS account
  • Add your phone number and keys to your .env file
  • Add your Twilio keys to Heroku config
%%CODEBLOCK0%%

SendGrid Setup

If you want emails to be sent, configure SendGrid.

  • Run heroku addons:add sendgrid:starter
  • Set your email address ENV variable: heroku config:add FROM_EMAIL_ADDRESS=me@here.com TO_EMAIL_ADDRESS=you@there.com

Mandrill Setup

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

  • Run heroku addons:add mandrill:starter
  • Set your email address ENV variable: heroku config:add FROM_EMAIL_ADDRESS=me@here.com TO_EMAIL_ADDRESS=you@there.com

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

Datamapper Documentation