GabrielMelhem / URL-Shortener-MVP

0 stars 0 forks source link

Global Scalability-load-balancer #55

Closed GabrielMelhem closed 1 day ago

GabrielMelhem commented 1 day ago

Acceptance Criteria (ACs):

GabrielMelhem commented 1 day ago

Implemented Load Balancing by using Nginx

steps: 1- Define the Load Balancer Configuration http { upstream urlshortener_backend { least_conn; # Load balance based on the least number of connections server localhost:8080;
server localhost:8082;
server localhost:8083;
}

server {
    listen 80;
    server_name localhost;  

    location / {
        proxy_pass http://urlshortener_backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

}

2- define multiple instances of urlshortener service in Docker Compose

urlshortener1: build: . container_name: urlshortener1_container image: urshorterer:latest ports: