Deploying a Middleman static site to Cloud Foundry can be achieved in two ways:
Serving static files is more efficient than running a Rack-enabled webserver, and additionally will not require any extra files or configuration. It is therefore the preferred option.
Static files can be pushed to Cloud Foundry via the static-file buildpack.
Build the site:
$ bundle exec middleman build
Push the site:
$ cf push middleman-site \ -m 32M \ -p build/ \ -b https://github.com/cloudfoundry/staticfile-buildpack.git
The syntax is as follows:
$ cf push <app-name> \ -m <memory-limit> \ -p <app-directory> \ -b <custom-buildpack-url>
The ruby buildpack will automatically detect and execute Rack-enabled webservers if a
config.ru file is present.
Add a basic
config.ru file with the following contents:
require 'rubygems' require 'middleman/rack' run Middleman.server
Push the application to Cloud Foundry
$ cf push middleman-site -m 64M