diff --git a/Dockerfile b/Dockerfile index c8db120..1971077 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,4 +57,8 @@ VOLUME ["/etc/pokertime"] # Set some defaults for a "direct run" experience ENV DATABASE__DATABASE "/app/data.db" ENV DATABASE__DATABASEPROVIDER Sqlite + +# ... health check +HEALTHCHECK CMD curl --fail http://localhost/health || exit + ENTRYPOINT [ "./launch", "run" ] \ No newline at end of file diff --git a/distscripts/ubuntu/launch b/distscripts/ubuntu/launch index 488c6b1..b5df770 100755 --- a/distscripts/ubuntu/launch +++ b/distscripts/ubuntu/launch @@ -13,7 +13,7 @@ function run { echo Starting application cd $POKERTIME_APP_DIR - ./PokerTime.Web + exec ./PokerTime.Web exit $? } diff --git a/src/PokerTime.Persistence/PokerTime.Persistence.csproj b/src/PokerTime.Persistence/PokerTime.Persistence.csproj index 9a7f708..7738788 100644 --- a/src/PokerTime.Persistence/PokerTime.Persistence.csproj +++ b/src/PokerTime.Persistence/PokerTime.Persistence.csproj @@ -16,6 +16,9 @@ + + + diff --git a/src/PokerTime.Persistence/ServiceCollectionExtensions.cs b/src/PokerTime.Persistence/ServiceCollectionExtensions.cs index c37cfc1..b97c731 100644 --- a/src/PokerTime.Persistence/ServiceCollectionExtensions.cs +++ b/src/PokerTime.Persistence/ServiceCollectionExtensions.cs @@ -19,6 +19,8 @@ public static IServiceCollection AddPersistence(this IServiceCollection services services.ChainInterfaceImplementation(); services.ChainInterfaceImplementation(); + services.AddHealthChecks().AddDbContextCheck(); + return services; } } diff --git a/src/PokerTime.Web/PokerTime.Web.csproj b/src/PokerTime.Web/PokerTime.Web.csproj index 6bc8726..bb8e674 100644 --- a/src/PokerTime.Web/PokerTime.Web.csproj +++ b/src/PokerTime.Web/PokerTime.Web.csproj @@ -1,4 +1,4 @@ - + True true diff --git a/src/PokerTime.Web/Startup.cs b/src/PokerTime.Web/Startup.cs index 5da8426..cceeb6f 100644 --- a/src/PokerTime.Web/Startup.cs +++ b/src/PokerTime.Web/Startup.cs @@ -93,6 +93,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF app.UseRouting(); app.UseEndpoints(endpoints => { + endpoints.MapHealthChecks("/health"); + endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); diff --git a/utils/install-app-prereqs.sh b/utils/install-app-prereqs.sh index ef18be5..ddd9900 100755 --- a/utils/install-app-prereqs.sh +++ b/utils/install-app-prereqs.sh @@ -10,5 +10,5 @@ function ensure_success { echo "Installing app prerequisites..." apt-get -qqy update -apt-get -qqy install libgdiplus +apt-get -qqy install libgdiplus curl ensure_success \ No newline at end of file