This would mean I would get all the awesomeness of Node.js, it would be super-easy to deploy updates and I can have multiple Node.js apps 'easily'. A no-brainer right?!
So I set about moving everything, you are looking at the result right now!
Below is the culmination of my journey. I hope it helps others overcome a few hiccups I came across, and as always, let me know if you need any further help (@matt_hojo / firstname.lastname@example.org). Also; special thanks goes out to Robin Hawkes for some of his magical fixes.
- Signup for DigitalOcean (my referral link).
- Create a Dokku Droplet. Digital Ocean provide nice instructions for this https://www.digitalocean.com/community/articles/how-to-use-the-digitalocean-dokku-application (you only really need steps 1 & 2).
Super-easy, now it gets a little more technical.
Note: Throughout these instructions I reference
domain.com. This should be replaced for the domain that is pointing to your DigitalOcean Droplet.
Now you are all setup with a new shiny Dokku server, everything should be ready, but hold-your-horses. I had a few problems with the next step.
So 'by-the-book' you should now just be able to push up your Docpad project and everything will work as expected. Unfortunately, it's not quite that easy! You will need to follow a few more steps to be 'deploy' ready.
Upgrading Dokku and NPM
To upgrade your Dokku install run the following commands in your Terminal (via Dokku docs);
cd ~/dokku git pull origin master sudo make install
Note: I had some problems with the above instructions regarding Git conflicts. To resolve these, you simply need to Git reset the
~/dokku folder - don't worry, we will be re-setting the settings anyway!
cd ~/dokku git fetch --all git reset --hard origin/master git pull origin master sudo make install
After upgrading Dokku, you will then need to upgrade to the latest version of Node.js and
npm. This is all bundled inside the
buildstep install, so to upgrade you can do the following (via Dokku docs);
git clone https://github.com/progrium/buildstep.git cd buildstep git pull origin master sudo make build
This will have upgraded everything, now it's time to set all the settings back up.
Setting the settings back up
To re-set your Dokku Public Key, simply run the following command from your Terminal;
cat ~/.ssh/id_rsa.pub | ssh email@example.com "sudo sshcommand acl-add dokku personal"
Setting up DocPad
I won't go into too much detail with the actual DocPad site building as they have some brilliant documentation already over at http://docpad.org/docs/start.
Once you have setup everything in DocPad and you feel you are ready to 'deploy', it's time to move onto the next stage.
There is not too much preparation before we 'push up' everything, but we need to do a little for Dokku.
So the next thing you need to do is create a
Procfile in the root of your project, the contents should read;
This will simply tell Dokku what to do once you have 'deployed' - this above line runs DocPad.
You should now be all set for 'deployment'!
In your DocPad project run the following;
git remote add dokku firstname.lastname@example.org:domain.com
This will add a
dokku 'remote' to your Git setup.
Note: The double
domain.com:domain.com is so the project is the root Dokku app. Other apps just need a name and not a domain name. E.g
git remote add dokku email@example.com:test-app will be accessible via
http://test-app.domain.com. See ref.
Now your are ready to 'deploy' - congratulations!
git push dokku master
Now for every change you make to your project, simply commit the changes and 'deploy' the changes with
git push dokku master. Simples.
If you have any any further questions feel free to ping me at @matt_hojo, or firstname.lastname@example.org.