preevy
preevy copied to clipboard
[Feat]: Ability to customize service name per container/port
What feature?
I'd like to have the ability to rename/customize the service name that is given to a particular container/port combination.
For example a docker-compose file like this:
services:
service-a:
ports:
- 8080:8080
- 8081:8081
Gives two urls:
https://service-a-ui-8080-<branch>-<random>.livecycle.run/
https://service-a-ui-8081-<branch>-<random>.livecycle.run/
I'd like the ability to override the urls to anything I would like: i.e.
# for service-a 8080
https://api-<branch>-<random>.livecycle.run/
# for service-a 8081
https://metrics-<branch>-<random>.livecycle.run/
Ideally, this would still work with the service discovery and PREEVY_BASE_URL documented here
Describe the solution you'd like
The existing preevy.expose
label could be augmented to support an optional prefix of name=
Example:
preevy.expose: api=8080,metrics=8081
The only downside I can think of is if you might have multiple containers that would define a specific url, and this would have to be caught and have an error thrown (i.e. if two containers specified an api
port to expose). This is an example of an invalid config:
services:
service-a:
ports:
- 8080:8080
labels:
preevy.expose: api=8080
service-b:
ports:
- 7777:7777
labels:
# both containers use api, this would be invalid
preevy.expose: api=7777
Describe alternatives you've considered
- Currently the only way I can think of doing this is to rename my containers
Additional context
See https://livecyclecommunity.slack.com/archives/C05S50C9Z5F/p1707144759493989
Add screenshots
No response
Record
- [X] I agree to follow this project's Code of Conduct
@aleclerc-cio please see #426 for a broader discussion of container labels, feedback welcome!