August 29, 2014 | Written by: Patrick Mueller
Categorized: Community | How-tos
Share this post:
Dr Nic Williams – aka “Dr Nic” – is one of the luminaries of the Cloud Foundry hacking community. He’s always coming up with interesting little goodies to use on Cloud Foundry-based PaaS’s.
His recent blog post “Host static sites on Cloud Foundry” introduced a new buildpack that he’s made available called
staticfile-buildpack. Read that blog post to find out more about the buildpack. This buildpack can be used to create a server which contains no logic, just serves up resources like HTML / JS / CSS / image / etc resources – aka a “static website”. Sometimes that’s all you need.
In the blog post, Dr Nic shows deploying to Pivotal Web Services, and while this should work on Bluemix, you never know until you try. So I tried. And of course it worked. 🙂
To test the buildpack, I happened to have a perfect example that I have been playing with for while. It’s the mapping library Leaflet, with the Esri Leaflet plugins. The Esri Leaflet plugins add capabilities to Leaflet from the ArcGIS mapping products. The Esri Leaflet plugins repo contains the source for a number of samples and API documentation, which can be run as … you’ll never guess … a static website.
I forked the plugin repo to add a few bits to make it easier to work with Cloud Foundry and
staticfile-buildpack. The repo is here:
A version of the static website is currently running here:
To run your own version of this site, you should do the following:
This will create an
esri-examples app in your Cloud Foundry org/space, running at the hostname you specified in the
The changes I made to the
esri-leaflet repo were:
- added a
.cfignore file to cut down on the number of files sent when you run
manifest-sample.yml as a sample Cloud Foundry manifest
Staticfile which is used to configure