Skip to content

Setup

Configure Cloud Account

To get started, first configure the cloud account and region that you want your preview environments to be launched in. This setting is located on the settings page for the stack. Any preview environments created for applications in the stack will be launched into this account and region.

Preview Environments - Configure Cloud Account and Region

Enable Previews for an Application

For each application that you want to create preview environments, you must have previews enabled. Navigate to the homepage for the application and click on the Settings button next to the application name. Scroll down to the Preview Environments section and click to toggle preview environments on.

Preview Environments - Configure Application

Configuration Options

Repo

Once previews are enabled, the only required configuration is your GitHub repo. To link this application to your GitHub repo, click the Select button and select the repo from the list.

TIP

If you don't see your repo in the list, make sure you have granted Nullstone access to your GitHub account. Check out the guide to Connect to GitHub.

Auto-Launch

If you want a Preview Environment to be launched automatically when a PR is opened, turn on the Auto-Launch toggle. This is the recommended setting for most applications. Preview Environments use limited resources and are destroyed when the PR is closed.

If this option is toggled off, a message will be posted on your GitHub PR with instructions on how to launch the Preview Environment.

  • To manually launch, post the message nullstone previews up to your PR.
  • To manually destroy the Preview Environment, post the message nullstone previews down to your PR.

Auto-Deploy & Build Configuration

To automatically deploy the code for each code checkin, turn on the Auto-Deploy toggle. This is the recommended setting to make sure you don't forget to update the preview environment as you make changes to your code.

If auto-deploy is enabled, you will be prompted to supply Build Options in order to instruct Nullstone on how to build your application.

  • For applications packaged as Docker images, specify the build directory and Dockerfile to use.
  • For lambda functions packaged as a zip, specify the path to your files to be zipped and deployed.
  • For static sites, specify the path to your static files to be deployed.

If auto-deploy is disabled, you can deploy your application manually using the Nullstone CLI. See the Deployment guide for more information on manual deployment.

IaC File

To further control the configuration of your Preview Environment, it is recommended that you add a .nullstone/previews.yaml file to your application's repo. This file allows you to configure variables and environment variables for your preview environment. When launching or updating your preview environment, Nullstone will read this file and apply its configuration as part of the updates. This allows you to make changes to your infrastructure alongside your code changes and merge them together in a single PR.

TIP

To learn more about the options and syntax for the IAC file, check out the Infrastructure as Code guide.

Preview Environments - Setup has loaded