Deploy your code to Dokku with Codeship

Jeroen van Baarsen
February 22, 2016

At Firmhouse, we use Codeship to run all our tests, and we use Intercity Nextto manage our servers. Intercity Next is built upon Dokku, which allows us to deploy our code by a simple git push. Codeship supports a way to deploy your code once all the tests are green. Let's take a look how we can set this up using Codeship and Dokku.

Set up Codeship

  1. In your Codeship account go to the project settings, and click on Deployment
  2. In the list of deployment ways, click on Custom Script
  3. Add the following script in the text area and change the YOUR_DOKKU_DEPLOY_ADDRESS to the actual Dokku address
  4. Click on Create to set up this Build step.


Add the Codeship SSH key to your Dokku instance

Now that we've set up the Codeship deploy command to push to our Dokku on a green build, we also need to authorize Codeship to access the server.

  1. Go to your Codeship project settings, and click on General
  2. When you scroll down, you find the SSH public key.
  3. Copy that SSH key
  4. SSH into your Dokku server
  5. Run the following command, don't forget to change SSH_KEY to the key we just copied from Codeship


We can now test to see if we set everything up correctly by making an empty commit to your project: $ git commit --allow-empty -m "Testing deployment" && git push origin master

The empty commit will trigger a new build on Codeship, and if everything is configured correctly, it will also deploy the code to your Dokku server!

I hope this helped you in setting up Continues Deployment with Dokku and Codeship, if you have any questions, you can find me on Twitter(@jvanbaarsen) or by email