Heroku Platform
Today, we have a number of options for cloud web hosting services to run the apps. Heroku is one of them. Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. You can deploy, run and manage applications written in open languages and frameworks such as Ruby, Node.js, Java, etc. This product is based on AWS and is vastly different from the Elastic Compute Cloud (AWS).
Difference between AWS and Heroku:
- Concept:
- AWS requires you to take care of setting up your load balancer(s), installing the right software stack on your EC2 instances, configuring your databases, and so on.
- Heroku handles the infrastructure operations for you. So you don’t need to worry about the different components to build up your infrastructure (load balancers, machines, etc.).
- Service-owner:
- AWS- amazon.com.
- Heroku- salesforce.com
- Hosted On:
- AWS- Proprietary servers.
- Heroku- AWS servers
- Programming language support:
- AWS supports Ruby, Java, PHP, Python, Node.js, .NET, Go, Docker.
- Heroku supports Ruby, Java, PHP, Python, Node.js, Go, Scala, Clojure.
- Categories of clients:
- AWS – Startups, Medium Businesses, and Large Enterprises.
- Heroku – Freelancers, Startups, Medium Businesses, and Large Enterprises.
Heroku Advantages:
- Cost-efficiency (you are charged only for the number of resources you use)
- Provides plenty of assistance services
- Dynamic scaling
- Rapid testing and implementation of apps
- Emphasis on app development instead of supplementary tasks (maintain, upgrade, or support infrastructure)
- Allows easy migration to the hybrid model
- Integrated web services and databases
Heroku Disadvantages:
- Information is stored off-site, which is not appropriate for certain types of businesses.
- Though the model is cost-efficient, do not expect a low budget solution. A good set of services may be quite pricey.
- Lack of control over load balancing and scaling, that can lead to bottlenecks in the long run.
Heroku CLI and Deployment:
Run the following command on the terminal to install Heroku on your machine:
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
You can verify the installation by running the following command:
heroku --version
Login Into Heroku:
“heroku login” command is used to login into the Heroku. When you execute this command, you will be redirected to your browser after pressing any key on the prompt screen. After this, you will automatically log in.
Create Heroku application:
You can create your Heroku application by executing it:
heroku create
Deployment with git:
Many developers use git to manage source code versioning. The Heroku platform uses Git as the primary means for deploying applications (there are other ways to transport your source code to Heroku, including via an API). Before deploying your app to Heroku, you will have to initialize a local Git repository and commit your application code to it. To deploy your app to Heroku, type the following command:
git push heroku master
When you want to deploy your latest committed code to Heroku, you will always type the same command.
Command | Description |
---|---|
heroku create | Create heroku application |
heroku info | Describe your app information |
heroku open | Open you app in browser |
heroku ps | Show state of your app |
heroku logs | Show logs of your app |
heroku maintenance:on heroku maintenance:off |
On/Off Maintenance mode |
heroku db:pull heroku db:push |
Pull/Push the database |
Key Features:
- Ability to roll back your database or code in no time.
- Fully manageable runtime environment with smart containers (dynos) system.
- Consistent GitHub integration.
- Manual horizontal and vertical scaling.
- Onboard app monitoring system to keep track of metrics, like response time, throughput, memory, etc.
Heroku is the option for: | AWS is the option for: |
---|---|
Startups. | Those who have already worked with Amazon web products. |
You need to deploy and test a Minimum Viable Product. | You need infrastructure flexibility from the first deployment of your application. |
You can’t afford a DevOps engineer (or engineers). | You can afford a DevOps engineer or several DevOps engineers to manage the infrastructure. |
Those who prefer dealing with creating an app rather than devoting yourself to infrastructure mundane tasks. | Those who want to avoid numerous tasks related to app deployment. |
Your project doesn’t demand that many computational resources. | Your project requiring huge computing power. |
You need to improve your application quickly after getting feedback from users. | You’re ready to spend more time deploying new versions of your app. |