Skip to content

Setup

What Will You Do

This is Part 1 of a multi-part, self-paced quick start exercise. In this part, you will use the Infra Admin persona to setup and configure the needed resources to use Environment Manager.


Step 1: Import Git Repository

In this step, you will import a git repository to your account. The imported repo will contain the code used in this guide. A GitOps pipeline will be created later in this guide which will be triggered by commits to this repository.

  • Ensure you are logged into your GitHub.com account
  • Navigate here to begin the import
  • Enter the following URL into the input on the page: https://github.com/RafaySystems/envmgr.git
  • Enter envmgr for the repository name
  • Select Private
  • Click Begin Import
  • Once complete, you should see a copy of the repository in GitHub

GitHub Import

Note that the Rafay agent automatically writes back changes to Git if you make any changes to the resources via the web console or other supported interfaces.

  • The resources (esp. secrets) you identify as sensitive. will be automatically encrypted using a secret sealer before being synced to your Git repo.
  • If you forget to mark resources as sensitive, they will not be encrypted

Important

We recommend that users DO NOT use public Git repositories to avoid accidental exposure of sensitive data in your Git repository.


Step 2: Create GitHub Token

In this step, you will create a Personal Access Token in Github to allow access to the GitHub repository.

  • Ensure you are logged into your GitHub.com account
  • Go to the GitHub Account Settings
  • Click "Generate new token (classic)"
  • Provide a note for the token,
  • Select the repo scope
  • Click Generate token
  • Copy and save the access token for use later in this guide

GitHub Token


Step 3: Clone Git Repository

In this step, you will clone the previously imported Git repository to your local machine to simplify interacting with the repository.

  • Clone the Git repository to your laptop using the command below. Be sure to update the repository link with the link from the previously imported repository.
git clone <Imported Repository URL>
  • Once complete, you should see a folder called "terraform/gcp/101-vpc-instance" which contains the resources needed for this exercise.

Step 4: Download RCTL

The RCTL CLI allows you to programmatically interact with the controller enabling users to construct sophisticated automation workflows.

  • Login into your Org
  • Navigate to "My Tools" to download both the RCTL CLI and the "CLI Config" file
  • Initialize RCTL using the step-by-step instructions
  • Ensure you update your OS's Path environment variable for RCTL

Step 5: Configure Environment Parameters

In this step, you will configure a values file that will then be used by a configuration script.

  • Open Terminal (on macOS/Linux) and navigate to the folder where you cloned the Git repository
  • Navigate to the folder "/terraform/gcp/101-vpc-instance/setup"

  • Update the following values in the "values.yaml" file with the values from your repository and environment

project: UPDATE_EXISTING_PROJECT_NAME
usernName: UPDATE_REPO_USERNAME
token: UPDATE_REPO_TOKEN
endPoint: UPDATE_REPO_ENDPOINT
branch: UPDATE_REPO_BRANCH
gcpProjectID: UPDATE_PROJECT_ID

Step 6: Run Setup Script

In this step, you will run the setup script which will assist in creating the resources for this guide.

  • Navigate to the folder "/terraform/gcp/101-vpc-instance/setup"
  • Execute the setup.sh script

The script will begin to run. After a few minutes, the script will pause and provide Webhook details. Use these webhook details in the next step.

Webhook Output


Step 7: Setup GitHub Webhook

In this step, you will configure your repository webhook. The webhook will be used to trigger the System-Sync pipeline in the controller.

  • Navigate to your GitHub repository -> Settings -> Webhooks
  • Click Add webhook
  • Copy and Paste the "Payload URL" and "Secret" from the script output
  • Click Add webhook

Webhook in GitHub

  • Enter Yes in the script to continue

Step 8: Configure Environment Context

In this step, you will configure an environment context in the controller with your GCP account details. These account details will be used by Environment Manager to interact with your cloud account.

  • Follow the step-by-step instructions to setup GCP and obtain the required JSON credentials file
  • Encode the contents of the JSON file into base64
  • Log into the controller and select your project
  • Navigate to Environments -> Contexts
  • Click on the existing context name
  • Select File Paths
  • Populate the data field for the file path with the base64 encoded credentials
  • Ensure that you select the sensitive checkbox for the inputs
  • Click Save

Populate Context

Important

The Rafay agent automatically writes back the environment variables to Git. The resources (esp. secrets) you identify as sensitive. will be automatically encrypted using a secret sealer before being synced to your Git repo.


Step 9: Create Environment Resource

In this step, you will create an environment resource in the controller which will use the previously created environment template. This environment resource will be used to control the lifecycle of the environment.

  • Log into the controller and select your project
  • Navigate to Environments -> Environments
  • Click New Environment
  • Enter an environment name
  • Select the existing environment template
  • Select the environment template version
  • Click Create

Recap

At this point, you have everything setup and configured to manage environments through Environment Manager.