How to deploy static websites with Bluemix

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:

  • ensure you have the following installed and set up on your system:
  • run the following commands:
    <code>git clone
    cd esri-leaflet
    npm install
    grunt assemble:dev concat uglify sass copy
    cp manifest-sample.yml manifest.yml
    [edit the manifest.yml file and change the host property]
    cf push -s cflinuxfs2

This will create an esri-examples app in your Cloud Foundry org/space, running at the hostname you specified in the manifest.yml file.

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 cf push

  • added manifest.yml to .gitignore

  • added manifest-sample.yml as a sample Cloud Foundry manifest

  • added Staticfile which is used to configure staticfile-buildpack

More stories

Pod security policies in IBM Cloud Kubernetes Service

You can now use Kubernetes pod security policies in your IBM Cloud Kubernetes Service clusters. These policies enable the cluster administrator to configure who is authorized to create and update pods. For many cluster administrators, this is an important security feature to leverage.

Continue reading

Announcing IBM Key Protect Release in Frankfurt EU Region on IBM Public Cloud

Data leakage associated with data stored in the cloud is one of the top security concerns of cloud computing users. Having the ability to protect data with cryptographic encryption key management is critical to the overall security of a cloud ecosystem. Company policies, industry best practices, and government regulations are increasingly requiring data-at-rest encryption supported by encryption key management to be included as fundamental components of overall data storage, data management, and data governance.

Continue reading

Announcing Data Virtualization (Federation) for Db2 on Cloud

IBM is happy to announce Db2 Data Virtualization features for Db2 on Cloud. Sometimes called “federation”, this feature lets our customers access data from multiple different databases with a single query. With this latest addition, users will now be able to access data that is located on any of their Db2 or Informix data sources including both cloud and on premises system. This functionality is supported on all versions of Db2 on Cloud, except for the free Lite plan (However, users can use the Lite plan as a target that you can pull data from).

Continue reading