Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Epic] docksal/vhost-proxy 2.0 #29

Open
1 of 3 tasks
lmakarov opened this issue Jun 29, 2018 · 0 comments
Open
1 of 3 tasks

[Epic] docksal/vhost-proxy 2.0 #29

lmakarov opened this issue Jun 29, 2018 · 0 comments

Comments

@lmakarov
Copy link
Member

lmakarov commented Jun 29, 2018

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

  • be a reverse-proxy
  • support scripting/plugins
  • support HTTP/2
  • support LetsEncrypt
  • talk to Docker via API

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant