From a45eeae3f71de6541453667ef53924631a7cef45 Mon Sep 17 00:00:00 2001 From: Temirkhan Amanzhanov Date: Sat, 7 Mar 2026 17:42:38 +0100 Subject: [PATCH] Add health check --- AffirmationGenerator.Server/Program.cs | 3 +++ fly.toml | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/AffirmationGenerator.Server/Program.cs b/AffirmationGenerator.Server/Program.cs index 2ba99fb..c795853 100644 --- a/AffirmationGenerator.Server/Program.cs +++ b/AffirmationGenerator.Server/Program.cs @@ -5,6 +5,7 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddApi().AddApplication(builder.Configuration).AddInfrastructure(builder.Configuration); +builder.Services.AddHealthChecks(); // Configure the HTTP request pipeline. var app = builder.Build(); @@ -27,6 +28,8 @@ app.MapControllers(); +app.MapHealthChecks("/health"); + app.MapFallbackToFile("/index.html"); app.Run(); diff --git a/fly.toml b/fly.toml index 3ce6ec1..8c69bec 100644 --- a/fly.toml +++ b/fly.toml @@ -16,6 +16,13 @@ primary_region = 'ams' min_machines_running = 0 processes = ['app'] +[[http_service.checks]] + grace_period = "10s" + interval = "30s" + timeout = "5s" + method = "GET" + path = "/health" + [[vm]] memory = '1gb' cpus = 1