# Envoy, NGINX, and WSGI [Envoy](https://www.envoyproxy.io/), a [CNCF gradutated project](https://www.cncf.io/projects/#fws_5f44766fd58b5:~:text=Envoy), is a reverse-proxy and load-balancer for cloud native and standalone use. Big projects like [istio](https://istio.io/), [linkerd](https://linkerd.io/), and [contour](https://projectcontour.io/) are built on top of envoy. Above anything, performance is probably the greatest concern when it comes to reverse-proxies and load-balancers. Informal benchmarks, such as [this](https://www.loggly.com/blog/benchmarking-5-popular-load-balancers-nginx-haproxy-envoy-traefik-and-alb/), often show that the performance of envoy is on par with big players like [HAProxy](http://www.haproxy.org/) and [nginx](https://www.nginx.com/). Benchmarking envoy is [hard](https://www.envoyproxy.io/docs/envoy/latest/faq/performance/how_to_benchmark_envoy). However, it is still a good choice if its [design goals](https://www.envoyproxy.io/docs/envoy/latest/intro/what_is_envoy) suit your need. ## Installation Envoy provides the [getenvoy](https://www.getenvoy.io/install/envoy/) installation portal, which has connections to [tetrate](https://www.tetrate.io/open-source-contributions/). The getenvoy [installation tutorial for CentOS](https://www.getenvoy.io/install/envoy/centos/) is, in fact, written for CentOS 7. In the tutorial, the `yum-utils` package is first installed to make the `yum-config-manager` command available. According to the [Fedora doc](https://docs.fedoraproject.org/en-US/Fedora/23/html/System_Administrators_Guide/sec-Managing_DNF_Repositories.html), the `config-manager` subcommand built into `dnf` provides the same functionality as `yum-config-manager`. Hence, on CentOS 8, it is as easy as: ``` dnf config-manager --add-repo https://getenvoy.io/linux/centos/tetrate-getenvoy.repo dnf install -y getenvoy-envoy ``` Check the version with the following command to make sure that it agrees with the highest stable version number shown [here](https://www.envoyproxy.io/docs), i.e., the number right under *latest*. ``` envoy --version ``` # WSGI Pronounced *whisgee* (with a hard *g*, making it sound like whiskey), [WSGI](https://wsgi.readthedocs.io/en/latest/what.html) is a [python standard](https://www.python.org/dev/peps/pep-3333/) describing the interaction of a backend python application with a front-facing HTTP server, which is basically an improved CGI aimed for python. [js-sequence-diagrams](https://bramp.github.io/js-sequence-diagrams/) ```sequence client->"reverse\nproxy": HTTP "reverse\nproxy"->"WSGI\nserver": HTTP "WSGI\nserver"->"python\napp": wsgi ``` [mermaid](https://mermaid-js.github.io/mermaid/#/sequenceDiagram) ```mermaid sequenceDiagram participant client participant gw as reverse<br/>proxy participant man as process<br/>manager participant wsgi as WSGI<br/>server participant app as python<br/>app rect rgb(240,240,240) Note left of client: basic client ->> wsgi : HTTP wsgi ->> app : wsgi end rect rgb(240,240,240) Note left of client: TLS termination client ->> gw : HTTPS gw ->> wsgi : HTTP wsgi ->> app : wsgi end rect rgb(240,240,240) Note left of client: HA client ->> gw : HTTPS gw ->> man : HTTP man ->> wsgi : UDS wsgi ->> app : wsgi end ``` [PlantUML](https://plantuml.com/sequence-diagram) ```plantuml @startuml participant client participant envoy as gw box "WSGI server" #LightBlue participant circus as man participant "chausette/bjoem" as wsgi end box participant "keystone-api-server" as app client ->> gw : HTTPS gw ->> man : HTTP man ->> wsgi : UDS wsgi ->> app : wsgi @enduml ``` ## Installation Create a python virtual environment first; see [Python Virtual Environment](/1c9dEuD-QoyM3J6JvwOG6Q) instructions. I'll call it *wsgi*. Update *pip* and install *wheel*, *six*: ``` pip install --upgrade pip pip install wheel six ``` Install the main tools: ``` pip install circus chaussette bjoern ``` *bjoern* build failed with missing header `ev.h`. Install `libev-devel` then rebuid `bjoern`: ``` sudo dnf install libev-devel pip install bjoern ```