-
Notifications
You must be signed in to change notification settings - Fork 947
ChaosBlade Projects Compilation
The ChaosBlade tool contains chaos experiments in many fields. Chaos experiments in different fields are implemented by different projects. This article details how to compile these projects and package the ChaosBlade toolkit.
You can compile each project of ChaosBlade on Mac or Linux platform, and on Mac platform, you can use docker to compile cross-platform, compile the package running on Linux platform. The environment and method of compiling each project will be described in detail below.
The ChaosBlade CLI tool is implemented using the golang programming language, using go.mod for package management, and the project address: https://github.com/chaosblade-io/chaosblade . Only compiling this project will generate a blade file for chaosblade chaos experiments. As the main project of ChaosBlade project, you can compile all the projects related to ChaosBlade. The following describes how to compile in stages.
Compilation result directory: target/chaosblade-VERSION
Compile Linux version on Mac
Compilation environment: Mac, Docker Target platform: Linux platform Compile target: build_with_linux Compile command:
» tree
.
├── bin
├── blade
└── lib
Compile Mac version on Mac
Compilation environment: Mac, go1.13+ Target platform: Mac Compile target: build_with Compile command:
make build_with cli
Compile Linux version on Linux
Compilation environment: Linux, go1.13+ Target platform: Linux Compile target: build_with Compile command:
make build_with cli
Download the chaosblade-exec-os repository through the git clone command, and compile according to the BLADE_EXEC_OS_BRANCH
branch specified in the Makefile.
Compile Linux version on Mac
Compilation environment: Mac, Docker, git Target platform: Linux platform Compile target: build_with_linux Compile command:
ARGS="cli os" make build_with_linux
Compilation result:
» tree
.
├── bin
│ ├── chaos_burncpu
│ ├── chaos_burnio
│ ├── chaos_burnmem
│ ├── chaos_changedns
│ ├── chaos_dropnetwork
│ ├── chaos_filldisk
│ ├── chaos_killprocess
│ ├── chaos_occupynetwork
│ ├── chaos_stopprocess
│ ├── chaos_tcnetwork
│ └── chaosblade-os-spec-0.6.0.yaml
├── blade
└── lib
Compile Mac version on Mac
Compilation environment: Mac, git, go1.13+ Target platform: Mac Compile target: build_with Compile command:
make build_with cli os_darwin
Compile Linux version on Linux
Compilation environment: Linux, git, go1.13+ Target platform: Linux Compile target: build_with Compile command:
make build_with cli os
Contains cli, os, docker, kubernetes, cplus scenes in addition to the java scene. The java scene needs to be compiled separately, and then copied to the specified chaosblade directory. See chaosblade-exec-jvm compilation for details.
Compile Linux version on Mac
Compilation environment: Mac, Docker, git Target platform: Linux platform Compile target: build_linux Compile command:
make build_linux
Compilation result:
» tree
.
├── bin
│ ├── chaos_burncpu
│ ├── chaos_burnio
│ ├── chaos_burnmem
│ ├── chaos_changedns
│ ├── chaos_dropnetwork
│ ├── chaos_filldisk
│ ├── chaos_fuse
│ ├── chaos_killprocess
│ ├── chaos_occupynetwork
│ ├── chaos_stopprocess
│ ├── chaos_tcnetwork
│ ├── chaosblade-cplus-spec.yaml
│ ├── chaosblade-docker-spec-0.6.0.yaml
│ ├── chaosblade-k8s-spec-0.6.0.yaml
│ └── chaosblade-os-spec-0.6.0.yaml
├── blade
└── lib
└── cplus
├── chaosblade-exec-cplus.jar
└── script
├── shell_break_and_return.sh
├── shell_break_and_return_attach.sh
├── shell_check_process_duplicate.sh
├── shell_check_process_id.sh
├── shell_initialization.sh
├── shell_modify_variable.sh
├── shell_modify_variable_attch.sh
├── shell_remove_process.sh
├── shell_response_delay.sh
└── shell_response_delay_attach.sh
4 directories, 27 files
Compile Mac version on Mac
Compilation environment: Mac, git, go1.13+ Target platform: Mac Compile target: build_darwin Compile command:
make build_darwin
Compile Linux version on Linux
Compilation environment: Linux, git, go1.13+ Target platform: Linux Compile target: build Compile command:
make
Java experiment scenario project, project address: https://github.com/chaosblade-io/chaosblade-exec-jvm. The jvm-sandbox library will be downloaded during compilation. Compilation result directory: build-target/chaosblade-VERSION
Compilation environment: JDK8, Maven3.X Target platforms: Mac, Linux Compile target: build Compile command:
make
Compilation result:
.
├── bin
│ ├── chaosblade-jvm-spec-0.6.0.yaml
│ └── tools.jar
└── lib
└── sandbox
├── bin
│ └── sandbox.sh
├── cfg
│ ├── sandbox-logback.xml
│ ├── sandbox.properties
│ └── version
├── example
│ └── sandbox-debug-module.jar
├── install-local.sh
├── lib
│ ├── sandbox-agent.jar
│ ├── sandbox-core.jar
│ └── sandbox-spy.jar
├── module
│ ├── chaosblade-java-agent-0.6.0.jar
│ └── sandbox-mgr-module.jar
├── provider
│ └── sandbox-mgr-provider.jar
└── sandbox-module
10 directories, 14 files
You need to copy build-target/chaosblade-VERSION/* to chaosblade project compilation result directory target/chaosblade-VERSION/ to execute, for example:
cp -R /Users/Shared/ChaosBladeProjects/chaosblade-opensource/chaosblade-exec-jvm/build-target/chaosblade-0.6.0/* /Users/Shared/ChaosBladeProjects/chaosblade-opensource/chaosblade/src/github.com/chaosblade-io/chaosblade/target/chaosblade-0.6.0/
Copy results:
target/chaosblade-0.6.0
├── bin
│ ├── chaos_burncpu
│ ├── chaos_burnio
│ ├── chaos_burnmem
│ ├── chaos_changedns
│ ├── chaos_dropnetwork
│ ├── chaos_filldisk
│ ├── chaos_fuse
│ ├── chaos_killprocess
│ ├── chaos_occupynetwork
│ ├── chaos_stopprocess
│ ├── chaos_tcnetwork
│ ├── chaosblade-cplus-spec.yaml
│ ├── chaosblade-docker-spec-0.6.0.yaml
│ ├── chaosblade-jvm-spec-0.6.0.yaml
│ ├── chaosblade-k8s-spec-0.6.0.yaml
│ ├── chaosblade-os-spec-0.6.0.yaml
│ └── tools.jar
├── blade
└── lib
├── cplus
│ ├── chaosblade-exec-cplus.jar
│ └── script
│ ├── shell_break_and_return.sh
│ ├── shell_break_and_return_attach.sh
│ ├── shell_check_process_duplicate.sh
│ ├── shell_check_process_id.sh
│ ├── shell_initialization.sh
│ ├── shell_modify_variable.sh
│ ├── shell_modify_variable_attch.sh
│ ├── shell_remove_process.sh
│ ├── shell_response_delay.sh
│ └── shell_response_delay_attach.sh
└── sandbox
├── bin
│ └── sandbox.sh
├── cfg
│ ├── sandbox-logback.xml
│ ├── sandbox.properties
│ └── version
├── example
│ └── sandbox-debug-module.jar
├── install-local.sh
├── lib
│ ├── sandbox-agent.jar
│ ├── sandbox-core.jar
│ └── sandbox-spy.jar
├── module
│ ├── chaosblade-java-agent-0.6.0.jar
│ └── sandbox-mgr-module.jar
├── provider
│ └── sandbox-mgr-provider.jar
└── sandbox-module
12 directories, 41 files
This project is compiled for the yaml file and chaosblade-operator image used in the Kubernetes scenario. Project address: https://github.com/chaosblade-io/chaosblade-operator
Compilation environment: go1.13+, operator-sdk, docker Target platforms: Linux, Mac Compile target: build_all Compile command:
make build_all
Compilation result:
.
└── bin
├── chaos_fuse
└── chaosblade-k8s-spec-0.6.0.yaml
chaosblade-operator mirror:
chaosblade-operator 0.6.0 c1cfb831e20f About a minute ago 126MB
The image containing the ChaosBlade tool is compiled under the chaosblade project (https://github.com/chaosblade-io/chaosblade). You need to ensure that the chaosblade has compiled the Linux platform version package, that is, the Linux version is included in the chaosblade/target
directory The chaosblade-VERSION.tar.gz
package.
Compilation environment: docker Target platform: Linux Compile target: build_image Compile command:
make build_image
Compilation result:
chaosblade-tool 0.6.0 e6ac3e3c5b8a 3 weeks ago 302MB