Hey, I’m Parker.

Creator of music, photography, and (mostly open) software.

Fixing Memory Issues in Dokku Hosted on DigitalOcean 512MB Droplet

As many other Heroku customers, I rejoiced when Dokku was released. To have complete freedom to host as many apps with whatever databases or other plugins I wanted -- all for the cost of a small VM -- was wonderful news.

I decided, for cost's sake, to boot up one of those famed $5 DigitalOcean Droplets. I didn't see that DigitalOcean provides an "app" for Dokku, so I created a vanilla box of Ubuntu 13.04 and pressed on. I got everything up and running and went to go deploy my first app, only to see this when I ran git push:

runtime: panic before malloc heap initialized
fatal error: runtime: cannot allocate heap metadata

Well, golly, that sure is unhelpful. Looks like 512MB doesn't cut it. Luckily, we can avoid paying the extra $5/mo for the 1GB version by running the following as root:

dd if=/dev/zero of=/extraswap bs=1M count=512
mkswap /extraswap

Then adding the following to your /etc/fstab file so the swap persists between reboots:

/extraswap none swap sw 0 0

Then run this to enable /extraswap for swapping:

swapon -a

Boom. Now re-run git push and you're in business. Magic!

Credit goes to the brilliant @dhassler for the idea and the code. Just thought I'd share and preserve for my own benefit in the future.