The Ultimate Digitalocean Dokku Deploy Guide (Rails & other environemnts).

Introduction

Hey everybody! Today, i want to share a guide i made on how to setup a Droplet on Digitalocean and also how to push your Rails project unto it.

Step 1: Sign up on Digitalocean and create a new Droplet

In order to be able to follow this guide, you need an Digitalocean account (which is free) and a droplet. The most cheapest droplet you can get is the one for 5$ per month. Don’t worry, you can’t cancel your droplet on a monthly base, so with that you will pay at most 5$. From my experience, if you cancel your droplet after, let’s say, 2 days after you have deployed it, you will be only charged the amount it was online, so much less than the 5$. The 5$ will be in this case on your credit and can be used for another droplet you might create.

Here is a promo code from me, where you get some extra credits completely for free: https://m.do.co/c/b09b8801db13

After you have signed up, you can create a new droplet by clicking on “Create” in the Navbar and then choose “Droplets”

cat ~/.ssh/id_rsa.pub

Very important: It will take a while until you will be able to visit your droplet via the given ip4v address. It can take up to 30 minutes or even longer.

Once you are able to visit your Droplet via ip4v address, you will see this (i didn’t took a screenshot from my ssh key, as it allows any one to access my droplet. Never share it!)

Step 2. Adding your GitHub repo to your newly created fresh droplet.

So your Droplet is now ready to go. You can sign in to your droplet by opening your terminal and typing in:

dokku apps:create a_name_for_your_app
dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create railsdatabase
dokku postgres:link railsdatabase a_name_for_your_app
git remote add app_name dokku@your_ip4v_address:app_name
git push app_name master
dokku domains:report
dokku domains:add app_name test

Yiha, you made it!

Hint: Once you got it all down, you can always delete your Droplet, so that you don’t have to pay for it further.

Simply go to your dashboard and click on the … dropdown and choose “Destroy”:

Coding Stuff