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!
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.
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.
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.
Next, DigitalOcean is creating your droplet.
You will then be dropped into the dashboard for your droplet, where you can see your droplet’s IP right here:
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”.
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.
Follow those instructions to add your Dokku remote (just like using Heroku!). Note where I changed the tutorial from
188.8.131.52. 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.
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:
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!
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 🙂