Deploy Knapsack

This page provides a guide to deploying your Knapsack workspace. It covers all the necessary steps to ensure a smooth deployment process, including installing dependencies, building the codebase, and executing essential Knapsack commands to serve your design system.
View as Markdown

Overview

Deploying Knapsack involves several key steps to ensure your design system is properly integrated, built, and served.

This section provides a comprehensive guide to the deployment process, focusing on:

  1. Deployments to Heroku
  2. Supported Git providers
    1. Cloud Authoring configurations
    2. Sample CI/CD workflows

Heroku

We provide every customer with a cloud deployment of their Knapsack workspace on Heroku. This section will provide details on the configurations necessary to deploy to your workspace in the cloud.

Provided Heroku Deployment

Most customer choose to use the Heroku deployment we configure for them during the initial workspace creation process.

The following secrets will be used to configure deployments from within your specific git provider:

  1. HEROKU_EMAIL — The email associated with the Heroku account.
  2. HEROKU_API_KEY — The API Key associated with the Heroku account (found in profile settings)
  3. HEROKU_GIT_URL — Located on the app dashboard within Heroku’s admin interface

Required Actions

  1. Provide us with an email we should use for the Heroku email and API Key.
  2. We will send the invitation to the specified account.
  3. When the new Heroku account is confirmed use that user’s:
    1. Email for HEROKU_EMAIL
    2. API key for HEROKU_API_KEY
  4. The HEROKU_GIT_URL can be located on the app dashboard OR we can provide this for you.
  5. Proceed onto configuring Cloud Authoring + CI/CD

Customer Owned Heroku Deployment

This is only required if you are no longer planning to use the Heroku app that was created when your Knapsack workspace was generated. This is useful if your organization would like full ownership and control over the Heroku application.

Note: you’ll need to install the Heroku CLI and authenticate after creating an account.

Creating the new Heroku App

The below guide will provide instructions on how to create a new Heroku app. During this flow you will run a command to generate the new app. The command will return the URL of your new app and the Git URL. You will want to copy these values and retain them for step 2 and 3.

Step 1: Using the Heroku CLI run the following command

heroku create NewAppNameHere --stack heroku-22
  • If using Heroku teams, you may also specify the team by adding the --team teamNameHere flag.
  • The command will return the correct values to use for configuring deployments
    • You will want to copy these values and retain them for step 2 and 3.

Step 2: Collect all necessarily values to configure deployments

The following secrets will be used to configure deployments from within your specific git provider:

  1. HEROKU_EMAIL — The email associated with the Heroku account
  2. HEROKU_API_KEY — The API Key associated with the Heroku account (found in profile settings)
  3. HEROKU_GIT_URL — The value provided from the command in step 1 above (this can also be located on the app dashboard within Heroku’s admin interface)

Step 3: Notify Knapsack of your new deployment URL

We need to know the new Heroku App URL (provided by the command run in step 1 above) so we can update our database records to validate your new workspace location.

Step 4: Proceed onto configuring Cloud Authoring + CI/CD

Next, let’s take a look at Cloud Authoring + CI/CD configurations.


Cloud Authoring + CI/CD Flow

Each supported Git provider has unique features and configurations for Cloud Authoring and CI/CD.

These sections will guide you through the specific Cloud Authoring configuration steps and CI/CD flows for GitHub, GitLab, Bitbucket, and Azure, ensuring a smooth and automated deployment process.