Frank on Heroku is simply a Frank project template that makes it easy to host a Frank-based static site on Heroku.
Frank is useful Ruby gem that lets you build static sites using your favorite libs. Frank has a built in development server for previewing work as you develop, an "export" command for compiling and saving your work out to static html and css, and a publish command for copying your exported pages to a server.
Heroku's Cedar Stack makes it easy to host a Rack app
by adding a
config.ru file to the root of the project. Frank on Heroku includes a
that tells Heroku how to serve up files from the
/exported folder in a Frank project.
Frank on Heroku features
config.rufile that includes Ryan Tomayko's TryStatic class which will try and match requests to a static file in the
/exportedfolder (the default export folder for Frank).
http://www.example.com # => returns /exported/index.html http://www.example.com/about # => returns /exported/about.html http://www.example.com/tour/request-a-demo # => returns /exported/tour/request/request-a-demo.html
/heartbeatrequest handler that serves a simple
200response. Great for uptime monitoring.
404("File not found") error handling automatically serves
/exported/404.htmlto the user.
Make sure frank gem is installed. Install the gem if not:
$ gem install frank
Clone frank-on-heroku files into
$ cd ~/.frank_templates/ $ git clone git://github.com/rarestep/frank-on-heroku.git
Creating a new website
cdto the directory where your website code will live (e.g.
Create the new Frank project using the frank-on-heroku template:
$ frank new rarestep-www Frank is... - Creating your project 'rarestep-www' Which template would you like to use? 1. default 2. frank-on-heroku > 2 - Copying frank-on-heroku Frank template Congratulations, 'rarestep-www' is ready to go! $ cd rarestep-www/
$ rvm gemset create rarestep-www $ rvm gemset use rarestep-www $ bundle install
Run the Frank server locally and make sure you can pull up the stie (open http://localhost:3601/ in a web browser to view):
$ bundle exec frank server ----------------------- Frank's takin' care of business... 0.0.0.0:3601 >> Thin web server (v1.3.1 codename Triple Espresso) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:3601, CTRL+C to stop
Create a new app on Heroku on the Cedar Stack:
$ heroku create --stack cedar Creating severe-sky-5191... done, stack is cedar http://severe-sky-5191.herokuapp.com/ | firstname.lastname@example.org:severe-sky-5191.git Git remote heroku added
Export your site using Frank's
committo git and
$ bundle exec frank export A folder named `exported' already exists, overwrite it? [y/n] y Frank is... - Creating 'exported' - Creating 'exported/css/frank.css' - Creating 'exported/index.html' - Creating 'exported/css/frank.css' - Copying static content Congratulations, project dumped to 'exported' successfully! $ git commit -a -m "Exported site" $ git push heroku master $ heroku open
Updating a website
Super easy! Pushing updates is as simple as using Frank as normal to build out your site, then repeating Step #6 above when you're ready to push to Heroku.