feat: add Traefik routing labels for customer apps with exposed ports
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,17 @@ public class DeploymentService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build Traefik labels for inbound routing
|
||||||
|
var labels = new java.util.HashMap<String, String>();
|
||||||
|
if (app.getExposedPort() != null) {
|
||||||
|
labels.put("traefik.enable", "true");
|
||||||
|
labels.put("traefik.http.routers." + containerName + ".rule",
|
||||||
|
"Host(`" + app.getSlug() + "." + env.getSlug() + "."
|
||||||
|
+ tenantSlug + "." + runtimeConfig.getDomain() + "`)");
|
||||||
|
labels.put("traefik.http.services." + containerName + ".loadbalancer.server.port",
|
||||||
|
String.valueOf(app.getExposedPort()));
|
||||||
|
}
|
||||||
|
|
||||||
var containerId = runtimeOrchestrator.startContainer(new StartContainerRequest(
|
var containerId = runtimeOrchestrator.startContainer(new StartContainerRequest(
|
||||||
deployment.getImageRef(),
|
deployment.getImageRef(),
|
||||||
containerName,
|
containerName,
|
||||||
@@ -141,7 +152,7 @@ public class DeploymentService {
|
|||||||
runtimeConfig.parseMemoryLimitBytes(),
|
runtimeConfig.parseMemoryLimitBytes(),
|
||||||
runtimeConfig.getContainerCpuShares(),
|
runtimeConfig.getContainerCpuShares(),
|
||||||
runtimeConfig.getAgentHealthPort(),
|
runtimeConfig.getAgentHealthPort(),
|
||||||
Map.of()
|
labels
|
||||||
));
|
));
|
||||||
|
|
||||||
deployment.setOrchestratorMetadata(Map.of("containerId", containerId));
|
deployment.setOrchestratorMetadata(Map.of("containerId", containerId));
|
||||||
|
|||||||
Reference in New Issue
Block a user