uffizzi
uffizzi copied to clipboard
Expose multiple ports from a service
Tell us about your request Based on the requirements for an integration PoC for Meilisearch I want to be able to expose two ports from the container. One port will be the terminal accessible from the browser and the other will be the port from where the service itself can be accessed from.
Which service(s) is this request for? Both
Describe the solution you'd like A configuration in the docker-compose would be hopefully future proof would look like.
x-uffizzi:
ingress:
service: meilisearch
port: 7681 # default port
expose:
- service: meilisearch
ports:
- "3000:7700"
- service: frontend
ports:
- "3001:7700"
In the above ingress
spec would cover the default endpoint. UFFIZZI_URL:80 will point to this.
The expose
spec is a list which would contain other services/ports to be exposed. In the above example, the first service is the same default service exposed at ingress
but the container is different. The ports
directive will give all the ports exposed from the container. It should be possible to forward requests from one port exposed on the ingress to a different port on the container. In this case requests coming to UFFIZZI_URL:3000 would be forwarded to the 7700 port of the meilisearch container. Similarly for the next example, requests coming to UFFIZZI_URL:3001 would be forwarded to the 7700 port of the frontend container.
Are both of these ports serving HTTP? Or other TCP services? UDP?
Uffizzi only supports a single HTTP service. This assumption is baked into our entire stack.
If these are HTTP, you can probably add an HTTP load balancer like nginx
to multiplex their traffic. For example, https://example.app.uffizzi.com/
could go to the frontend
container and requests for https://example.app.uffizzi.com/meilisearch/
could go to the other container.
Docker Compose already supports both expose
and ports
syntaxes (See a description of the differences here). We don't need to nest it under x-uffizzi
.
They are both sub-elements of the service definition which can include a list of ports. For example:
myservice:
image: foo:latest
ports:
- "3000"
- "3000-3005"
- "8000:8000"
- "9090-9091:8080-8081"
- "49100:22"
myservice:
image: foo:latest
expose:
- "3000"
- "8000"
I don't think the ports
and expose
keywords do anything on Uffizzi. All of a deployment's containers share the same IP network stack within the same k8s Pod.
If these are HTTP, you can probably add an HTTP load balancer like nginx to multiplex their traffic. For example, https://example.app.uffizzi.com/ could go to the frontend container and requests for https://example.app.uffizzi.com/meilisearch/ could go to the other container.
@axisofentropy yes both are HTTP services. It is a good idea I can try that. It just might work for them.
I don't think the ports and expose keywords do anything on Uffizzi. All of a deployment's containers share the same IP network stack within the same k8s Pod.
@gadkins I agree with @axisofentropy here.
On another note can this multiplexing be a part of the uffizzi configuration. It would be a pain to write the nginx config and build a new nginx image everytime. Would be nice to have the multiplexing be a part of the uffizzi config