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

  1. Checkout Envoy (usually from your fork).

  2. Setup clang.

bazel/setup_clang.sh /opt/llvm

This generate clang.bazelrc.

  1. Make building using clang as the default, add the following line to user.bazelrc:
build --config=clang
  1. 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

  1. 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
  1. run bazel build //source/exe:envoy-static as normal.

VSCode

Extensions:

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.