Switching Docker Reverse Proxy from dockge-gen to OpenResty
Posted on
I give up to continue to use a docker-gen, although it is convenient for us to create a Nginx config file automatically. If a docker-gen unit has been killed every other related units are killed. I decide to switch our reverse proxy from docker-gen and nginx to OpenResty and Redis combination.
I give up to continue to use a docker-gen, although it is convenient for us to create a Nginx config file automatically. If a docker-gen unit has been killed every other related units are killed. I decide to switch our reverse proxy from docker-gen and nginx to OpenResty and Redis combination.
Create Project
The openresty-moin project directory contains Dockerfile which extends 3scale/openresty. The directory structure is below.
The nginx.conf file is used in the Supvervisor config file with -c flag. This nginx.conf forces HTTP connections redirect to HTTPS. Using a enbedded Lua script it determines a upstream URL from Reds record dynamically.
Finally I cerate a OpenResty unit file which replaces docker-gen and Nginx unit files. In order to avoid docker-gen related complex unit dpendencies, I compile a handy single OpenResty container.