[Feat]: Ability to customize service name per container/port
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
### 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--.livecycle.run/
https://service-a-ui-8081--.livecycle.run/
```
I'd like the ability to override the urls to anything I would like: i.e.
```
# for service-a 8080
https://api--.livecycle.run/
# for service-a 8081
https://metrics--.livecycle.run/
```
Ideally, this would still work with the service discovery and PREEVY_BASE_URL documented [here](https://preevy.dev/recipes/service-discovery#example)
### 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
Contributor guide
Research direction
Start by tracing how the existing preevy.expose label is parsed and how service discovery and PREEVY_BASE_URL derive exposed URLs. Implement the optional name=port syntax, ensure duplicate names are rejected, and verify that customized URLs still work with service discovery.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, typescript
- Domain
- cli, cloud, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100