Configure the Development Environment
This document describes how to configure a development environment for Chaos Mesh.
Configuration requirements
Before configuring, you need to install the development tools for Chaos Mesh.
- golang, v1.15 or later versions
- docker
- gcc
- helm v2.8.2 or later versions
- kind
- nodejs and yarn, for developing Chaos Dashboard
Prepare the toolchain
After installing the above tools, follow the steps below to configure the toolchain for compiling Chaos Mesh.
Clone the Chaos Mesh repository to your local server.
git clone https://github.com/chaos-mesh/chaos-mesh.git
cd chaos-mesh
Make sure that Docker is installed and running in your environment.
Make sure Docker Registry is running. Set the environment variable
DOCKER_REGISTRY
as the address of Docker Registry:echo 'export DOCKER_REGISTRY=localhost:5000' >> ~/.bash_profile
source ~/.bash_profile
Make sure
${GOPATH}/bin
is in yourPATH
.echo 'export PATH=$(go env GOPATH)/bin:${PATH}' >> ~/.bash_profile
source ~/.bash_profile
Check the configuration environment related to Node.js.
node -v
yarn -v
Compile Chaos Mesh:
make
If no error occurs, you have successfully cnofigured the toolchain.
Prepare the environment for deployment
After configuring the toolchain, you need to launch a local Kubernetes cluster to deploy Chaos Mesh. Because kind is installed in the configuration requirements section, you can directly use the following command to launch a Kubernetes cluster:
hack/kind-cluster-build.sh
When you no longer need this cluster and want to delete it, you can use the following command:
kind delete cluster --name=kind
To start Chaos Dashboard, run the following command:
cd ui && yarn
# start
yarn workspace @ui/app start:default # cross-env REACT_APP_API_URL=http://localhost:2333 BROWSER=none react-scripts start
Learn more
After finishing the above preparation, you can try to Add a New Chaos Experiment type.