0

I'm working on an application using flask and mysql, the application works great and it's already in production, for this I have several customers that will use it, therefore I'm using docker to isolate the instances (kubernetes in the near future), I've tested the approach using docker-compose.yaml and it works well, and deploys the application using a port like 5001 (customer 1), 5002 (customer 2), etc...

To forward the requests I've been using apache proxypass like this:

conf.d/customer1:
ProxyPass /customer1/myapp http://localhost:5001/
ProxyPassReverse /customer1/myapp http://localhost:5001/

conf.d/customer2:
ProxyPass /customer2/myapp http://localhost:5002/
ProxyPassReverse /customer2/myapp http://localhost:5002/

The steps to automate the docker deployment for new customers is fairly simple with Kubernetes (or plain docker), but the thing that I'm having struggles with is the apache configuration, having to change the site-avaiblable or reload the service to load new configuration files from a conf.d folder feels a bit rubbish, what I would love to have is something like:

ProxyPass /[customer]/myapp http://localhost:[port]/
ProxyPassReverse /[customer]/myapp http://localhost:[port]/

And have a way to externally map customer to port without having to restart or refresh apache, is there a way to do this?

Note: I'd to change from rewriterules to proxypass due to problems with url_for not taking the mapping properly. (there's a long discussion in SO about this)

  • Nothing wrong with reloading apache gracefully; or haproxy which IMHO is better suited for this. – wurtel May 15 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.