Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Deploy your own PaaS: Setting up Dokku with DigitalOcean and Namecheap

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.

This write-up is very out of date! You probably shouldn't use it.

My friend Paul wrote an article based on this write up that's a bit more fleshed out:

This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.

1. Get a domain

Make sure you have a domain picked out first. There will be less waiting around for the DNS to resolve. I got from namecheap for a cool 3.98/yr.

2. Create a droplet

Sign up for DigitalOcean if you haven't already. I used a promo code and got $10 credit, effectively getting two months for free if I keep my usage low enough to only need a 512mb instance.

As of 2013-11-03T04:01:13.102Z dokku is having issues with Ubuntu 13.10, so go with Ubuntu 13.04 x64 unless that issue's been resolved. Make sure the droplet's hostname is the exact same as your domain (mine would be, as this will ensure /etc/hostname and the hostname command respond correctly (something dokku relies on).

3. Configure DNS

Once the droplet is up and running you should have an IP address to work with. If you're using namecheap, go to the "All Host Records" page of namecheap's "My Account > Manage Domains > Modify Domain" section.

You'll need an A record for the naked domain (the "@" one) pointing to your IP with the lowest TTL possible (namecheap caps the minimum at 60), and a wildcard for subdomains with the same info. I'd recommend redirecting www to the naked domain.

It should look something like this when you're done entering your data.

@ your.ip.address.k.thx A (Address) n/a 60
www http://your.domain URL Redirect (301) n/a 60
* your.ip.address.k.thx A (Address) n/a 60

4. Bootstrap Dokku

Once you get a happy response from dig +short $HOSTNAME (where $HOSTNAME is your hostname, e.g. dig +short, and the response contains the IP address you got from Digital Ocean and set in your Host Record configuration), you should be ready to go.

If you set up your SSH keys correctly you should be able to simply connect to the droplet via ssh without a password.

ssh root@your.domain # or root@your.ip.address.k.thx

For me the command was ssh I immediately checked if /etc/hostname contained and the hostname command responded in kind just to be sure.

Once you're logged in as root, you can simply run the dokku bootstrap script.

wget -qO- | sudo bash

5. Configure Dokku

cat ~/.ssh/ | ssh root@your.domain "sudo sshcommand acl-add dokku $NAME"

In this case dokku is the user associated with the dokku command (already created by dokku's, so it should not be changed. The $NAME parameter is the name of the SSH key you're adding (so that it can be removed later by name if necessary). $NAME should be changed (might be a good idea to use the name you gave to the same SSH key on Digital Ocean).

6. Deploy an App to a subdomain

Choose an app you want to deploy, cd into the repo, and add a new remote like so:

git remote add dokku dokku@your.domain:your-app-name

In my case I ran git remote add valis followed by git push valis master to deploy a dummy application to It worked!

Don't forget that your app still needs to conform to whatever the buildpacks are expecting. For example, a node.js app needs a package.json file listing dependencies to install and a Procfile specifying what processes to run.

7. Deploy an App to the root domain

This is detailed on this page of dokku's github wiki (took a little searching to actually track this down).

Basically all you need to do is make the part of the git address after the colon the same as the root domain.

git remote add dokku dokku@your.domain:your.domain

So for my setup, I'm doing git remote add valis to deploy a very basic Node.js app (source). Though it's not explicitly stated in the wiki, this will work for any domain as long as that domain's A Record is pointing at your droplet's IP. Dokku takes care of setting up the vhost for you, so once it's done building, it should just work.

Victory Lap

Feelin pretty cool right about now.

I saw this while trying to get set up with Vagrant. Similar to what you have here, I documented that process at Thanks!

Why did you set the ttl to 60?

And a small not on finding your way through namecheap: manage domains > click on domain > All Host Records


ungoldman commented Mar 23, 2014

@theicfire from wikipedia "When a caching (recursive) nameserver queries the authoritative nameserver for a resource record, it will cache that record for the time (in seconds) specified by the TTL."

So the real reason is I am impatient and want the domain to propagate as quickly as possible so I can get started.

In practice it's better to set a higher TTL after the initial setup to lower the load on nameservers (once again from wiki: "Shorter TTLs can cause heavier loads on an authoritative nameserver, but can be useful when changing the address of critical services like Web servers or MX records, and therefore are often lowered by the DNS administrator prior to a service being moved, in order to minimize disruptions.").

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