diff --git a/Dockerfile b/Dockerfile index 8cf0042a..4385fc2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,4 +88,4 @@ USER NetEvent # run WORKDIR /NetEvent CMD [ "/bin/sh", "-c", "start-container" ] -HEALTHCHECK --retries=3 --timeout=10s CMD curl --fail http://localhost:5000/healthcheck || exit \ No newline at end of file +HEALTHCHECK --retries=3 --timeout=5s CMD curl --fail http://localhost:5000/healthcheck || exit \ No newline at end of file diff --git a/NetEvent/Server/NetEvent.Server.csproj b/NetEvent/Server/NetEvent.Server.csproj index bf1c84e4..83738101 100644 --- a/NetEvent/Server/NetEvent.Server.csproj +++ b/NetEvent/Server/NetEvent.Server.csproj @@ -27,6 +27,7 @@ + diff --git a/NetEvent/Server/Program.cs b/NetEvent/Server/Program.cs index b4109fac..083cb2c7 100644 --- a/NetEvent/Server/Program.cs +++ b/NetEvent/Server/Program.cs @@ -12,11 +12,13 @@ case "sqlite": { builder.Services.AddDbContext(); + builder.Services.AddHealthChecks().AddDbContextCheck(); } break; case "psql": { builder.Services.AddDbContext(); + builder.Services.AddHealthChecks().AddDbContextCheck(); } break; default: @@ -52,7 +54,6 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); -builder.Services.AddHealthChecks(); var app = builder.Build(); diff --git a/docker-compose.yml b/docker-compose.yml index 1848bb77..ff9059d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: healthcheck: test: ["CMD-SHELL", "curl --fail http://localhost:5000/healthcheck || exit"] retries: 3 - timeout: 10s + timeout: 5s netevent_psql: image: 'postgres:latest' @@ -39,7 +39,7 @@ services: healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DBUser} -d ${DBName}"] retries: 3 - timeout: 10s + timeout: 5s networks: netevent: