To understand this better, let us have a look at what Heroku exactly is?
Heroku is a PAAS, based on AWS(IAAS), which provides a ready runtime environment and servers which eventually benefit development and DevOps teams for seamless integration to different development tools.
When a user pushes the code to Heroku application, a virtual machine called slug is created and the instance launched from this virtual machine is called dyno. The Heroku App is totally built on dynos which are lightweight Linux containers. The high-level view of how Heroku host your application looks like this:
Hence, when you push your code to Heroku container, it converts it into a slug and autoruns all your migrations and scripts and your application is hosted.
Heroku provides support to Python, Ruby, Java, Kotlin, Go, Scala and many more languages. It also provides the facility to add a database to your application where Postgres is one of the free add-ons which you can directly add from Heroku dashboard.
Adding a Postgres database to your application is as easy as running this command in your Heroku CLI:
$ heroku addons: create
Or, you can directly add the Postgres from Heroku dashboard by clicking on ‘Configure Add-ons’ under your Heroku project overview.
And as we all know, there are some applications where database security is way too important, in that case, Heroku also provides the flexibility to point to the external database. You can directly point to your database from Heroku application.
The Heroku application only needs the resource URL of your service and the related addOns like Postgres for the database. And it works something like this :
Heroku also provides the facility to add config variables and change the way your app behaves.
Now, why hosting your application on Heroku is easiest of all?
First, Heroku provides a pre-installed operating system and servers hence, it eliminates the need to configure the infrastructure and therefore, even a person who is new to the Heroku cloud platform can easily get a hold on deployment without worrying about the hassles of infrastructure management.
Secondly, the user can easily select the subscription plan according to its own need, and Heroku is a pay-what-you-use, per the second basis, product. Hence, if your client needs to suddenly have a large amount of cached data, simply add Redis to your plan and you are good to go.
In one of the products of HashedIn, the end users of the application were from different domains hence, the project was supposed to be hosted in such a way that deliverables can be switched based on the user’s demand and with Heroku, it was an easy task. Since the application had a multi-tenant architecture, therefore for some of the users HTTP traffic was a concern and for others, app health and statistics was a major concern. With Heroku, we managed to deliver this with ease.
If the user is facing heavy HTTP Traffic in its application, simply scale the dynos in your application by executing the following command in your CLI and specify the number of instances and you are sorted.
$ heroku ps: scale web=3
This will scale your application to have 3 web dynos.
So, you must be wondering how to deploy your application. Well, deploying your application on Heroku is a 5 step task :
- Create a personal app:
- Login to Heroku
- Under personal apps, click on create a new app
- Choose personal app under team drop down and add app name
- Click on create an app
2) Install Heroku
- sudo add-apt-repository “deb https://cli-assets.heroku.com/branches/stable/apt ./”
- curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add –
- sudo apt-get update
- sudo apt-get install Heroku
3) Login to Heroku using: Heroku login
4) Create a Heroku directory in local
- git remote add Heroku your_heroku_repo_url
- git remote -v This should have two remotes origin pointing to your git and Heroku pointing to your Heroku repository
5) To deploy your application
- git push heroku master: this will deploy your code on Heroku
You can view the deployed application by running the command: Heroku open
Note: These commands are Ubuntu specific but you can find the steps for other operating systems on the internet easily.
Yes, this is it and hence you can put all your efforts into development and Heroku will take care of deployment. Most of the software requires you to set up infrastructure, provision them, configure them, but with Heroku, all this can be added with a click on Heroku dashboard or through Heroku CLI.
Some of the features which Heroku provide are capacity provisioning, database rollback, application rollback, manual vertical and horizontal scaling, app health monitoring, and full GitHub integration. Scaling your performance is just a matter of adding more of the so-called dynos.
Heroku provides Add-ons for all your needs. You name it, they have it. Some of my favorites add-ons are Redis Heroku Postgres and Redis Cloud for database storage, Heroku Connect for data store synchronization, StillAlive and AppDynamics for monitoring your web application and resolve performance issues , whereas followAnalytics for monitoring your mobile application to capture all the analytic metrics and user engagement, Sumo Logic to log real-time metrics, SendGrid and Mailgun for email services , RabbitMQ and IronWorker for messaging and queuing your tasks, AuthO for user management , Heroku private spaces for security, Heroku Scheduler for scheduling any task which you want to run on a regular basis and many more like this.
Heroku Postgres and dyno are some of the free add-ons whereas add-ons like Heroku Scheduler, SendGrid falls under free trial limit under billing account.
The typical dyno categories can be referred in this diagram :
How Heroku plays a major role in product delivery lifecycle :
Fast and easy deployment – Deliver the product from the first week by deploying early and hence, getting continuous feedback of both performance and look-n-feel of the product. With Github integration, deployment and early testing is a major benefit.
Team Management– It is easy to manage the team with Heroku’s app-level permissions and collaboration tools with centralized billing.
Great developer experience– With deployment on Heroku, it helps the developers to focus more on development without worrying about managing servers. For eg: if a new version is coming, the developer simply needs to push the code to Heroku and it will automatically restart its dynos. With Heroku, it is never a thing of concern about software installation and updates.
Visualization to stakeholders – With Heroku, business users and stakeholders are able to access the app metrics, analysis, and reports.
Easy client transition – if a client wants to take over the maintenance and evolution of their app, Heroku’s ease-of-use makes it simple to onboard and train their in-house team on the app’s Heroku environment, code, and operation processes.
Easy Salesforce integration – CRM integration is one of the major concerns today, but with Heroku Connect, we can easily connect with Salesforce using its simple interface which automatically synchronizes the Salesforce data to our Postgres database.
Now, you must be wondering if Heroku is this easy to use, why isn’t everyone using Heroku then? There are multiple reasons. One is cost. As you get all the platform and software as a service, you also pay for that. But then Heroku also has a range of services which falls under its free trier plan.
One other disadvantage is the read-only file system which makes it difficult to handle bulky file uploads such as videos or high-resolution images. But, that can be easily overcome using Amazon S3 or something similar. I would suggest you use Heroku if rapid application development is your highest priority.