docker / awesome-compose

Awesome Docker Compose samples
https://docs.docker.com/compose/
Creative Commons Zero v1.0 Universal
34.57k stars 6.64k forks source link

nginx-nodejs-redis: add dev envs config #276

Closed milas closed 2 years ago

milas commented 2 years ago
milas commented 2 years ago

Marked this one as a draft because I'm not sure it makes sense to include in its current state.

The sample wants two web backends, presumably to show that the state is in fact stored in Redis. It achieves this pretty hackily by duplicating the config instead of using deploy.replicas. I tried to switch to that but I think there's a Compose enhancement needed here - DNS does not behave as expected in this case 😢

Thoughts?

glours commented 2 years ago

@milas, I tried to use

    deploy:
      replicas: 2
    ports:
      - 81-82:5000

and remove the web2 service in compose and nginx conf, but I randomly hit a port collision between the 2 replicase 😬 (that shouldn’t happen, I'll see if we can fix that on compose side quickly)

milas commented 2 years ago

The port bindings aren't really needed since we have the nginx proxy - remove those & launch again and then look at DNS aliases

They both get referred to as web or their "fully qualified" name with the project name (which we can't use since we can't predict that)

I was hoping there'd be web-1 and web-2 DNS aliases to use in the nginx upstream

milas commented 2 years ago

Regardless, the development UX is kind of weird since there will be two containers and you have to pick one arbitrarily to develop in, but then the other one will still serve ~50% of requests

milas commented 2 years ago

Closing this - we're going to skip this one for now as it's not a good fit!