Based on:
/@vinodkrane/microservices-scaling-and-load-balancing-using-docker-compose-78bf8dc04da9
it is possible to have 2 or more copies of a docker compose service. My "original" service (named nodeserver) runs a node server running the next script:
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!');
console.log(req);
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
The question is: If I use
docker compose up --scale nodeserver=3
how could I modify my script to find out if it is running "orchestrated" by a load balancer and the respective mirror it is working from?