DEV Community

Ryan Tiffany
Ryan Tiffany

Posted on

Deploying Hugo on Bluemix

In today's post we will be showing how to deploy a Hugo site to Bluemix using the Cloud Foundry command line and build tools. This guide assumes that you have Hugo installed already. If this is not the case please see the Hugo Documentation for installing and configuring Hugo.

You will want to pick a Hugo theme and run a build so that your static files are sent to the public folder. I am using the heather-hugo theme on my example site so the command is:

$ hugo -t heather-hugo
Enter fullscreen mode Exit fullscreen mode

Once you have generated your static files you can move on to installing and configuring the Cloud Foundry cli to push your app to Bluemix.

Install and configure Bluemix Cloud Foundry cli

The installation will depend on your specific OS but you can use this page to get the command line interface installed. Once the install has completed you will need to login using the cf command:

$ cf login
API endpoint:



Targeted org dev_test

Select a space (or press enter to skip):
1. dev
2. testingground

Space> 1
Targeted space dev

API endpoint: (API version: 2.40.0)
Org:            dev_test
Space:          dev
Enter fullscreen mode Exit fullscreen mode

Create your manifest file

One of the most important requirements for a Cloud Foundry app is the manifest.yml file. This file defines metadata about your application. More information about manifest files can be found here: Deploying with Application Manifests.

Here is my hugo app manifest.yml file

- path: public/
  memory: 1024M
  instances: 1
  name: hugo
  host: hugo
  disk_quota: 1024M
Enter fullscreen mode Exit fullscreen mode

Here is the breakdown of the file:

  • path: Specify what folder gets pushed. If not defined, defaults to the current directory.
  • memory: Specify how much memory your application needs.
  • instances: Specify the number of app instances that you want to start upon push.
  • name: Name of your application.
  • host: This defines the name for the subdomain (
  • buildpack: Specify what kind of buildpack your application needs. More information here: Cloud Foundry stacks

Push application to Bluemix

Now that we have all our ducks in a row we can push our application to Bluemix using the Cloud Foundry cli:

$ cf push hugo
Using manifest file /Users/ryan/bluemix/cf-apps/hugo/manifest.yml

Updating app hugo in org / space dev as

Using route
Uploading hugo...
Uploading app files from: /Users/ryan/bluemix/cf-apps/hugo/public
Uploading 78.9K, 23 files
Done uploading

Stopping app hugo in org / space tinylab as

Starting app hugo in org / space tinylab as
-----> Downloaded app package (40K)
-----> Downloaded app buildpack cache (4.0K)
Cloning into '/tmp/buildpacks/staticfile-buildpack'...
Submodule 'compile-extensions' ( registered for path 'compile-extensions'
Cloning into 'compile-extensions'...
Submodule path 'compile-extensions': checked out '26a578c06a62c763205833561fec1c5c6d34deb6'
-------> Buildpack version 1.3.1
Downloaded []
grep: Staticfile: No such file or directory
-----> Using root folder
-----> Copying project files into public/
-----> Setting up nginx
grep: Staticfile: No such file or directory
-----> Uploading droplet (2.6M)

0 of 1 instances running, 1 starting
1 of 1 instances running

App started

App hugo was started using this command `sh`

Showing health and status for app hugo in org / space dev as

requested state: started
instances: 1/1
usage: 1G x 1 instances
last uploaded: Thu Feb 25 17:19:03 UTC 2016
stack: cflinuxfs2

     state     since                    cpu    memory       disk         details
#0   running   2016-02-25 11:19:36 AM   0.0%   2.6M of 1G   5.6M of 1G
Enter fullscreen mode Exit fullscreen mode

Create custom domain in Bluemix

For simple testing and proof of concept you can certainly keep using the domain, but if you are wanting to use this as a full time site you can configure Bluemix to use a custom domain. The first step to using your custom domain is to create the domain in Bluemix and associate it with an organization. The syntax is cf create-domain ORG DOMAIN_NAME. In my case the ORG is tinylab and my domain is

$ cf create-domain [ORG]
Creating domain for org tinylab as
Enter fullscreen mode Exit fullscreen mode

In order to use your custom domain you have to map the domain to your Bluemix application using the map-route command:

$ cf map-route hugo
Creating route for org tinylab / space Production_US as
Enter fullscreen mode Exit fullscreen mode

Point your custom domain to Bluemix

My domain is currently using the SoftLayer DNS service so I added a record to point my domain to the Bluemix DNS system using the awesome SoftLayer CLI. Disclaimer: I Work at SoftLayer

$ slcli dns record-add @ A
Enter fullscreen mode Exit fullscreen mode

Push to Bluemix to use the Custom domain

In order to see the site at the new custom domain we'll go ahead and push the app again.

$ cf push hugo
Enter fullscreen mode Exit fullscreen mode

Discussion (1)

mikewainwright profile image

Oh wow this is so much easier than using the cloud eclipse IDE. I'm going to try this later, thanks for writing this!