An example of running multiple instances locally, using nginx as a load balancer, and communicating between then with nats.
Using go 1.10+, run dep ensure to grab dependencies.
./nats.sh start
./nginx start./nginx copy
Currently, nginx conf is configured to use 2 upstream apps - port: 9051 and 9052. Open 2 terminals and run:
PORT=9051 ./distributedandPORT=9052 ./distributedCan also doPORT=xxxx bra runif have bra installed.
You can verify everything worked by curl localhost:9030 to hit the nginx which should then reverse proxy one of the upstream apps.
To add/remove servers, update ws.conf.