Your Own Mini-Heroku on AWS


is one of those really great tools to help you get started fast with hosting. They support a variety of stacks and save you blood, sweat and tears when it comes to deploying an app. But what about those times where you need to mess with filesystems or have custom binaries that you want to run? How about just having more control of your servers? Dokku to the rescue! Dokku is a small (just above 100 lines of code) yet very powerful tool based on Docker. Dokku utilizes Docker and Nginx plus some other candy to significantly simplify the process of deploying.


  1. More control, more access. Customize to your needs
  2. Unlimited projects (or at least however many your hard drives can keep)
  3. Cheaper, because lets face it; you get tired of waiting for that Heroku dyno to start up


  1. Doesn’t scale as easily
  2. Doesn’t necessarily have the guarantee of availability as Heroku (depends on server hosting)
  3. Still pretty fresh (but lots of new features in progress)

For now I think that Dokku is great for development, maybe as a staging server to be used within a company or for hobbyists. It is super fast to set up and allows you and your co-workers/friends to host apps simply. Dokku also saves you the time for setting up web servers and configurations in the case you just want to host your own apps.

Below is a couple of fast steps in order to get started with Dokku on AWS. In this tutorial we will set up a sample Node.js app using Sailsjs. We assume you already have access to AWS.

  1. What we first need is a server instance to run Dokku. As the time of this writing there are some issues with Ubuntu 13.10 and it’s recommended to run Ubuntu 13.04 for Dokku. The AMI for Ubuntu server 13.04 x64 can be found here:
  2. Once the instance is up and running, we need to allow port 80 for our instance. This can be done under “Security Groups” in the AWS console.
  3. Now that we have the server up and running go ahead and point any top level domain to this instance. The ip of the instance can be found in the AWS console in the description for your instance (Public IP).
  4. Next thing to do is to ssh into your new Ubuntu 13.04 server and install Dokku (which automatically installs all dependencies and sets everything up for you):
    [code language=”bash”]ssh -i ~/.ssh/aws.pem
    wget -qO- | sudo DOKKU_TAG=v0.2.1 bash[/code]
  5. When the installation is done, run the following command to set your hostname:
    [code language=”bash”]echo "" > /home/dokku/VHOST[/code]
  6. We now need to add our public key to be able to push to our Dokku server.
    [code language=”bash”]cat ~/.ssh/ | ssh -i ~/.ssh/aws.pem "sudo sshcommand acl-add dokku dokku”[/code]
  7. Next let’s generate an application and push it to see if it works!
    [code language=”bash”]
    npm install sails -g #Install sails if you haven’t got it yet
    sails new myapp
    cd myapp
    echo "web: node app.js" > Procfile
    git init .
    git add . -v
    git commit -m "Initial commit, cross your fingers that this will work!"
  8. At this point we have a server running on AWS, with dokku running on it. We have generated a brand new app using Sailsjs and we have added necessary Procfile to make it run on our server. We now need to add the remote and then deploy:
    [code language=”bash”]
    git remote add mini-heroku
    git push mini-heroku master

That’s it! In 8 simple steps (with hopefully a lot of coffee breaks) you have set up your own mini-Heroku!


  1. hck3r on said:

    Hi, its a good explanation and I was successfully able to push my sails app into dokku running on ec2. But I’m not able to access the url provided by dokku for that app. shouldn’t the sails app be running on that url provided by dokku ? or the one configured in vhosts?

  2. Lou on said:

    This is pretty cool, but how does Nginx fit into this? Isn’t Dokku tied to Ubuntu?

    • kvaggelakos on said:

      The Nginx is used a proxy to route basically “route” the apps. Your DNS * needs to point to your dokku server. Nginx lies in the front proxying the request to the right application server. Example: User browses to –> –> Nginx on port 80, realizes it’s a request for app123 –> proxies to localhost:3000 (or whatever port it chose to run this particular app on).

      Looking into the source code, it seems Dokku is for Ubuntu or any distro with an apt based package manager. I base that on the way it installs the dependencies (using apt). Not sure how well it would work with any other similar distro, but given the recommendations in the documentation it seems your better off keeping to a specific Ubuntu version (13.04)

Leave a Reply

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