Skip to content

Overview

Estimated Completion: ~15 minutes

Goal: Launch a sample preview environment using a demo product with Nullstone Terraform modules.

Description: We are going to launch a full AWS environment for a product called fider. This guides only requires an AWS account and a GitHub account. We will create a new pull request in GitHub that will fully provision and deploy the product to an ephemeral environment. Once we close the pull request, the environment will be destroyed.

Initial Setup

TIP

Skip this step if you have already connected your cloud account.

Visit Add Cloud Account in Nullstone. Follow the instructions to connect your cloud account.

Create in Nullstone

Fork example repository

Fork the example repository nullstone-io/fider into your own GitHub account.

Connect GitHub repository

Visit New GitOps Connection. Click "Select" to open the repository selection dialog. If you have not connected GitHub, click "Configure Account" to set up the GitHub integration.

TIP

Type fider in the search bar to narrow down to the forked repository.

Once you click Create, Nullstone synchronizes the Nullstone configuration defined in .nullstone/ directory in the fider repository. This creates the necessary infrastructure components in Nullstone. You should see them if you click the "personal" stack in the sidebar.

Configure Preview Envs

Configure Launch Settings

Visit your "personal" stack in Nullstone and open the "Preview Config" tab. Choose the following settings:

  • "Create preview env when pull request is opened"
  • Enable "Automatically launch when preview env is created"

Click "Update".

Launch Settings

Configure Cloud Account

Choose the Cloud Account that we created during initial setup. Then, choose an AWS region to launch preview infrastructure.

Click "Update".

Cloud Account

Configure Shared Blocks

Enable "postgres0" and "cluster0". This will launch an RDS postgres instance and ECS cluster as shared resources. Every preview environment will use these resources so it's fast to launch and minimizes cost. However, each preview environment is still isolated from other preview environments.

Click "Update".

Shared Blocks

Enable fider app

Under "Applications", expand "fider". Enable "Launch app when preview env is launched". Then, choose "Auto build and deploy using Nullstone". The default build settings work for this application.

Click "Update".

Applications

Launch new preview env

Now that we have Nullstone configured, let's create a pull request to launch a preview environment. Then, we will close the pull request to destroy the preview environment.

Create and open pull request

Visit the forked fider repository in your GitHub account. Edit the README.md to add any text you want. Save the changes to a new branch. Then, create a new pull request from your branch.

Launch

As soon as the pull request is opened, Nullstone will launch a new preview environment.

WARNING

The initial launch will take ~15-20 minutes because the base infrastructure is launching into a previews-shared environment in Nullstone. Every subsequent preview environment will launch in ~5-10 minutes.

Destroy preview env

Once we are happy with changes to the pull request, we can merge or close the pull request. As soon as we do this, Nullstone will destroy infrastructure for the preview environment.

WARNING

This step will not destroy shared infrastructure that was provisioned in the previews-shared environment. To destroy this shared infrastructure, visit the previews-shared environment in your personal stack.