Because a basic VPS at Digital Ocean costs $5 a month. And you can host as many apps as you want. An nginx serves as a proxy for your apps.
Now you don't have to install Dokku yourself anymore. There's a pre-configured Dokku image available on Digital Ocean, that you can spin up with just a few clicks...
Create a fresh Ubuntu 13.04 x64 VM. Use the desired domain as hostname
Set up the domain to point to the new VM's IP.
Set up a ~/.ssh/config for the key you want to use on the server.
Host <host alias> User dokku Hostname example.com PreferredAuthentications publickey,password IdentityFile /Users/<your username>/.ssh/id_rsa RequestTTY yes
Now you don't have to type the user and full domain when pushing or specify which key to use (if you have multiple) in later ssh and git commands.
You can't use RequestTTY in OpenSSH versions older than 5.8. (e.g. On MacOS < 10.9). You should instead execute ssh with the
Upload your public key for easy installation from the cloud.
curl -s ssh.keychain.io/<your email>/<key identifier>/upload | bash
SSH into the VM.
ssh root@<host alias>And enter the root pw.
Install your key.
curl -s ssh.keychain.io/<your email>/<key identifier>/install | bash
wget -qO- https://raw.github.com/progrium/dokku/v0.2.1/bootstrap.sh | sudo DOKKU_TAG=v0.2.1 bash
This also creates a user called dokku.
su - dokkuwhen logged in as root to drop down to normal privileges.
Make sure your domain is in
/home/dokku/VHOST. Remove localhost entry if present.
Set up the command to be executed when 'dokku' user connects with ssh (e.g.while pushing to the server.)
cat ~/.ssh/id_rsa.pub | ssh root@<host alias> "sudo sshcommand acl-add dokku <your username>"
(username is not being used so far.)
Add the remote to your working copy.
git remote add <remote name> <host alias>:app
When pushing this will result in an app at app.example.com. You can force an different subdomain with git remote add deploy <host alias>:app.example.com (or none).
git push <remote name> master
Your app is uploaded and installed.
To push a specific branch use git push <remote name> <branch name>:master
You can execute dokku commands from your local shell.
ssh <host alias> help
Just replace help with the dokku command, e.g. to set environment variables:
ssh <host alias> config:set <app> KEY1=VALUE1 [KEY2=VALUE2 …]
The app is restarted with the new settings.
The variables are stored in /home/dokku/xtc/ENV.
You should execute ssh with the
-toption if you don't have RequestTTY yes in your ssh config.
- The friendly dokku devs at #dokku on freenode IRC.