Managed Runtime Infrastructure

Introduction

The Managed Runtime provides the infrastructure to deploy, host, and monitor your PWA Kit storefront.

Researchers that study high-performing software teams have learned that the deployment process is a key to success. That’s why we designed the Managed Runtime to streamline the process of deploying your storefront code and unlock your team’s productivity.

The Managed Runtime follows the Twelve-factor App methodology. Your storefront is powered by a single codebase that is built statelessly and can be deployed on the most efficient and low-cost computing infrastructure available. Each deployment completely replaces the previous deployment and is reconfigured from scratch.

And most importantly, the Managed Runtime offers the same enterprise-grade security as all Salesforce technologies.

This guide covers the main parts of the Managed Runtime: environments, the App Server, edge services, and admin tools.

Environments

An environment is the term used to describe all of the cloud infrastructure and configuration values for a particular storefront hosted by the Managed Runtime. Environments are used to separate your production storefront from other storefronts that are deployed for other purposes, such as development or testing.

In the Managed Runtime API, environments are called “targets,” but both terms refer to the same thing.

Because environments run on highly efficient microservices that automatically scale up and down, you can create as many environments as you need at no additional cost. For example, you could create a short-lived environment dedicated to a single agile development sprint or for a single user story within that sprint. When you no longer need an environment, we encourage you to delete them.

The storefront code that runs on an environment is called a bundle. Using the developer tools included in PWA Kit, a bundle can be generated and pushed to the Managed Runtime.

A bundle is a snapshot your code at a specific point in time. It’s immutable: After a bundle has been created, it can’t be changed. Having this complete and accurate history of bundles makes troubleshooting deployments easier.

After pushing the bundle, you can use the Runtime Admin or the Managed Runtime API to designate that bundle as “deployed.” Each project can have multiple bundles, but each environment can have only one bundle that's designated as deployed. You can change which bundle is designated as deployed at any time. For more information on bundles, see our how-to guide to Pushing and Deploying Bundles.

To help you manage multiple environments, each environment also belongs to a project and each project belongs to an organization. An organization can contain multiple projects for multiple storefronts and each project can contain multiple environments. A Managed Runtime user can belong to multiple organizations to separate different work streams.

App Server

Within each Managed Runtime environment, the React app in the published bundle runs inside a Node.js environment. To respond to page requests and render the results, we use the Express web framework with the help of PWA Kit’s rendering and routing system. We call this combination of React, Node, and Express the App Server. (Although, technically speaking, the App Server runs on “serverless” technology.)

Because PWA Kit’s rendering and routing system handles the differences between local development environments and Managed Runtime environments, your code runs in a predictable way when you deploy it. This predictability unlocks your development team’s productivity by encouraging them to deploy bundles more frequently.

Currently, the App Server supports Transport Layer Security (TLS) versions 1.2 and greater.

All storefront bundles must use either Node 14.x or Node 12.x.

Edge Services

Supporting the app server are several edge services, including:

  • A web application firewall (WAF) to protect your environments from attackers
  • A proxy server to speed up API requests
  • A content delivery network (CDN) to cache requests and speed up page loading
  • Edge functions that process requests and handle redirects

The proxy server and CDN are covered in detail in our guide to Proxying Requests. The edge function called the request processor is covered in our guide to Maximizing Your Cache Hit Ratio.

The Managed Runtime’s edge services are strategically distributed throughout our public cloud infrastructure. Each service is located as close to the user as possible for faster performance.

Admin Tools

To manage the settings for your organizations, projects, environments, and bundles, we offer two different tools:

  1. The Managed Runtime Admin, a web-based UI.
  2. The Managed Runtime API, a REST API that offers the same functionality as the web-based tool and some additional capabilities.

Use the Managed Runtime Admin tool for routine tasks, such as deploying a new code bundle to an environment. Use the API whenever you need programmatic control, such as automatically creating an environment as part of a continuous integration script.

The admin tools give you a self-serve way to configure many settings, including:

  • Allowed IP addresses
  • Currently deployed bundle
  • Deployment region
  • Proxies
  • Redirects
  • User permissions

Some settings require you to open a support request, including:

  • Static IP addresses (for VPN)

Access to the admin tools is controlled with Account Manager roles and an API key. For continuous integration (CI) and continuous delivery (CD) processes, dedicated bot users with their own API keys are typically provisioned by your organization.

Fun fact: Like your storefront, the Runtime Admin tool is a headless React app that is deployed to the Managed Runtime.

Next Steps

Now that you have an overview of the main parts of the Managed Runtime, it’s time to get hands-on! Check out our how-to guides for practical advice on developing a storefront with PWA Kit and Managed Runtime. A good place to start is the guide to Pushing and Deploying Bundles.

Before you can use the Managed Runtime, you must request access. Contact your Commerce Cloud administrator and ask them to add either one of the following roles to your account using Account Manager: Commerce Runtime Manager User or Commerce Runtime Manager Admin.