You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
What is envoy proxy
Envoy is an L7 proxy and communication bus designed for large modern service oriented architectures. It provides several features for a reverse proxy including but not limited to:
- HTTP2 support.
- L3/L4 filter architecture, so it can be used as a TLS terminator, traffic mirror service and other use cases.
- Good observability and tracing, supporting statsd, zipking etc.
- rate limiting, circuit breakers support.
- dynamic configuration through the xDS protocol.
- service discovery.
- gRPC, Redis, MongoDB proxy support.
Envoy at WMF
There are two main use cases for envoy at WMF.
- Act as a TLS terminator / proxy for internal services and potentially mediawiki.
- Be deployed as a sidecar container to services running in the deployment pipeline and provide TLS termination, better observability, better logging for some services.
As more services move into the deployment pipeline, that is a kubernetes, these two use cases will converge into one.
Building envoy for WMF
Envoy community has presented recently https://www.getenvoy.io/ an envoy proxy distribution that offers amongst other artifacts, when we started to consider envoy that distribution channel didn't exist at that time. Unfortunately, the deb packages they provide are quite incomplete.
Ship a new version
Clone the upstream envoy repository, and export an archive for the revision you want to package
$ export REF=v1.11.2 # use your own version here $ git clone https://github.com/envoyproxy/envoy.git $ pushd envoy && git archive --format=tar $REF | gzip > ../envoyproxy_$REF.orig.tar.gz $ popd
Now clone operations/debs/envoyproxy, and import the tar archive you generated. This repository includes the envoy source code and the debian control files. It has been created using gbp and using it is recommended. There is an upstream branch including the original source code from the GitHub repo and multiple upstream tags pointing to each imported version, a master branch that is the result of applying the latest upstream tag and possibly the development version of debian control files, after that several wikimedia-DIST branches which points to build packages to an specific distribution branch.
$ mkdir WMF && cd WMF $ USER="yourgerrituser" git clone "ssh://$USER@gerrit.wikimedia.org:29418/operations/debs/envoyproxy" && scp -p -P 29418 $USER@gerrit.wikimedia.org:hooks/commit-msg "envoyproxy/.git/hooks/" $ pushd envoyproxy $ gbp import-orig ../../envoyproxy_$REF.orig.tar.gz $ git push upstream $ git push --tag
Now merge the new version in the wikimedia-stretch branch, create a new changelog entry, and push this as well.
Build the package on the WMF infrastructure
For building a new envoy debian package you should follow this steps.
- get access to the packaging project in Horizon, ask a project admin if you don't know who it is ask in #wikimedia-sre.
- Add your ssh public key (not the same one you use for production) under Preferences > OpenStack on Wikitech.
- ssh into builder-envoy.packaging.eqiad.wmflabs
- go to
/usr/src/envoyproxyand pull the master branch and upstream tags:
git checkout master && git fetch --tags && git pull --force --rebase
- Run the
/mnt/build_envoy.sh $DISTROscript, where
$DISTROshould be the distribution code name.
- The envoy building workflow is complex and involves running some docker containers and internet access, because of that this package cannot be build in our build servers. It uses a patched-up version of what pbuilder does, just done manually.
- If the build process goes well, your new packages will be under
- The process leaves behind a 100+-GB artifact, which you should clean up:
rm /tmp/envoy-docker-build(If you need to rebuild for any reason, leave the file in place: the build will use it to run incrementally if appropriate, and will complete much faster.)
- Copy the output files from