Deploy Buffalo Go App To Heroku

Apr 9th, 2017
1 min read

The last few weeks I’ve been really excited about leveling up in Golang due to a new web framework called Buffalo. It promises the speed of Rails development with the speed of Golang. Exactly what I’ve been looking for in future backend work.

One of my friends needed a simple web app built so I used that as an opportunity to test out Buffalo. In a future post I’ll be going in-depth into how I built the site. For now, I just want to document the deployment process.

I couldn’t find any deployment docs (project is still super new) but the creator of Buffalo, Mark Bates, was nice enough to help me get it set up on heroku. Here is the process of how I did it in case others are interested in deploying their Buffalo apps to heroku as well:


I’m assuming you already have your buffalo app built and functional.

Deploying Buffalo To Heroku

Create the heroku app with a special binary buildpack:

$ heroku create <App Name> --buildpack

Add path to our app binary:

$ heroku config:set PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/<APP NAME>/bin

Set go to production. This will use the production database settings in Buffalo, etc.

$ heroku config:set GO_ENV=production

Build the buffalo binary for linux and zip up assets. Output the binary and call it ‘heroku’:

GOOS=linux buffalo build -z -o bin/heroku

Create Procfile that will be run in heroku. We’ll use the new binary called ’heroku’ we just created:

// Procfile
web: bin/heroku

Push code up to heroku:

git add -A
git commit -m "Binary deployment"
git push heroku build:master --force

Run any database migrations:

heroku run bin/heroku migrate

Get heroku running:

heroku ps:scale web=1

Open up your new application!

heroku open


During this process I ran into a few issues. The sqlite3 package was preventing the buffalo build process to complete. To get around this I just deleted the file causing issues and everything chugged along smoothly.

$ rm ../../mattn/go-sqlite3/sqlite3_go18.go


As someone with very little Go experience I was quite pleased to be able to build the entire app and get it deployed in a weekend. Definitely going to continue using Buffalo in future projects!


Can I be honest? I want your email.

I love teaching and writing new content but sometimes find it hard to justify.

Getting your email motivates me to spend more time creating awesome content and notifies you when new posts or screencasts come out.

I will never share your email or spam. Expect less than 5 emails a year and feel free to unsubscribe at any time.