Heroku is a fully featured PaaS that provides a complete stack of "true" PaaS features. The following are some of the core features available in Heroku:
It enables flexible process control; scalable web and worker (type) processes (called dynos) run from a Procfile.
It allows a new process type to be defined such as web or worker type.
Process isolation—anything you store on your web process will be isolated from all other web processes.
Heroku even lets you run processes during the maintenance mode while serving the application users static page(s).
Configuration:
Heroku does not use property files or hardcoded configuration variables to read system or application-specific global parameters; instead, it uses configuration variables or environment variables.
Heroku prefers convenience over configuration, hence the configuration architecture is intentionally simplistic to use.
Effective releases:
Logging:
Security:
Real-time status:
Git-based deployment:
Heroku uses Git as the primary method to deploy apps. Git is a popular open source code revision control system that enables shared access to a managed source code environment.
While managing apps for the Heroku platform using Git, a developer can do the following:
Build and track the app
Create remote repositories of code
Deploy the application in multiple environments (development, staging)
Use other version control systems side by side and Git only for deployment
Polyglot platform:
Buildpacks:
Heroku's support for a language is enabled by creating a buildpack for that language. A buildpack is a set of scripts required to identify the source code language and provide instructions to build it into executable code. For example, the Ruby (https://github.com/heroku/heroku-buildpack-ruby) buildpack is one of the most commonly used buildpacks on Heroku.
Add-ons:
Heroku offers a growing number of add-ons via its add-on provider program. Additional services, such as error tracking, reporting, e-mail services, hosted NoSQL databases, and full-text search among others are available instantly via a few clicks or commands on the Heroku CLI prompt.
There is a provision to add and remove add-ons using the Heroku API.
The Heroku command-line tool (CLI):
The Heroku command-line tool is an interface to the Heroku web API. The tools provide an easy to use command-line interface to do things such as creating/renaming apps, running one-off processes, taking backups, and configuring add-ons.
This tool is usually installed with the toolbelt program. It also has a plugin architecture that allows developers to extend the functionality of the command as needed.
It is purposely kept similar to UNIX shell commands to reduce the learning curve for system administrators or users of the Heroku API.
A fully featured Platform API
Managed, multitenant architecture:
Now that we have a basic understanding of what Heroku is and what it has to offer for developers planning to build and deploy cloud-based apps, let us take Heroku for a quick test drive. You are going to love it.
There are a few prerequisites before you start using Heroku. You need to perform the following steps:
Get a Heroku account (https://www.heroku.com).
Install Heroku toolbelt client (https://toolbelt.heroku.com/).
Set up SSH for your user account.
An SSH key is an encrypted token that your machine and your Heroku account share to validate the authenticity of the user invoking a command on the Heroku platform.
In the next part, we will learn the actions required to set up a Heroku client on your local machine.
To start using Heroku, you will need to sign up for a Heroku account. The following screenshot shows the sign up page to create a new Heroku account:
Once you have entered an e-mail address, you need to validate your credentials by logging in to your e-mail account and verifying your account credentials for Heroku. Consider the following screenshot:
Once you validate your account credentials, you will be redirected to the Heroku password-setting page, where you need to enter a valid password and confirm it, as shown in the following screenshot:
After successful password confirmation, you will be redirected to the Heroku dashboard. Since you are a new user, it will not contain any deployed applications yet. Consider the following screenshot:
The Heroku toolbelt is the client software required to work with the Heroku platform. It can be downloaded from https://toolbelt.heroku.com/ for Windows, Debian/Ubuntu, Mac OS X, and standalone platforms. For our example, we will use the Windows version as shown in the following screenshot:
Install the Heroku toolbelt by double-clicking on the downloaded executable and following the instructions.
The Heroku toolbelt contains the following components:
Heroku client: This is the command-line tool to help create and manage apps.
Foreman: This is a utility to give you the flexibility of running applications locally, especially sometimes when you want to troubleshoot.
Git: This is the revision control system and relevant utility program that helps you push your code to Heroku or download it from remote repositories. You can also download a client specific Git UI to your operating system if you want a user interface to issue Git commands.
After installing the toolbelt, you can issue Heroku commands from the Heroku client command prompt. These commands (or code) are sent to the Heroku server and executed on the Heroku platform. However, Heroku needs to verify that the commands and code being sent to it are from an authentic user. Hence, you need to create a public/private key pair to push the code to Heroku.
Follow these steps to create the key and upload it to your Heroku account:
Generate the key on the local machine using the ssh-keygen tool (available at http://www.openssh.com/).
Add this key to the related Heroku account using the
keys:add
Heroku command.In order to add the key manually, consider the following figure:
You can log in to the Heroku dashboard (https://dashboard.heroku.com/account) and add the key manually too, as shown in the following screenshot:
In our example, we use the Heroku command-line interface to create the key and add it to the Heroku account. If you have previously uploaded an SSH key to Heroku, Heroku will assume that you will keep using it and will not prompt you to create a new one.