Skip to content

Instantly share code, notes, and snippets.

@john-doherty
Last active March 12, 2019 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save john-doherty/81d9b98f9cf566c0da235f4c1c32fb98 to your computer and use it in GitHub Desktop.
Save john-doherty/81d9b98f9cf566c0da235f4c1c32fb98 to your computer and use it in GitHub Desktop.
How to git push to a Dokku Droplet from a Mac

Digital Ocean Droplet

Digital Ocean offers a pre-installed Dokku image. You can run this image on any sized droplet, although larger droplets will allow you to run larger applications.

When choosing your Droplet configuration please disable IPv6. There are known issues with IPv6 on Digital Ocean and Docker, and many have been reported to the Dokku issue tracker. If you would like to run Dokku on an IPv6 Digital Ocean Droplet, please consult this guide.

Dokku setup using a Mac

  1. Login to your Digital Ocean account

  2. Click Create a Droplet

  3. Under Choose an image > One-click apps and choose Dokku 0.6.5 on 14.04 (version numbers may vary)

  4. Under Choose a size and select your a machine spec

  5. Under Choose a datacenter region select your region

  6. Under Add your SSH keys click New SSH Key (this opens a dialog)

  7. From your terminal, execute cat ~/.ssh/id_rsa.pub

  8. Copy the output and paste it into the New SSH Key dialog, provide a name and click Add SSH Key

  9. Under Finalize and create, give your droplet a hostname (not required) and click Create

  10. Once created, copy the IP address to your clipboard

  11. From your terminal, verify you can connect by executing ssh root@ip-address - then disconnect using exit

  12. From your terminal execute cat ~/.ssh/id_rsa.pub to get your public key and copy it's output to your clipboard

  13. Open a text editor and build the following line: echo "paste ssh key from clipboard" | sshcommand acl-add dokku user (removing line breaks)

  14. From terminal execute ssh root@ip-address to reconnect to your server

  15. From your server, execute echo "your ssh key without line breaks should be in here" | sshcommand acl-add dokku user

  16. Then execute exit to disconnect from your server

  17. Now try to connect as the dokku user ssh dokku@ip-address (this should return dokku help and disconnect)

  18. Now, go into your git project and add git remote host git remote add dokku dokku@ip-of-host:appname

  19. You should now be able to execute git push dokku master

Add MongoDB to Dokku instance created above

  1. From terminal execute ssh root@ip-address to reconnect to your server

  2. Then execute sudo dokku plugin:install https://github.com/dokku/dokku-mongo.git mongo

  3. Then execute dokku mongo:create databaseName

  4. Copy dns value, this is your connection string

  5. Then execute dokku mongo:link databaseName appName

  6. Execute exit to terminate your SSH session.

  7. Modify your application to use the new connection string obtained from dns

  8. Execute git push dokku master to deploy your changes.

Troubleshooting

Should you have any issues, please visit the freenode chat

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