Companion container to nginx-proxy to generate upstream blocks for swarm services.
This container is a work in progress, and only the minimum needed to work with Meteor Up is done.
- Start nginx-proxy. It should be connected to the same overlay network that your services are on. Please note: Using separate containers is currently not supported. A modified nginx.tmpl is required to support custom upstream blocks.
- Run this image
docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
--volumes-from nginx-proxy \
--network proxy-overlay-network \
--name nginx-proxy-swarm-upstream \
--env NGINX_PROXY_CONTAINER="name-of-nginx-proxy-container" \
zodern/nginx-proxy-swarm-upstreamOnly the dnsrr endpoint mode is currently supported.
Sticky sessions are enabled, and use ip_hash.
nginx-proxy only looks at containers on the same server when creating the nginx config. For it to know about the service, the service should either have a task on the same server as the nginx-proxy, or you can run a container on the server with the correct environment variables (VIRTUAL_HOST, LETSENCRYPT_HOST, etc.). The service or container should also have the environment variable SWARM_SERVICE set to the name of the service. VIRTUAL_PORT should be used if the service does not listen on port 80.
For example, if you have the service named app running on different servers than nginx-proxy, you could create this container on the servers with nginx-proxy:
docker run \
--name proxy-configure-app \
-d \
--restart="always" \
-e "SWARM_SERVICE=app" \
-e "VIRTUAL_HOST=app.com" \
-e "LETSENCRYPT_HOST=app.com" \
-e "[email protected]" \
busybox:1.28.4 tail -f /dev/null- Support vip endpoint mode
- Allow sticky sessions to be customized
- Better error handling, and remove use of sync api's