Docs are now served over SSL
We have been serving our documentation and blog on
This arrangement was convenient; just push to a GitHub repo’s
gh-pages branch, and it was live.
This has served us well over the years, but we wanted to serve it over SSL from our custom domain.
To make this happen, we needed to modify the application into a standalone app that can be served on Heroku.
How did we do it?
GitHub Pages sites are served with Jekyll, which comes with a built-in server script. This is handy for local development, but it may not be appropriate for production use.
So we opted for using Puma.
To serve a Jekyll site with Rack, which Puma uses, we add
gem 'rack-jekyll' gem 'puma'
Puma needs to know how to serve this app, so add a new file
require 'rack/jekyll' require 'yaml' run Rack::Jekyll.new
This is a very straightforward configuration suggested by
Now, confirm that Puma can serve the app:
bundle install bundle exec puma
Configure deployment to Heroku
Assuming that you have created a Heroku application to deploy this application to, we need to make two more changes to our application.
Our application will run as a
web Dyno, and it is defined in
web: bundle exec puma -p $PORT
In order to serve static sites like ours, Heroku’s
expects to have a Rake task named
For Jekyll sites, it just needs to execute
namespace :assets do task :precompile do puts `bundle exec jekyll build` end end
Be sure that Rakefile can load all the tasks
This might seem obvious, but it bears mentioning explicitly.
Our docs app runs HTML::Proofer
to check broken links when commits are pushed to GitHub.
This is done via Rake, and the gem was installed only in the
As a result,
rake assets:precompile failed to run until the gem was installed
in all groups.
Redirect HTTP to HTTPS
As mentioned in the beginning, our goal was to serve the documentation over SSL. It is, then, vital that all HTTP traffic is redirected to HTTPS so that transition is transparent to users.
To achieve this, we use Rack::SslEnforcer.
Adding this is also straightforward:
require 'rack-ssl-enforcer' use Rack::SslEnforcer, :except_environments => 'development' # before `run Rack::Jekyll.new`
Deploy, sit back and enjoy!
Head on over to http://docs.travis-ci.com! You will be happily redirected to https://docs.travis-ci.com, and know that we stand behind the document you are viewing.
If you find incorrect information, though, please open a GitHub issue at https://github.com/travis-ci/travis-ci/issues, or better yet, suggest improvements by opening a pull request for https://github.com/travis-ci/docs-travis-ci-com.