Envoy dev env setup - tetratelabs-attic/getenvoy-package GitHub Wiki
Recommended OS: Ubuntu 18.04 on GCE
us-central1 is recommended but if the SSH latency isn't great feel free to use other places. n1-standard-2 should be enough but could be larger.
VM setup
When you create GCE instance, make sure it has all access to Cloud APIs. Add cloud-platform by https://cloud.google.com/sdk/gcloud/reference/alpha/compute/instances/set-scopes
Install basic tools:
sudo apt-get install build-essential \
libtool \
cmake \
automake \
autoconf \
make \
ninja-build \
curl \
unzip \
virtualenv \
git \
python3-pip
Install Bazel tools and LLVM:
LLVM 9.0.0
curl -sfL https://raw.githubusercontent.com/envoyproxy/envoy-build-tools/master/build_container/build_container_common.sh \
| sudo LLVM_VERSION=9.0.0 LLVM_DISTRO=x86_64-linux-gnu-ubuntu-18.04 LLVM_SHA256SUM=a23b082b30c128c9831dbdd96edad26b43f56624d0ad0ea9edec506f5385038d bash -
LLVM 10.0.0
curl -sfL https://raw.githubusercontent.com/envoyproxy/envoy-build-tools/master/build_container/build_container_common.sh \
| sudo LLVM_VERSION=10.0.0 LLVM_DISTRO=x86_64-linux-gnu-ubuntu-18.04 LLVM_SHA256SUM=b25f592a0c00686f03e3b7db68ca6dc87418f681f4ead4df4745a01d9be63843 bash -
Workspace setup
-
Checkout Envoy (usually from your fork).
-
Setup
clang
.
bazel/setup_clang.sh /opt/llvm
This generate clang.bazelrc
.
- Make building using
clang
as the default, add the following line touser.bazelrc
:
build --config=clang
- Setup RBE, add the following lines to
user.bazelrc
.
build --remote_instance_name=projects/getenvoy-package/instances/default_instance
build --config=remote-clang
build --config=remote-ci
build --jobs=80
build --remote_download_outputs=all
If you're running outside of GCP, use --remote_download_minimal
instead of --remote_download_outputs=all
to save network. Add your GCE service account to getenvoy-package
project for RBE access or ask Lizan.
Local RBE setup
- run
gcloud auth application-default login
and authenticate with you tetrate.io account.
Put the following in user.bazelrc in Envoy repo root
build --google_default_credentials
build --remote_instance_name=projects/getenvoy-package/instances/default_instance
build --config=remote-clang
build --config=remote-ci
build --jobs=80
- run
bazel build //source/exe:envoy-static
as normal.
VSCode
Extensions:
- VSCode Remote - SSH if building remotely.
- vscode-bazel
- vscode-clangd make sure to disable Microsoft C/C++ plugin if you installed it. Set clangd path to /opt/llvm/bin/clangd
To setup run:
tools/gen_compilation_database.py --vscode
This may take time depends on machine spec or RBE. Make sure you have --remote_download_outputs=all
in user.bazelrc.
Open Envoy source root in VSCode (remote if apply).
Sometimes clangd fails to reload compilation database, in such case, kill the clangd process (killall /opt/llvm/bin/clangd
) to force it reload.