Skip to content

Tutorial: Deploying Dokku to DigitalOcean for excellent deploying goodness

In this tutorial, I’ll set up a Heroku-like environment on DigitalOcean using Dokku, that I used to set up the #talkpay search. Detailed instructions and lots of pictures to follow!

What’s Dokku?

Dokku is really awesome. It’s “Docker-powered mini-Heroku in around 100 lines of Bash.” If that’s not self explanatory, think of it this way:

  • You like deploying things in the “Heroku way” (i.e. all you do is push to a git remote, and voilà, your app is deployed! yay!)
  • You don’t like the way Heroku is hiking prices for hobbyists
  • … and you get more access to your server on DigitalOcean for $5/month, compared to the staggering [kidding, but also not] $7 on the new Heroku pricing. Plus, add whatever you like to your instance, it’s your server! Install MongoDB, install whatever services you need without paying extra.

Dokku + DigitalOcean is an awesome combination. Yes, you pay for a server now, but I’m seeing it as an opportunity to learn a new thing. Plus, I signed up using a referral code (such as this one, wink wink), and have spent a grand $1.80 thus far, since I killed the box once it fulfilled its need.

Fool-proof instructions for setting up Dokku on DigitalOcean

Now, lots of pictures on 0 to Dokku on DigitalOcean.

First, you’ll want to create a “droplet” which is your private virtual server.

create-droplet

You can create it with your preferred operating system, the default is fine. Next, add Dokku to your applications, by clicking on the “Applications” tab and selecting Dokku.

add-dokku

Make sure you’ve added an SSH key. You really shouldn’t have/need a user account for your server, because you use your public/private key pair to login. If you need help learning about SSH keys, GitHub has good documentation on it.

add-ssh

Next, DigitalOcean is creating your droplet.

creating-droplet

You will then be dropped into the dashboard for your droplet, where you can see your droplet’s IP right here:

digital-ocean-ip

Visit that IP and you get the Dokku set up screen. It should (conveniently!) already have your public key loaded, and you can just click “Finish Setup”.

dokku-setup

The next bit is a little confusing: After you clicked setup, it redirected you to the docs for Dokku. You’re actually on another page right now, but it has the instructions you need to get started.

pogrium-docs

Follow those instructions to add your Dokku remote (just like using Heroku!). Note where I changed the tutorial from dokku.me to 45.55.201.219. The word following the colon is the name of the app, which in this case I named example. As far as I can tell, it doesn’t matter greatly.

add-dokku-remote

Once you’ve set up the remote, you can push to it just like you would Heroku, adding the virtual server to your known hosts:

push-to-remote

dokku-action

wait-35-seconds

That all looked a lot like Heroku! Except for the 35 seconds part, but that’s a default timer to make sure things get set up. Since I didn’t name the host (since I didn’t bother with a domain yet), I now go directly to my IP/port and it’s running!

running-app

As you can see Dokku is pretty awesome and fast to set up! Hopefully this helps someone else get started with this setup.

If you’re interested in signing up for DigitalOcean, use this link to get $10 (aka 2 months) of credit. I also benefit from the referral 🙂

4 Replies to “Tutorial: Deploying Dokku to DigitalOcean for excellent deploying goodness”

  1. Hi Pam,

    Thanks for writing the tutorial. Really helpful, but is there anyway to get dokku working without a port number and a subdomain? Clearly new to this. Any help would be great.

    Thank you,

    Will

    1. Hmm, I don’t know! I imagine that’s a dokku thing … the Heroku style deployments mean you can deploy multiple apps to one domain, to different ports/subdomains. Theoretically, the app running on port 80 would be the one you see if you go to myapp.com, wonder if that would work.

  2. Just a minor note: you can’t pick an OS and an application. If you want to spin up a DO prebuild image, you’re stuck with Ubuntu. With Dokku it isn’t a big deal anyway, since afaik it doesn’t play nice with Centos or anything.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.