This is a simple Nginx load balancer that runs against 3 Docker containers. Each container runs a simple Hono.js server on port 3000
, while Docker compose is used to map these ports to 3001
, 3002
and 3003
. This load balancer is deployed on Oracle Cloud using Terraform to provision a VM and Ansible to configure the VM.
- Nginx
- Docker
- Docker Compose
- Hono JS
- Terraform view source
- Ansible view source
Make sure you have Nginx and Docker installed on your machine.
First, build and start the containers using docker-compose
:
docker-compose up --build -d
Next, you need to replace the default nginx.conf
on your machine with the one provided in this here. This file should be located at C:/nginx/conf/nginx.conf
on Windows and /etc/nginx/nginx.conf
on MacOS.
Then, start up Nginx on Windows using:
cd path/to/nginx
nginx.exe
Or this if you're on a Mac:
sudo nginx
Finally, open your browser and go to http://localhost:8080
to see the response. Each time you refresh, the server that sends the response will change.