Prevent users from deploying fly tomls with duplicate service definitions
Change Summary
Users sometimes end up defining multiple services for the same protocol & port. This harmless mistake would cause health-checks to fail because of only one of these services get picked by flaps. To fix this, I'm introducing some client-side validation to flag these issues.
They would now see this warning/help text 👇
Service [tcp-1738] has 2 duplicate definitions. To resolve this, merge them into 1 service.
References https://community.fly.io/t/health-checks-failing-with-failed-to-get-vm/18077 https://community.fly.io/t/unable-to-perform-health-checks/19604 https://community.fly.io/t/health-checks-always-failing/19641/2
@gwuah do you know if this validation also checks if a http_service and a regular service use the same port? I feel like this could be a common source of misconception.
@lubien yes it does. The thing is, http services are actually tcp services. They are converted to tcp services in flyctl before we send them to flaps.
@dangra I think the process group remark is valuable, so I've added support for that. https://github.com/superfly/flyctl/pull/3522/commits/f0539a14e807bfae83d12905db509f20a4c0a365 Duplicate external ports however, I think we can ignore them for now and merge this.