This removes the need for some of the weird workarounds used in local development to publish private ports from workloads or resources that are usually only exposed to services within the docker network.
Now to access a workload port that doesn't have a dns+route to expose it, you can now use --publish <host port>:<workload name>:<container port> to add a port publish to the output compose.yaml file. This does not require that the port is set as a Score service port, therefore this can be used for things like debugging ports. For example, --publish 8080:my-workload:80 would publish a HTTP port to port 8080.
Now to access a resource port like a postgres, rabbitmq, or other resource that wouldn't be published externally you can use --publish <host port>:<resource uid>.output:<container port>. The expression in the middle allows you to select a resource service that usually has a dynamic hostname. For example --publish 5432:postgres#my-workload.db.host:5432 would expose the database db from workload my-workload.
Note, that these publish calls must be on the LAST request to score-compose generate since they apply to the final compose manifest.
I think this is better than the existing workarounds for doing this like:
Putting compose.score.dev/publish-port annotations in your score file
Using jq to examine and modify the compose file in place
Adding additional socat services to the compose.yaml
This removes the need for some of the weird workarounds used in local development to publish private ports from workloads or resources that are usually only exposed to services within the docker network.
Now to access a workload port that doesn't have a dns+route to expose it, you can now use
--publish <host port>:<workload name>:<container port>
to add a port publish to the output compose.yaml file. This does not require that the port is set as a Score service port, therefore this can be used for things like debugging ports. For example,--publish 8080:my-workload:80
would publish a HTTP port to port 8080.Now to access a resource port like a postgres, rabbitmq, or other resource that wouldn't be published externally you can use
--publish <host port>:<resource uid>.output:<container port>
. The expression in the middle allows you to select a resource service that usually has a dynamic hostname. For example--publish 5432:postgres#my-workload.db.host:5432
would expose the databasedb
from workloadmy-workload
.Note, that these publish calls must be on the LAST request to
score-compose generate
since they apply to the final compose manifest.I think this is better than the existing workarounds for doing this like:
socat
services to the compose.yaml