Codeship

This add-on is operated by Railsonfire Limited

Continuous integration and deployment for your apps

Codeship

Last Updated: 20 January 2014

Table of Contents

Codeship is an easy to use hosted continuous integration and deployment service.

Whenever you push your application to GitHub we run all your tests on the new version and automatically deploy your application to Heroku on success. Easily test and deploy your applications without setting up your own test server. Getting started takes less than two minutes and is fully integrated with Heroku. Try it for free!

Installing the add-on

Codeship can be installed to a Heroku application via the CLI:

A list of all plans available can be found here.

$ heroku addons:add codeship
-----> Adding codeship to sharp-mountain-4005... done, v18 (free)

To jump aboard the ship open your Codeship account by running the following command

$ heroku addons:open codeship

You will be taken to the setup wizard if you haven’t already configured a project. You can always access your Codeship dashboard using heroku addons:open codeship. Alternatively you can sign in through GitHub or with your email/password

Configuration

When you start setting up a project you have to select your source code repository first. At the moment we support GitHub, but there will be other options soon. Choose “GitHub” and select your project’s repository.

SCM GitHub selection

Now let’s edit your setup and test commands. Setup commands usually include installing your dependencies or setting up your database. Test commands are shell commands needed to run your tests. For example bundle exec rake for ruby, npm test for nodejs or mvn test for Java. You can run as many test commands as you like.

If a command’s return code isn’t 0 the build will fail.

Test Settings

You can configure deployment for branches in the next step. The wizard will let you add one branch to make the setup quick and easy.

Select Deployment Branch

You can always go to back to the configuration later on and manage deployment commands for other branches as well.

For example if you want to have a production branch in your repository that gets deployed into your production app and a master branch that is deployed into your staging application.

Add Deployment Branch

You can also configure multiple deployments for a single branch. For example deploy to staging first and then, if the deployment works for your master branch, to production. Another use case would be to run specific commands before and/or after your deployment.

To add a deployment method simply click on the logo. It will be added to the end of the list of deployments. Easily re-order your deployment methods by simply dragging and dropping their logos. All of your configured deployment methods will be run sequentially.

Deployment Add

Over time we will add more and more deployment methods so you can run various tools, test environments or commands easily. You can always fall back to script deployment which lets you add shell commands as a deployment.

Deploy Settings

Deploying to Heroku is incredibly easy. Just click on the Heroku deployment method. The only necessary setting you have to do is type in your application name.

The other settings are:

Backup

A backup through the pgbackups Addon will be done.

Force

Pushing via a git force push to Heroku to overwrite whatever was in the repository before. This is handy for deploying to your staging application as you may have pushed something to give it a try but haven’t reverted. You should never enable this in production.

Migrate

Runs Rails migrations on your application

Restore From

Copies the postgres database from another app into this applications database. For example you are pushing to staging and want to run the migrations with production data. You can restore the production db into your staging application to have it accessible for your migrations. It will use the pgbackups addon to do this.

URL

The URL that will be called to check that no HTTP 500 Status is returned. By default this will be http://APPNAME.heroku.com but you can change that to anything you want. If you use HTTP Basic AUTH please add your AUTH configuration so it says http://USERNAME:PASSWORD@STAGING_URL and we can access it.

How to connect to the databases

Codeship currently supports Sqlite, PostgreSQL, MySQL, MongoDB, Redis and Memcache. All of them run on default ports. Connecting to MongoDB, Redis and Memcache shouldn’t need any further configuration than the default one.

Postgres and MySQL

If you use Rails the Codeship automatically checks your database.yml file and replaces the appropriate configuration so you can access our databases.

If a database.yml file cannot be found we will read your Gemfile and configure the database.yml depending on the gems you use.

The credentials for our database are:

Postgres:

User:     postgres
Password: test

MySQL:

User:     root
Password: test

Supported technologies

Following is a list of technologies, languages and additional tools supported by the Codeship.

Source Code Management

Git

Databases

  • PostgreSQL
  • MySQL
  • SQLite
  • MongoDB
  • Redis
  • Memcached

Languages

  • Ruby (2.0.0, 1.9.3, 1.9.2, 1.8.7)
    • Anything Ruby native (Rails, Sinatra, …) is supported
    • Rspec, Cucumber, Test::Uni, Minitest,
    • Capybara(-webkit)
  • NodeJS (npm)
  • Python (virtualenv) – Django is supported
  • PHP (phpunit)
  • Java (Maven, Ant)
  • Scala (sbt)
  • Clojure
  • Groovy

Additional tools

  • Selenium
    • Firefox
    • Chrome
  • PhantomJS
  • CasperJS

Migrating between plans

We all want to have flexibility. Changing plans is not a problem at all. Migrating from one Codeship plan to another will simply alter the resource limits of the service. No data will be lost in any way, thus making it a safe operation.

Use the CLI to migrate to a new plan.

$ heroku addons:upgrade codeship:medium
-----> Upgrading codeship:medium to sharp-mountain-4005... done,
v18 ($49/mo) Your plan has been updated to: codeship:medium

You can upgrade your plan on one of your Heroku apps. All of your other Heroku apps are then covered by that one plan upgrade.

Removing the add-on

If some strange outlandish circumstances should force you to remove the add-on (you don’t want to remove the add-on!) the Codeship can be removed via the CLI. This will destroy all associated data and cannot be undone!

Before removing the add-on please have a little chat with Alex from the Codeship crew and tell him what made you remove it so we can improve our service for future users.

$ heroku addons:remove codeship
-----> Removing codeship from sharp-mountain-4005... done, v20
(free)

All your keys are named with the project name, so you can easily see which keys are in there from the Codeship

$ heroku keys
ssh-rsa AAAAB3FcbR.../uX8kI4rsL codeship/owner/name

Support

Heroku provides support requests for all add-ons through https://support.heroku.com. If you have any questions or need anything you can add a ticket there and they will let us know.

If you use our app the best/fastest way to contact is via our in-app support system. Additionally you can also contact us via email or on twitter.

The Codeship Blog

You should frequently have a look at our blog. Our crew works hard to bring you awesome content. A lot of interesting articles about using the Codeship with Heroku, automated testing, continuous integration and deployment can be found there.

Should you have any other questions just let us know!

Always be shipping!