Brief about Heroku:
is a cloud platform service which had founded in 2007 to support several programming languages. The beneficial aspect of the Heroku is you don’t need to worry about an infrastructure, so the focus would be your application only. Here I have listed some features of Heroku:
Heroku + Git push = Instant deployment
Various Add-on are available.
Processes scaling – for each and every individual component without any disturbance to other components of your application.
Every process is completely different from any other.
Access permits to all logging output from every component of any application and any process.
Setting up Heroku
The first step to deploy Heroku is, you will need a Heroku user account and command line client. To have this both details you need to add Heroku Toolbelt.
Once Heroku has installed, sign up to the Heroku account and login using Heroku username and password. Once you have logged in, you are able to upload your SSH key. Now all is set and can deploy the Heroku.
Deploying to Heroku
You can easily set up the Heroku-Toolbelt correctly and the repo of the Heroku managed by Git. Step of deploying the Heroku: you can deploy it by changing a little code in the code which is available for deploying.
Applications that required:
Git add- A
Git commit – m ‘first heroku go app’
File required: procfile.
procfile required to tell Heroku that the command it needs to run the web process is our app. To add the file, run below code:
1. echo ‘web: gogreeter’ > Procfile
Need to add Godeppackages:
For installing Godep and save your dependencies with the following code,
Go get github.com/kr/godep
Now add below files to Git:
git commit –m ‘godep’
Now, Heroku is ready to create an application. To create an application follow the step as below:
1. Heroku create -b https://github.com/kr/heroku-buildpack-go.git
The above code will create a Git remote in your repository with the name Heroku. After that you can start deploying. Write below code and it’s done.
git push Heroku master
At last visit the URL by which you can see on console to say Heroku is open now. And now Go application is ready to run on Heroku.
Here I have shown you how you can create a simple Go application and how you deploy Heroku to run an application.