Skip to main content

Deploy to Heroku

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain why Heroku is a suitable platform for web application hosting.
  • Set up essential tools and accounts for Heroku deployment.
  • Deploy applications to Heroku.
  • Choose a runtime and region suitable for your security and data privacy needs.

Why Choose the Heroku Platform

Heroku is a platform as a service (PaaS) that allows developers to deploy, manage, and scale web applications in the cloud. The platform simplifies web app deployment with quick commands, eliminating traditional infrastructure hassles. It offers scalable solutions with a diverse range of tools and add-ons. And it manages the underlying infrastructure, and seamlessly integrates with version control systems like Git for continuous deployment.

Ursa Major Solar, Inc., a company specializing in solar technology, is venturing into new customer engagement strategies. The CEO assigned Wei Leung, a skilled developer, with a challenging task. Wei must create a web application that simplifies the quote process for Ursa Major’s latest solar panel model. The idea is to have potential customers answer questions about their homes to receive a detailed, HTML-formatted quote via email. This approach streamlines the customer experience, making it more interactive and responsive.

Understanding the importance and potential scalability of this project, Wei chooses Heroku for hosting the application. Heroku’s elastic nature allows apps to scale efficiently in response to varying loads. This feature is crucial for Ursa Major, as the company anticipates growth and increased demand.

Wei and her team are already familiar with Node.js and know it’s highly scalable for IO-heavy applications. There’s also strong support for event-driven and real-time workflows. These characteristics are important for Ursa Major’s app so that potential customers can get quotes quickly. She decides to create a Node.js app running on Heroku.

[Alt text: Architecture diagram showing a customer requesting a quote from an app that sends them an email with the generated quote.]

Wei, understanding the urgency, dives into the development of the initial version of the application to meet the first requirement. Now it’s time to work on the app!

Set Up for Heroku

After some time, Wei’s team is ready to start testing how the new app behaves on Heroku. Before Wei can deploy any code, she must first set up her environment. These are the prerequisites for deploying Node.js applications to Heroku.

We recommend using an integrated development environment (IDE) that you’re familiar with for the project. We use VS Code in this badge because it integrates with several terminals and is the most common IDE for Salesforce developers.

After installing the tools and verifying her Heroku account, Wei is ready to deploy.

Step-by-Step Deployment

Note

There’s no playground for using Heroku for Trailhead. If you want to follow along with Wei step by step, we recommend using our low-cost plans. Eligible students can apply for platform credits through our Heroku for GitHub Students program.

Wei’s team is ready to deploy version 1.0 of Ursa Major’s web application.

After pushing her code with git push heroku main, Wei’s Ursa Major app is now available for prospective customers to use.

Regions and Runtimes

Wei holds a detailed meeting with Ursa Major’s security team to discuss the app’s essential data privacy requirements. They consider the two types of runtimes offered by Heroku: Common Runtime and Private Spaces.

Common Runtime runs and manages dynos, lightweight Linux containers, in multitenant networks. There is a single multitenant network per region, meaning that multiple Heroku customers share the same network. We designed this runtime to be simple to use and cost-effective, making it a popular choice for a wide range of applications. The Common Runtime is available in the United States and Europe regions.

Private Spaces, as its name implies, uses private infrastructure. Each space has its own network, routing layer, and control plane that aren’t shared with other applications outside the space. Each space is an isolated section of the Heroku platform, dedicated to a single customer. Private Spaces offers additional privacy, power, and performance for enterprise-level applications. This option is suitable for large-scale, critical applications that require enhanced security, compliance, or consistent performance. Private Spaces is available in multiple global regions, allowing for more control over where applications and data reside.

The privacy review meeting was originally intended to ensure Ursa Major’s app complies with data privacy standards. However, it drove Wei’s team to also evaluate the app’s performance and network security requirements. Wei’s security team concludes that hosting the application in the Common Runtime in the US is the most suitable and cost-effective option.

With the app deployed to the correct runtime, let’s discover how Wei configures the app.

Resources

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback