Skip to content

Instantly share code, notes, and snippets.

@bibstha
Last active February 5, 2021 07:47
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save bibstha/49540af53fa0ec5ab869 to your computer and use it in GitHub Desktop.
Save bibstha/49540af53fa0ec5ab869 to your computer and use it in GitHub Desktop.
Deploy to dokku from codeship.com

After migrating from heroku to dokku, we had to also chance codeship so we deploy to dokku. I followed the following steps to successfully deploy to dokku.

  1. Save the public key of the codeship project. It is found in Project Settings > General Settings.
  2. Copy the public key to a file /tmp/codeship_projectname.pub.
  3. Make sure when pasting, all the contents are in a single line and not multiple lines.
  4. Add the public key to dokku using the following command in console. Reference.
cat /tmp/codeship_projectname.pub | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"

Where [description] is a single word used to identify the key. I use codeship_projectname for [description]

  1. In codeship, go to Project Settings > Deployment. Delete heroku. Add a new custom script. Add the following lines to custom script. The git tree needs to be unshallowed first. Reference.
#!/bin/sh
git fetch --unshallow || true
git fetch origin "+refs/heads/*:refs/remotes/origin/*"
# checkout a remote branch with
# git checkout -b test origin/test
git remote add dokku dokku@yourdokkuinstance:projectname
git push dokku master

Now everytime you build on codeship, it should deploy to the dokku instance.

@mlocher
Copy link

mlocher commented Apr 8, 2015

Ahoy @bibstha,
it would be great if you add this script via a PR to the https://github.com/codeship/scripts repository. I can prepare the script as well and mention you as the original author in the comments if you'd prefer this! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment