Deploying Applications for Free on Heroku
Here am going to show you a proper and easy way to deploy Node.js, Ruby, Java, Python, Clojure, Scala, Go, PHP, and other applications on HEROKU with great ease.
What is Heroku?
Heroku is a cloud platform that lets developers build, deliver, monitor, and scale apps, bypassing all those infrastructure headaches.
Heroku is a Cloud Service platform that allows us to deploy, run and manage Node.js, Ruby, Java, Python, Clojure, Scala, Go, PHP, and other applications.
All Heroku applications run in a collection of lightweight Linux containers called dynos. Dynos are fundamental pieces of the Heroku architecture model that provide computing processing on the platform.
How to deploy on Heroku?
You all need to follow these 3 steps to deploy your app
Prerequisites
- You must have a Heroku account — click here
- Must download and install the Heroku CLI ( if you want to deploy through Heroku CLI )
Step 1 : Create an app on Heroku
- Go to your dashboard — click here
- Click on create a new app
- Enter App name and select region
- Create a pipeline if required ( Not Mandatory )
- Finally, click on Create App
Step 2 : Add code to Heroku
You can add code in the following ways
- Connect to Github and select the repository
- Can use Heroku Git (check prerequisites)
If you haven’t already, log in to your Heroku account and follow the prompts to create a new SSH public key.
$ heroku login
Create a new Git repository and Initialize a git repository in a new or existing directory
$ cd my-project/
$ git init
$ heroku git:remote -a heroku-app-te
Commit your code to the repository and deploy it to Heroku using Git.
$ git add .
$ git commit -am "make it better"
$ git push heroku master
For existing repositories, simply add the heroku
remote
$ heroku git:remote -a heroku-app-te
Step 3 : Deploying the code
When you connect the repository via GitHub
Select the GitHub branch which you want to deploy. This will deploy the current state of the branch you specify. Learn more.
Then, click on Deploy Branch
Then the deployment will start
You can also see the logs here
After completing all the processes the app will be deployed Successfully
Step 4 : Enable automatic deploys from GitHub
Choose the branch and click on Enable Automatic Deploys
Step 5 : Adding Config Vars on Heroku
Config vars change the way your app behaves. In addition to creating your own, some add-ons come with their own.
To add
- Go to settings
- Click on Reveal Config Vars
- Then provide a KEY and a VALUE and click on add
Note: After adding all the Config Variables you need to redeploy the app to see the effective changes ( if the APP is not deployed )
Step 6 : Other Configurations
- Can add SSL Certificates
- Can add Buildpacks
- Can add Domain
- Have options of Transfer Ownership
- Have options of Maintenance Mode
- Can also add an Add-ons link to ClearDB MySQL, Airbrake Error Monitoring, and many more.
- Can also change Dyno Type
Conclusion
By following the step by step you can deploy, run and manage applications on Heroku very easily.