You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a parent issue for the docksal/vhost-proxy 2.0 work.
1.x state
docksal/vhost-proxy is based on https://github.com/jwilder/nginx-proxy, which uses nginx as a reverse proxy to route requests to multiple running containers on a host. It uses docker-gen to interact with the Docker API, reacts to container start/stop events and uses Go templates to generate configuration files for nginx, then reload nginx configuration.
We are basically calling a shell script with Lua inside an nginx process, which takes the Host header of an HTTP request and wakes up a matching project in real-time, all in the context of the initial HTTP request.
Calling a shell script upon a HTTP request is a dirty hack, but it has been doing its job well enough for several years at this point.
2.0 vision
While hacks do work, they should be replaced with more solid solutions at some point.
The main goal for 2.0 would be to replace the proxyctl script with pure Lua.
Unfortunately, there is no official Docker API Lua library, so we may have to write one.
There is this Luarocks module, which may be useful. We may also want to implement out own Lua module to interact with Docker via its HTTP API
General high level requirements for docksal/vhost-proxy
This is a parent issue for the docksal/vhost-proxy 2.0 work.
1.x state
docksal/vhost-proxy
is based on https://github.com/jwilder/nginx-proxy, which uses nginx as a reverse proxy to route requests to multiple running containers on a host. It uses docker-gen to interact with the Docker API, reacts to container start/stop events and uses Go templates to generate configuration files for nginx, then reload nginx configuration.We added some magic to teach
vhost-proxy
to start stopped projects/containers on-demand:https://github.com/docksal/service-vhost-proxy/blob/develop/conf/nginx/lua/proxyctl.lua#L65
We are basically calling a shell script with Lua inside an nginx process, which takes the
Host
header of an HTTP request and wakes up a matching project in real-time, all in the context of the initial HTTP request.Calling a shell script upon a HTTP request is a dirty hack, but it has been doing its job well enough for several years at this point.
2.0 vision
While hacks do work, they should be replaced with more solid solutions at some point.
The main goal for 2.0 would be to replace the
proxyctl
script with pure Lua.Unfortunately, there is no official Docker API Lua library, so we may have to write one.
There is this Luarocks module, which may be useful. We may also want to implement out own Lua module to interact with Docker via its HTTP API
General high level requirements for
docksal/vhost-proxy
The first 3 we already have.
LetsEncrypt is in a working POC phase (using https://github.com/GUI/lua-resty-auto-ssl).
Other options
We could switch to a different solution altogether, so long as it covered the high level requirements above and is open source.
Here's a list of potential options:
TODOs
proxyctl
shell script into an OpenResty Lua moduleThe text was updated successfully, but these errors were encountered: