Porter offers a simple way to create preview environments for your application.
These environments allow you to test changes in a production-like environment before merging.
When enabled, preview environments are by default created automatically for every pull request that is opened in your GitHub repository.
Each preview environment is created in isolation on your cluster and is destroyed once the pull request is closed or merged.The first step to enabling preview environments is to configure a preview template.
Preview templates allow you to select an application that is currently deployed to your cluster and configure how it should be deployed as a preview application.This configuration includes:
Addons to be created alongside the preview application. This includes things like databases and custom helm charts.
Configuration overrides for services within the application. By default, the preview application will use the same configuration as the currently deployed application, but you can override any of these settings, including environment variables.
After creating a preview template for an application, Porter will open a PR in that application’s repository with a workflow file for spinning up a new preview environment when a PR is created.
This PR must be merged for preview environments to be created.
Deploying Multiple Applications to the Same Preview Environment
After setting up a preview template, you can further modify the template to specify other applications on your cluster that should be deployed alongside the preview application.
Adding a required app will create a copy of that application in the preview environment.
If you would like to test changes across multiple applications/repositories, it is also possible to deploy multiple preview applications to the same preview environment.
To do so, you must create multiple preview templates (one for each preview application that you would like to deploy).
If deploying applications across multiple repositories, the PR branch name must also be the same for the preview applications to get deployed to the same environment.