ESPv2 is based on Envoy Proxy and Config Manager. Envoy written in C++ is built using bazel with clang and Config Manager written in go is built using go build.
See the architecture overview before getting started.
We recommend starting this setup using only the command line at first. Later, we will walk through how to use Intellij and CLion IDEs for the project.
Reference the official golang installation instructions for your OS. The latest go version should work.
Add the following setting in .profile, then source it:
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:$PATH
It is recommended to use Bazelisk installed as bazel
to avoid Bazel compatibility issues. Follow the instructions on the linked website to install it.
To get started building Envoy locally, following the instructions from Envoy.
Add the package sources with the following commands. If these commands fail, reference the official clang installation instructions for your OS.
Install the following packages:
sudo apt-get update
sudo apt-get install -y llvm-13-dev libclang-13-dev clang-13 \
clang-tools-13 clang-format-13 xz-utils lld-13
sudo apt install -y cmake ninja-build protobuf-compiler brotli \
libicu-dev libbrotli-dev
sudo apt-get install jq nodejs npm python-is-python3
To download the source code, use go get
:
go get github.com/GoogleCloudPlatform/esp-v2
This will create the following folder structure:
- $HOME/go
- bin
- src
- github.com
- GoogleCloudPlatform
- esp-v2
In order to build Config Manager, need to install its dependent libraries:
make depend.install
make depend.install.endpoints
To build:
# Config Manager
make build
# Envoy
make build-envoy
To run unit tests:
# Config Manager
make test
# Envoy
make test-envoy
To run integration tests:
make integration-test-run-parallel
For the C++ code, we will use CLion with the Blaze / Bazel plugin. Import the project as a Bazel project. CLion should automatically pick up the targets and run configurations.
For the golang code, we will use Intellij Ultimate edition. Import the project as a Git project (do NOT use the Bazel plugin). Intellij will automatically pick up the run configurations.
For both CLion and Intellij, change the blaze plugin to use bazelisk
instead of bazel
for any commands:
- Search for the
Bazel binary location
item in the Intellij Settings - Change it to the output of
which bazelisk
You will need the following tools to run manual e2e tests:
- Docker Engine
gcloud
Alternatively, you can rely on ESPv2 Prow CI/CD to run e2e tests.