Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An unoriginal web app that snaps screenshots of webpages and then displays the results
JavaScript CoffeeScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
config
phantom
public/img
views
.gitignore
Gemfile
Gemfile.lock
Procfile
README.md
api.rb
app.rb
config.ru
unicorn.rb

README.md

RoboShot

An unoriginal web app that snaps screenshots of webpages and then displays the results.

Presentation Sketch

Building A Rack Backend In 30 Minutes

Wherein Chris demonstrates the ease of building and deploying a small Rack-based app to Heroku.

This is RoboShot an unoriginal web app that snaps screenshots of webpages and then displays the results. I built him to experiment with PhantomJS's screenshot abilities.

Robo's parts list:

How's This Going To Work?

For this walk-through we will keep the front-end and throw away most everything else. We will then rebuild Robo's backend in three installments:

  • Install gems, copy front-end, serve front-end
  • PhantomJS & API
  • Rack glue & deployment

After each section I will ask for questions, so please save any you may have till one of those breaks. Now would be one of those breaks.

Questions?

Install Gems, Copy Front-end, Serve It

  1. mkdir
  2. Create Gemfile.
  3. Bundle it.
  4. cp front end (views & public dir)
  5. Show views/app.html briefly.
  6. Create app.rb.
  7. Demonstrate the page is served.
  8. Git init, git add ., git commit -m "first round."

Questions?

PhantomJS & API

  1. cp PhantomJS (bin & phantom dirs)
  2. ls bin.
  3. ls Phantom dir
  4. cat phantom/phantom.rb
  5. cat phantom/script.js
  6. Create api.rb basic.
  7. Run api and curl basic.
  8. Add carrier wave logic.
  9. Run api and curl demo
  10. Git init, git add ., git commit -m "second round."

Questions?

Rack glue & Deployment

  1. Create config.ru
  2. Rackup
  3. Heroku create
  4. git push heroku master
  5. Test it out.

Questions?

Exercises For The Reader

  • Add Unicorn for better concurrency.
  • Add HTTP basic auth
  • API throttling (a couple rack middle wares out there, but many are no longer actively maintained)
  • Push the screenshot logic into workers. (although unicorn helps us quite a bit).

Code for RoboShot is on github at https://github.com/cacciatc/roboshot.

Thanks for listening. I'm Chris Cacciatore from Dullahan Software.

Questions?

Something went wrong with that request. Please try again.