How To Deploy A Dokku Static Site
Dokku seems ideal for pushing static sites and small API's to. Rather
then deploying a (reatively)large VM for such small instances.
Saying that it wasn't as simple as 1,2,3. I followed this useful guide
to start with,
Update May 2016
It's now much simpler to ship a static site with Dokku. There is now out of the box support for static sites. All that is required is an empty
.static file in the root of your project. This will download and compile nginx and serve any file from the repository. It uses the Dokku nginx buildpack. You now don't even need to put the website files in a
I prefer to place the files inside a
www folder so that I'm able to have
READMEs and other bits of information or assets related to the project that won't get served. Your mileage may vary.
< /Update >
First issue: pushing to dokku.
fatal: 'test' does not appear to be a git repository fatal: Could not read from remote repository.
Dokku needed a password for SSH access, the git remote config was
changed to firstname.lastname@example.org causing this issue. Seeing as I'm using
DigitalOcean I have no passwords on the accounts. The fix was to add my
public key to dokku with the following command.
cat ~/.ssh/id_rsa.pub | ssh email@example.com "sudo sshcommand acl-add dokku your_tag"
Second Issue: Buildpacks and ENV variables
Second issue is that Dokku didn't have a way of interpreting what we wanted it to do, serve static files.
So I needed to install a dokku package
Then run this as a buildpack
ssh firstname.lastname@example.org config:set app_name BUILDPACK_URL=https://github.com/aaron524/dokku-buildpack-nginx
Then create a
_static.cfg file in your repo and specify the server type - I chose nginx. Push again and the site should work
If you want a free box for a month feel free to use my referal