Features/add health (#10)
* updated the api to have a basic health check * docker-compose.yaml was updated to add health check
This commit is contained in:
parent
b4768b7cff
commit
9425348974
@ -7,6 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="6.0.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Core" Version="6.0.5" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.33" />
|
||||
<PackageReference Include="Hangfire.MemoryStorage" Version="1.7.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.0" />
|
||||
|
@ -25,6 +25,9 @@ builder.Services.AddHangfire(f => f.UseMemoryStorage());
|
||||
builder.Services.AddHangfireServer();
|
||||
GlobalConfiguration.Configuration.UseSerilogLogProvider();
|
||||
|
||||
builder.Services.AddHealthChecks()
|
||||
.AddNpgSql(config.GetValue<string>(ConfigConnectionStringConst.Database) ?? "");
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
@ -48,6 +51,7 @@ SetupRecurringJobs(config, Log.Logger);
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapHealthChecks("/health");
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
@ -21,9 +21,9 @@ services:
|
||||
- db:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: [ “CMD-SHELL”, “pg_isready” ]
|
||||
interval: "1s"
|
||||
timeout: "5s"
|
||||
retries: 10
|
||||
interval: "1m"
|
||||
timeout: "30s"
|
||||
retries: 5
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
@ -62,6 +62,11 @@ services:
|
||||
|
||||
# If you want to collect news on Final Fantasy XIV, set this to true
|
||||
FFXIV__IsEnabled: false
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
|
||||
interval: "1m"
|
||||
timeout: "30s"
|
||||
retries: 5
|
||||
ports:
|
||||
- "5001:5000"
|
||||
networks:
|
||||
|
Loading…
Reference in New Issue
Block a user