Set up the development environment

This document walks you through the environment setup process for Chaos Mesh development.

Prerequisites

Prepare the toolchain

Make sure you have the above prerequisites met. Now follow the steps below to prepare the toolchain for compiling Chaos Mesh:

  1. Clone the Chaos Mesh repo to your local machine.

    1. git clone https://github.com/chaos-mesh/chaos-mesh.git
    2. cd chaos-mesh
  1. Install the Kubernetes API development framework - kubebuilder and kustomize.

    1. make ensure-all
  1. Make sure Docker is installed and running on your local machine.

  2. Make sure Docker Registry is running. Set the environment variable DOCKER_REGISTRY with the registry address:

    1. echo 'export DOCKER_REGISTRY=localhost:5000' >> ~/.bash_profile
    2. source ~/.bash_profile
  1. Make sure ${GOPATH}/bin is in your PATH.

    1. echo 'export PATH=$(go env GOPATH)/bin:${PATH}' >> ~/.bash_profile
  1. ```
  2. source ~/.bash_profile
  3. ```
  1. Check nodejs related environment.

    1. node -v
    2. yarn -v

Now you can test the toolchain by running:

  1. make

If there is no error in the output, the compiling toolchain is successfully configured.

Prepare the deployment environment

With the toolchain ready, you still need a local Kubernetes cluster as the deployment environment. Because kind is already installed, you can now set up the Kubernetes cluster directly:

  1. hack/kind-cluster-build.sh

The above script creates a Kubernetes cluster via Kind. When you are done with it, run the following command to delete it:

  1. kind delete cluster --name=kind

Bootstrap Chaos Dashboard. (Optional)

  1. cd ui && yarn
  2. # Run it
  3. yarn start:default # cross-env REACT_APP_API_URL=http://localhost:2333 BROWSER=none react-scripts start

Next step

Congratulations! You are now all set up for Chaos Mesh development. Try the following tasks: