Deploy your code to Dokku with Codeship
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
In your Codeship account go to the project settings, and click on Deployment
In the list of deployment ways, click on Custom Script
Add the following script in the text area and change the YOUR_DOKKU_DEPLOY_ADDRESS to the actual Dokku address
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.
Go to your Codeship project settings, and click on General
When you scroll down, you find the SSH public key.
Copy that SSH key
SSH into your Dokku server
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 jeroen@firmhouse.com.