Setting up Dokku on Digital Ocean
Dokku is a self-hosted alternative to Heroku. It is incredibly stable, supports most of the deployment types that Heroku does, and it's fully open source! Additionally, DigitalOcean makes it super simple to get started with Dokku.
Please note, this is a supplementary guide to the Indie DevOps series.
Provisioning The Server
We are going to use DigitalOcean for this guide. If you want to use another VPS provider, you can follow the official Dokku install guide. Keep in mind the VPS you use must allow and support Docker (a lot of OpenVZ based VPSs do not).
In DigitalOcean, create a new server. Make sure to select the Dokku One-Click installer in the first step:
Then select a plan. In this case, we will go with the cheapest $5 plan and we can scale up the server as needed.
Then select a datacenter, leave the default VPC, enable monitoring, and add an SSH key for authentication. You will need to have a valid SSH key, you can't just use the password option. To set up SSH keys, you can follow this guide.
Finally, put a name (such as "webserver"), and select if you want backups or not. In case something goes seriously wrong, you can use these backups to re-provision a new server with all of your data and have a new copy running within a few minutes.
Setting Up Dokku
Once your server is created, head over to the IP address in your browser and you should see a Dokku set up screen. If not, you may have to wait a few more minutes. Once it loads, it should be prefilled with your SSH public key. You should leave that as is, and configure a hostname. If you have a domain name available, you can also create an
A record that points to this IP. Make sure to also check the "Use virtualhost naming for apps" option if you are using a subdomain.
Once you click finish, you should be good to go!
Check out the Indie DevOps series to see how you can use Dokku to manage different parts of your stack.