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