A lot of things have changed in the Buffalo ecosystem since my last post on how to deploy to Heroku from Gitlab.
Indeed, everything has changed since I posted how to deploy from gitlab repo into Heroku with the birth of the buffalo-heroku plugin. In this post I will try and describe how to use it to deploy your buffalo app to Heroku.
First thing you need to install (or ensure you have) is buffalo-plugins plugin. If you’re on buffalo v0.14.6 or higher you’re all set. If you’re on an older version you should:
- Move to your project root folder
- Download and install buffalo-plugins plugin
$ GO111MODULE=off go get -u github.com/gobuffalo/buffalo-plugins
- Init your application plugins (just in case):
$ buffalo plugins init
You may notice that a config folder has been added to your codebase, this will hold plugin information for your app.
Installing buffalo-heroku plugin
Then you will need to install
buffalo-heroku plugin which (assuming you’re still in your application root folder) you can do by:
$ buffalo plugins add github.com/gobuffalo/buffalo-heroku
Once that passes successfully we’re all set to start deploying your app. You can check if your installation is ok by running:
$ buffalo heroku -h
Buffalo-heroku plugin provides very cool commands that I invite you to take a look at, for now I will concentrate in the details for you to deploy that app.
Buffalo-Heroku uses some files in your repo to deploy your app, to create those files you should run:
$ buffalo heroku config
This will update your project with configuration files for deployment:
- Will create a heroku.yml file.
- Will ensure you have a Dockerfile (Will create it for you if you don’t have it)
Creating the Heroku app
One of the coolest commands in the buffalo-heroku plugin is the new command, it allows you to create new apps with a bunch of configuration options.
We will create your app by running:
$ buffalo heroku new -a name-of-your-app
Once the app is created this will do your first deployment.
Now that your app is all set with Heroku, you should be able to deploy your app at any time you need by just running:
$ buffalo heroku deploy
Very simple right? Now that you’ve set up your app and deployed you can get back to what we all love. Building actual apps with Go and Buffalo :).
- More on heroku.yml file
- Buffalo plugins and plugin system (in the Buffalo repo)
- Buffalo documentation
Thanks for reading until here. If you’re interested in application development, my company Wawandco can help you building quality web and mobile applications. You can check what we have been up to in our dribbble posts, our Twitter or LinkedIn profiles. Stay tuned.