diff --git a/launchpad.toml b/launchpad.toml index 738cbac..65a5e1b 100644 --- a/launchpad.toml +++ b/launchpad.toml @@ -143,11 +143,15 @@ environment = [ volumes = ["./keys:/app/keys", "./settings/ring.json:/app/appsettings.json"] expose = ["${RING_PORT}", "${RING_ALTPORT}"] networks = ["solar-network"] +[services.prod.healthcheck] +test = ["CMD", "curl", "-f", "http://localhost:${RING_PORT}/health"] +interval = "10s" +timeout = "5s" +retries = 5 [services.prod.depends_on] cache = { condition = "service_healthy" } queue = { condition = "service_healthy" } - [[services]] name = "pass" type = "dotnet" @@ -168,7 +172,7 @@ networks = ["solar-network"] [services.prod.depends_on] cache = { condition = "service_healthy" } queue = { condition = "service_healthy" } - +ring = { condition = "service_healthy" } [[services]] name = "sphere" @@ -190,7 +194,7 @@ networks = ["solar-network"] [services.prod.depends_on] cache = { condition = "service_healthy" } queue = { condition = "service_healthy" } - +ring = { condition = "service_healthy" } [[services]] name = "drive" @@ -212,7 +216,7 @@ networks = ["solar-network"] [services.prod.depends_on] cache = { condition = "service_healthy" } queue = { condition = "service_healthy" } - +ring = { condition = "service_healthy" } [[services]] name = "develop" @@ -234,7 +238,7 @@ networks = ["solar-network"] [services.prod.depends_on] cache = { condition = "service_healthy" } queue = { condition = "service_healthy" } - +ring = { condition = "service_healthy" } [[services]] name = "insight" @@ -256,7 +260,7 @@ networks = ["solar-network"] [services.prod.depends_on] cache = { condition = "service_healthy" } queue = { condition = "service_healthy" } - +ring = { condition = "service_healthy" } [[services]] name = "zone" @@ -278,3 +282,4 @@ networks = ["solar-network"] [services.prod.depends_on] cache = { condition = "service_healthy" } queue = { condition = "service_healthy" } +ring = { condition = "service_healthy" } diff --git a/pkg/gateway/main.go b/pkg/gateway/main.go index 1485193..db25ab0 100644 --- a/pkg/gateway/main.go +++ b/pkg/gateway/main.go @@ -65,7 +65,7 @@ func main() { app := fiber.New(fiber.Config{ ServerHeader: "Turbine Gateway", - BodyLimit: 2147483647, // 2GB + BodyLimit: 2147483647, }) // Health check and status @@ -95,8 +95,8 @@ func main() { app.Use(from, func(c fiber.Ctx) error { instance, err := serviceDiscovery.GetNextInstance(serviceName) if err != nil { - log.Error().Err(err).Str("service", serviceName).Msg("Failed to get service instance for override") - return c.Status(fiber.StatusServiceUnavailable).SendString(err.Error()) + log.Info().Err(err).Str("service", serviceName).Msg("No service found") + return fiber.ErrNotFound } targetURL := fmt.Sprintf("http://%s/%s", instance, remainingPath) @@ -138,7 +138,7 @@ func main() { return c.Status(fiber.StatusServiceUnavailable).SendString(err.Error()) } - targetURL := fmt.Sprintf("http://%s/%s", instance, remainingPath) + targetURL := fmt.Sprintf("http://%s/api/%s", instance, remainingPath) if len(c.Request().URI().QueryString()) > 0 { targetURL = fmt.Sprintf("%s?%s", targetURL, string(c.Request().URI().QueryString())) }