Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Add ability to use network aliases #1492

Open
dziedrius opened this issue Dec 12, 2022 · 2 comments
Open

Add ability to use network aliases #1492

dziedrius opened this issue Dec 12, 2022 · 2 comments
Labels

Comments

@dziedrius
Copy link

What should we add or change to make your life better?

Docker compose has ability to add network aliases like this:

tests.mock.proxy:
    container_name: tests.mock.proxy
    image: nginx
    networks:
      default:
        aliases:
          - api.to-be.mocked.com
          - orders.local.domain.com

meaning, that I can access my services by DNS names - which might serve at least couple purposes:

  • I can have url's using similar schema to ones in production.
  • I can mock third party services, if their official clients do not support using different uri and need valid ssl certificates.
  • Single container might handle requests from multiple host names.

Why is this important to you?

Currently we have two configs - docker-compose and tye just because we can't fully control host names in tye and we need that for our integration tests, as we need to mock out several third party APIs.

@dziedrius dziedrius added the idea label Dec 12, 2022
@davidfowl
Copy link
Member

Can you share your nginx config as well? Are you doing host name routing to other local services that mock out those APIs?

@dziedrius
Copy link
Author

dziedrius commented Dec 13, 2022

Sure, currently used nginx config looks something like this:

server {    
    listen 443 ssl;

    ssl_certificate     /etc/nginx/certs/server.crt;
    ssl_certificate_key /etc/nginx/certs/server.key;
    
    location / {
        proxy_pass https://host.docker.internal:5055;
    }
}

Where host.docker.internal:5055 is WireMock server running in tests and pretending to be one or another mocked API.
We're using self signed certificate, which we trust in other containers.

Currently we're not using routing to other local services, but that is due the fact, that for development locally we use tye for it's faster startup/easier debugging and docker-compose only for integration tests due to ability to do network aliases.
If tye would support network aliases, I think we would use routing to local services too, as we like to have same url schema as in prod (hence in IIS we use host names too - like api.local.domain.com).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants