Deployment previews
Deployment previews let you preview your Custom Application changes using a unique URL.
To test your Custom Application features before releasing them to the production environment, you can add a deployment preview. For example, you can add a deployment preview to try all the updates in the staging
branch and another to test some experimental features.
You must host the deployment previews separately from one another and assign a unique but static URL. You can add as many deployment previews as you like. In Merchant Center, the deployment previews are available on a unique URL, different than the production environment.
This document describes the necessary steps to build and add deployment previews to your Custom Application. The process involves:
- Building deployment previews for your Custom Application.
- Deploying the Custom Application preview to your hosting provider.
- Adding the deployment preview to the Custom Application settings.
Building deployment previews
Each deployment preview has its unique and static deployment URL. The Merchant Center uses this URL to render the deployment preview. Therefore, to build a deployment preview, you must set the env.production.url
value to deployed application's URL in the custom-application-config.json
file.
To build a deployment preview, configure your production URL in the custom-application-config.json
using the environment variables references.
{"env": {"production": {"url": "${env:APP_URL}",},}
With the above setup, you can build deployment previews based on the APP_URL
environment variable value. How you set the environment is up to you. For example, you could set the APP_URL
to different values in different hosting environments or create a .env
file in your project and commit different values for the APP_URL
variable in different branches.
Deploying the Custom Application preview
Once you've built your Custom Application using the correct env.production.url
value. You can deploy the Custom Application preview the same as you deploy your Custom Application.
The only requirement is that the deployed application URL (APP_URL
) is static, so you can specify it on the Merchant Center while Adding the deployment preview.
See Deployment Examples to get up and running with some of the common cloud hosting providers.
You must set the APP_URL
environment variable on your hosting provider.
Adding a deployment preview to the Custom Application
To use the Custom Application deployment preview inside the Merchant Center, you must add the deployment preview in your Custom Application settings. While adding the deployment preview, you'll need to fill the APP_URL
value in the Application URL field.
For example, if your Custom Application's production environment is hosted at https://example.com
and you want to add a deployment preview hosted at https://staging.example.com
.
You can do so by setting the APP_URL
environment variable to https://example.com
in the production deployment environment and https://staging.example.com
in the staging deployment environment.
Then you'd add a deployment preview Alias staging
with Application URL set to https://staging.example.com
in the Merchant Center.