Your own pingdom
https://github.com/gertig/Pulse.git
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.
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:
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:
%%CODEBLOCK0%%
If you want emails to be sent, configure SendGrid.
heroku addons:add sendgrid:starterENV variable: heroku config:add FROM_EMAIL_ADDRESS=me@here.com TO_EMAIL_ADDRESS=you@there.comIf you want emails to be sent by Mandrill by MailChimp setup the Heroku addon like this.
heroku addons:add mandrill:starterENV variable: heroku config:add FROM_EMAIL_ADDRESS=me@here.com TO_EMAIL_ADDRESS=you@there.comIn 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:
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'
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