• Are you a partner? Please find our certification tracks on our legacy Academy.

Setting up Launch with Gatsby

lesson thumbnail



Gatsby is an open-source React-based framework that provides a hybrid static/server-side rendered model. Using Gatsby data fetching, you can render your content differently based on your application's use case and build APIs using Gatsby Functions.

Launch supports the following features of Gatsby out of the box:

The fastest way to get started with Launch is to clone and deploy a sample Gatsby Starter project. Launch allows you to create a project by importing the website code from GitHub.
Prerequisites

  1. Access to Launch for your organization (Note: Only the Organization Admin/Owner has permissions to create Launch projects)

Steps for Execution
Follow the steps given below to deploy your first Launch project using GitHub:

  1. Log into Contentstack and click the Launch icon from the left navigation panel, as shown below:
    LaunchFoundations_L1_img-2.png

  2. Click the + New Project button:

    LaunchFoundations_L2_img-2.png

  3. In the Create New Project modal, click Import from a Git Repository. (Note: You can also choose to upload a .zip file to create your project.)
    LaunchFoundations_L2_img-3.png

  4. Click GitHub:

    LaunchFoundations_L2_img-4.pngThis will open a modal window to authenticate with your GitHub account.

  5. Enter your credentials and log in:

    LaunchFoundations_L2_img-5.png

  6. In the Repository Access section, select All repositories.
    Note: If you want to choose specific repositories, pick the Only select repositories option and choose the required repository.

    LaunchFoundations_L2_img-6.png

  7. Click the Save button
    Note: If you are accessing GitHub through Contentstack for the first time, you must authorize Contentstack by clicking the “Install & Authorize” button after selecting All repositories.

    LaunchFoundations_L2_img-7.png


    Once you’ve connected your GitHub account, you’ll be redirected back to Launch
    .
  8. In the Create New Project modal, add the following details:

    Repository (Mandatory): Select your Git repository.

    Git Branch (Mandatory): By default, master or main is selected as the branch. You can choose another branch from the dropdown.

    Project Name (Mandatory): This is auto-populated when you select the repository, but you can edit it as needed.

    Environment Name (Mandatory): The environment name is automatically populated as Default, but can be changed. Note that this is specific to Launch and not directly related to any environments in your stack.

    Build and Output Settings (Mandatory): The fields in this section get auto-populated based on the detected framework. (If no framework is detected, you can specify your own Build Command and Output Directory.)

    Environment Variables (Optional): Enter the key and value of one or more environment variables. You can also use the “Connect and Import Variables” option to automatically import API-related variables from a specific stack and delivery token.

    LaunchFoundations_L2_img-8.png


    Note: Click Back to revert the changes and re-enter details.

  9. Once ready, click Deploy to save and deploy the project.
    You’ll see the project’s status update in real time, from Queued to Deploying to Deployed. Note: depending on the size and complexity of your specific application, it may take several minutes to build and deploy your site.

    10ac4ee7-1e0c-44eb-9079-8a0c056c3ebd-Screenshot_from_2023-07-19_14-57-49.png
    Upon successful deployment, you will see the following screen:

    LaunchFoundations_L2_img-9.png


    You can preview the deployed website by copying the URL from the URL section under Deployment Information and opening it in a browser.

    If you want to deploy the changes from any other commits, you can click the Redeploy button and choose the required commit.
    e9376604-2070-4f18-bccf-f8624ff983d3-Screenshot_from_2023-07-24_18-53-49.png

    Note: The log details of the current deployment can be found under the Logs section.