The full stack - OpenResty, Circus and Flask
When you release microservices as Docker images, there are two strategies for including a web server.
The first one consists of ignoring it and exposing the Flask application directly. A web server like OpenResty could then run in its docker container, proxying calls to your Flask container.
However, if you are using some power features in nginx, like a Lua-based application firewall as we have seen in Chapter 7, Securing Your Services, it can be better to include everything within the same container, together with a dedicated process manager.
In the diagram that follows, the docker container implements the second strategy, and runs both the web server and the Flask service. Circus is used to launch and watch one nginx process and a few Flask processes:
In this section, we will implement this container by adding in our Dockerfile
the following steps:
- Download, compile, and install OpenResty.
- Add an nginx configuration file.
- Download and install Circus...