So just what is Heroku? It’s a service for developers eager to get their applications online without having to worry about infrastructure details.
Metered, pay-as-you-go Cloud Computing services come in all kinds of flavors. Infrastructure as a Service (IaaS) offerings like AWS allow enterprises to shift their entire operations away from traditional data centers. The downside is that you’ll have to manage networking and provisioning yourself. On the other hand, Platform as a Service (PaaS) providers like Heroku, offer abstracted environments into which developers can simply drop their code and let the platform take care of the provisioning details. You’ll give up some control, but gain simplicity and speed in exchange.
Heroku itself, by the way, is built entirely on AWS cloud servers.
It uses Git (a distributed version control system for code management) to manage application deployments. All you’ll need to do to deploy your application on Heroku is push your Git repository to their servers.
What is Heroku and why are its application deployments so simple
- Runs your application across a preset number of virtual servers.
- Manages releases by rolling out your application to different environments.
- Ensures your application automatically recovers from server failures.
- Handles load balancing across many application instances, allowing you to instantly scale your application to support millions of users.
- Allows you to quickly add and remove infrastructure blocks like caching servers and database servers.
Heroku supports the Ruby, Node.js, Python, Java, Go, PHP, and Scala programming languages. This provides easy deployment of existing technologies on Heroku with minimum modifications needed.
Building Blocks of Heroku
Dynos, like AWS instances or Azure virtual machines, are individual virtual servers built on Ubuntu images. If your application runs on Ubuntu, it’ll be fine on Heroku. There are three types:
- Web dynos: web instances running HTTP services.
- Worker dynos: instances launched to process asynchronous jobs.
- One-off dynos: temporary instances that can be loaded with your latest code release and run detached, or with their input/output attached to your local terminal. They can be used to handle administrative tasks like database migrations.
As of now, you can choose from these dyno sizes:
Heroku is particularly well known for being able to instantly scale the number of dynos up or down, but they also provide automated load balancing for incoming HTTP requests and failover between hosts. You don’t even have to know there was a problem.
Heroku supports a very large collection of third-party add-ons for users to instantly provision as attachable resources for their applications. Provisioning an add-on (the Papertrail application logger, in this case) is no more complicated than running a single command from your command line interface (CLI):
heroku addons:create papertrail
Each time you add an add-on to one of your applications, your application will automatically be assigned one or more environment variables, which specify any credentials you may need to interact with your new tool. In the case of Papertrail, you will have full access to your logs through the Heroku apps web interface.
Heroku database service
Heroku PostgreSQL, Heroku’s hosted, vertically scalable, database service that’s available in the cloud or on your local workstation, is similarly provisioned using:
heroku addons:create heroku-postgresql
But of course, being a database, the Heroku PostgreSQL is significantly more complicated to configure.
Heroku also offers High Availability and Automatic Failover with its DB.
Heroku architectural principles
Based on Heroku founder Adam Wiggen’s Twelve Factor App, you should ideally keep these considerations in mind when designing your Heroku deployments (or, for that matter, any deployments):
- Version control and store your application in Git.
- Declare and isolate dependencies.
- Store your application configuration profile data in environment variables.
- Design infrastructure elements to work as attachable modular resources.
- Separate your build and run stages.
- Design your application to be stateless so it can be easily reused.
- Export services via port bindings
- Scale-out your application using concurrency
- Keep your development, staging, and production images as similar as possible.
- Think of your logs as event streams.
- Run admin processes as one-off tasks.
How Heroku Pricing Works
One of the benefits of using a cloud provider like Heroku in the first place is that you pay only for what you use. In the case of Heroku, since they bill in increments of seconds, that’s pretty much exactly what you use.
Create your own free Heroku account. You will get 512 MB RAM, 1 web/1 worker, which is enough to get started deploying prototype applications.
We’ll work with a Rails application. Refer to this link for help setting up Rails on your workstation.
Download and install the Heroku ToolKit. This will create a local Heroku CLI client for creating and managing your Heroku applications and Git.
Login using the email and password you used for your Heroku account:
Clone your application from git:
Now create an application on Heroku that will receive your Git source code:
Once complete, push your code:
git push "heroku master"
Each Heroku application is assigned a unique URL that automatically routes incoming HTTP requests to your application. Get your application using:
New on Cloud Academy: Red Hat, Agile, OWASP Labs, Amazon SageMaker Lab, Linux Command Line Lab, SQL, Git Labs, Scrum Master, Azure Architects Lab, and Much More
Happy New Year! We hope you're ready to kick your training in overdrive in 2020 because we have a ton of new content for you. Not only do we have a bunch of new courses, hands-on labs, and lab challenges on AWS, Azure, and Google Cloud, but we also have three new courses on Red Hat, th...
Azure Security: Best Practices You Need to Know
When it comes to Azure Security best practices, where do you begin? In a lot of ways, Azure is very similar to any other data center. But with that said, Azure can also be very different. Securing Azure can pose many unique challenges. The security of resources hosted in Azure is of the...
Google Cloud Platform Certification: Preparation and Prerequisites
Google Cloud Platform (GCP) has evolved from being a niche player to a serious competitor to Amazon Web Services and Microsoft Azure. In 2019, research firm Gartner placed Google in the Leaders quadrant in its Magic Quadrant for Cloud Infrastructure as a Service for the second consecuti...
New Lab Challenges: Push Your Skills to the Next Level
Build hands-on experience using real accounts on AWS, Azure, Google Cloud Platform, and more Meaningful cloud skills require more than book knowledge. Hands-on experience is required to translate knowledge into real-world results. We see this time and time again in studies about how pe...
New on Cloud Academy: AWS Solution Architect Lab Challenge, Azure Hands-on Labs, Foundation Certificate in Cyber Security, and Much More
Now that Thanksgiving is over and the craziness of Black Friday has died down, it's now time for the busiest season of the year. Whether you're a last-minute shopper or you already have your shopping done, the holidays bring so much more excitement than any other time of year. Since our...
Understanding Enterprise Cloud Migration
What is enterprise cloud migration? Cloud migration is about moving your data, applications, and even infrastructure from your on-premises computers or infrastructure to a virtual pool of on-demand, shared resources that offer compute, storage, and network services at scale. Why d...
Kubernetes Services: AWS vs. Azure vs. Google Cloud
Kubernetes is a popular open-source container orchestration platform that allows us to deploy and manage multi-container applications at scale. Businesses are rapidly adopting this revolutionary technology to modernize their applications. Cloud service providers — such as Amazon Web Ser...
New on Cloud Academy: AZ-900 Exam Update; MS-100 Exam Prep; PRINCE2 Foundation; Azure, Kubernetes, and Google Hands-on Labs; and Much More
This month, our Content Team really kicked it into overdrive with tons of new content. If you're Team Azure, then you'll be amazed at the number of Azure Courses and Hands-on Labs we published this month alone! At any time, you can find all of our new releases by going to our Training ...
How to Get Hands-on Experience on AWS, Azure, and GCP: Lab Challenges
Meaningful cloud skills require more than book knowledge. Hands-on experience is required to translate knowledge into real-world results. We see this time and time again in studies about how kids and adults best learn — doing the actual learning task is key. Hands-on Labs and Lab Challe...
Which Certifications Should I Get?
As we mentioned in an earlier post, the old AWS slogan, “Cloud is the new normal” is indeed a reality today. Really, cloud has been the new normal for a while now and getting credentials has become an increasingly effective way to quickly showcase your abilities to recruiters and compan...
New on Cloud Academy: ITIL® 4, Microsoft 365 Tenant, Jenkins, TOGAF® 9.1, and more
At Cloud Academy, we're always striving to make improvements to our training platform. Based on your feedback, we released some new features to help make it easier for you to continue studying. These new features allow you to: Remove content from “Continue Studying” section Disc...
Cloud Migration Risks & Benefits
If you’re like most businesses, you already have at least one workload running in the cloud. However, that doesn’t mean that cloud migration is right for everyone. While cloud environments are generally scalable, reliable, and highly available, those won’t be the only considerations dri...