What is Docker?
It’s a way to put your linux applications into their own containers on the same machine or across a network. It’s not the same thing as a VM. It’s far more efficient and your friends will be envious of your dev ops skills.
What is Dokku?
It’s a poor man’s Heroku written in about 100 lines of BASH. You can run it yourself on a $5 digital ocean instance. Unlike Heroku, you have more control over things. After all, it’s your machine. Want to run a background worker? Need an extra cron job? No problem.
Key Features
- “Push to deploy” simplicity that automatically detects the kind of app you are working on.
- Supports tons of “buildpacks” or plugins that auto configure your app based on the framework you are using. Rails support is fantastic.
- It has an awesome ecosystem of ‘host it yourself’ plugins and modules for things like Postgres, MongoDB, Redis, RabbitMQ and all that other stuff the cool kids use.
I’m Sold!
- Setup a domain.
Make an A record that points to the digital ocean IP.
test.rickcarlino.com
points to162.243.253.93
in my case. - Image your Digital Ocean box to use Dokku.Ā It requires UbuntuĀ andĀ DigitalOceanĀ has a Dokku image you can use by default.
- Visit the URL of your DigitalOcean machine. Paste your SSH public key into the text box found on the server. MAC USERS: Use this to load it in clipboard:
pbcopy < ~/.ssh/id_rsa.pub
. - Select “Use Virtual Naming for Apps”. If you are frugalĀ and want to run all of your apps off of one box.Ā You will want 1GB of RAM minimum- trust me. Name your default app something like 00default to forgo the need to subdomain your default app.
git remote add dokkuĀ dokku@DOMAIN_NAME_HERE:APP_NAME_HERE**
inside your app’s git repogit push dokkuĀ master
Noteworthy Plugins:
Cheat Sheet
docker ps
: Shows running processes and their status.docker kill <container ID>
: I’ll give you three guessesdokku config:set <app> NAME=value
ordokku config:get : Lets you set ENV['SECRETS']
in your app. Useful for open source apps that run in the wild.docker logs
: Because sometimes production breaks.dokku help
: A quick overview of all the commands you will ever need (~10).