We recently ported the BitBalloon homepage to Middleman, a ruby based static site generator that’ll make you feel right at home if you’re used to Ruby on Rails development.
In this post you’ll see how we setup continuous deployment for our Middleman site with Codeship, a very affordable hosted continuous integration service.
First step is obviously to start a middleman site. If you’re starting a new one from scratch, here’s how it looks like:
gem install middleman middleman init my-site
This creates a new Middleman site that you can start working on. Create a new repository for your site on github and push your site there.
Alternatively, you can just fork our homepage from Github.
Your first BitBalloon deploy
Before moving on, you’ll want to do your first BitBalloon deploy manually.
First add this to your Gemfile:
Now go grab a BitBalloon API key at bitballoon.com/applications.
With your API key ready, you can do your first deploy:
bundle install bundle exec middleman build bundle exec bitballoon deploy build
This will first install all the dependencies, then run Middleman to build your site and finally deploy the build directory to BitBalloon.
Once the site is deployed, the BitBalloon commandline tool stores a file in your Middleman dir called .bitballoon with an access token and the ID of the site you deployed. You’ll normally want to add this file to your .gitignore file.
Now that your Middleman site is live on BitBalloon, it’s time to get continuous deploys setup. Signup for Codeship and then create a new project.
Pick GitHub as your provider and select the repository with your Middleman site. Once you’ve picked your repository, Codeship will ask you to configure your tests.
Pick Ruby from the Select your technology to prepopulate basic commands dropdown. Then Modify your test command to:
bundle exec middleman build
Instead of clicking the big green “Save and go to dashboard” button, follow the “save and continue your setup” link. Select the Master branch of your repository and then make sure to pick the $script option.
In the big deployment commands textbox, just type:
bundle exec bitballoon deploy build --access-token=YOUR_ACCESS_TOKEN --site-id=YOUR_SITE_ID
Replace the access token and site id with the values from your .bitballoon file. Save and finish, and Codeship will start building and deploying your site.
It can all be done in just a few minutes and this flow will serve you all the way from prototyping till a production site with millions of visitors.
Interested in Continuous Deployment?
We now recommend using netlify for Continuous Deployment.
It's our premium hosting platform and makes settings up continuous deployment of any static site as simple as it gets.