Uses synapse to expose Docker web apps to ELBs
- Allows a pinned port to be exposed to ELBs (they can only configured to look for back-end listener on specific ports, and they don't seem to be particularly resilient to changing conditions among their listeners).
- Allows us to deploy new web app containers without dropping connections. Since the ELBs need pinned ports for their back-ends, you can't easily spin up a new container while the old one is still running. This balances connections between old and new during that period.
- Translates public URLs to Immutant-friendly URLs via its synapse/haproxy config. For example, it will translate http://ballotscout.org/foo?bar=1 to http://[immutant-host]:8080/ballot-scout/foo?bar=1.
- Put your config file in
conf/config.json
docker build -t quay.io/democracyworks/synapse-balancer .
docker run -d -p 60800:80 quay.io/democracyworks/synapse-balancer
If you want to support more than one config in different environments, you have a couple of different options:
- Bake in multiple config files and choose one at runtime:
- Put your configs (named anything you want) in the
conf
dir. - Build a new Docker image to pick up your configs.
- Append the name of your config file to the end of the docker run command
(WITHOUT the
conf/
prefix).
- Put your configs (named anything you want) in the
- Mount your config(s) as a volume:
- In your docker run command, add a
--volume /path/to/your/configs:/usr/src/synapse-balancer/conf
and then append the filename of the config file you want to run to your docker run command.
- In your docker run command, add a