Update: Sept 2014

The experiment is over, and this dokku setup was too fragile to succeed. Links have been updated where possible to point to the code that remains (I'm still using bumble).

Original article

I've had a few people ask me to document how I set this site up so that they can spin up their own little slice of the internet. Here goes.

Write something

You'll need content first. Check out bumble and fireball for a dead-simple place to start. You'll want to keep your content in a git repo, it doesn't have to be on github but it's nice for a backup.

Get a server

Doi. Duh. You're gonna need a server out there on the internet to host your site at. I went with Digital Ocean because they came highly recommended to me by some coworkers, and they had a vm that had Dokku (and by extension Docker) on it by default.

So, go to Digital Ocean, and spin up a new droplet. I went with the smallest one due to the low traffic I expect here but choose what you think you'll need (For instance if you plan on running gitlab definitely go for at least 1GB of memory). One of the options is Select Image and this is where you click the Applications tab and choose the one that says Dokku

Make sure you add an ssh key for this (if you don't know how to make an ssh key I plan on covering that in another post).

Congratulations you now run a server on the Internet! Your droplet should have an IP, point your domain at it.

About Dokku

If you've ever used Heroku you already know how to use Dokku (mostly). It says it is a "Docker powered mini-Heroku" right in the readme, and it is! One requirement is that your site will needs to be in a git repo. One of the less well documented things in dokku is how to push to the main domain in a site instead of a subdomain. In the instructions it shows you how to add a remote to dokku@progriumapp.com:node-js-app which would respond to node-js-app.progriumapp.com. If you want your site to be at your root domain (i.e. no node-js-app) simply set the remote as dokku@yourdomain.com:yourdomain.com. If dokku sees a . in the remote path it treats it as a full domain rather than a subdomain. It may also help to set your remote to something easy to remember like blog. In my case I named my remote danger which means that to redeploy my site I simply have to type. Don't forget the Procfile!

$ git push danger master

Install dokku-apt

One of the requirements of fireball is a library called graphicsmagick. This is not on your droplet by default so you'll need a way to tell dokku to install it for your site. dokku-apt Is how you do that. Follow the instructions to install dokku-apt on your new droplet, then add an apt-packages file to the root of your site's folder with the word graphicsmagick in it.

Post post post

If you set things up right, you should be able to post

Example

If you want to check out a working example, you can check out the github repo for this very site here.

Extra credit

Technically there is no reason you should have to rebuild your dokku instance every time you push a new blog post. If you want you could try learning a few docker commands to point your dokku instance at a shared folder with your posts. Then you would simply need to update that folder w/ your new posts (maybe they're in a separate repo? maybe you scp them up?) and bumble/fireball's file watchers would automagically see them and add them to your site.

Follow up

Are you using bumble? Did this help? Did you get stuck cause I left some super crucial step out? Mash your keyboard and shout at @wraithgar.

Thanks

A huge hanks to bear for his help this weekend ironing out the kinks in this whole setup when I got stuck. And boy did I get stuck.

Also a big thanks to eric and philip for actually trying to follow the instructions in this post out. If it looks completely different now than the first time you read it, it's thanks to those two finding all the things I omitted.