Skip to content

Modern Docker Management, Designed for Everyone

fix: add /api/health endpoint to agent mode

Kyle Mendell83f0bc0b3305
diff --git a/backend/internal/bootstrap/router_bootstrap.go b/backend/internal/bootstrap/router_bootstrap.go
index fe2799984..ec077455e 100644
--- a/backend/internal/bootstrap/router_bootstrap.go
+++ b/backend/internal/bootstrap/router_bootstrap.go
@@ -64,6 +64,7 @@ func setupRouter(cfg *config.Config, appServices *Services) *gin.Engine {
apiGroup := router.Group("/api")
if cfg.AgentMode {
+ api.NewHealthHandler(apiGroup)
api.NewEnvironmentHandler(apiGroup, appServices.Environment, appServices.Container, appServices.Image, appServices.ImageUpdate, appServices.Updater, appServices.Network, appServices.Volume, appServices.Stack, appServices.Settings, authMiddleware, cfg)
return router
}
diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.go
index f86350120..9c5143b27 100644
--- a/backend/internal/services/environment_service.go
+++ b/backend/internal/services/environment_service.go
@@ -125,7 +125,8 @@ func (s *EnvironmentService) TestConnection(ctx context.Context, id string) (str
}
client := &http.Client{Timeout: 10 * time.Second}
- req, err := http.NewRequestWithContext(ctx, http.MethodGet, environment.ApiUrl+"/health", nil)
+ url := strings.TrimRight(environment.ApiUrl, "/") + "/api/health"
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
_ = s.updateEnvironmentStatus(ctx, id, string(models.EnvironmentStatusOffline))
return "offline", fmt.Errorf("failed to create request: %w", err)