Browse Source

healthcheck for attachments server

pull/539/head
Kyle Spearrin 7 years ago
parent
commit
0793cb6167
  1. 5
      util/Attachments/Dockerfile
  2. 7
      util/Server/Startup.cs

5
util/Attachments/Dockerfile

@ -5,11 +5,14 @@ LABEL com.bitwarden.product="bitwarden" @@ -5,11 +5,14 @@ LABEL com.bitwarden.product="bitwarden"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gosu \
&& rm -rf /var/lib/apt/lists/*
curl \
&& rm -rf /var/lib/apt/lists/*
ENV ASPNETCORE_URLS http://+:5000
EXPOSE 5000
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
HEALTHCHECK CMD curl -f http://localhost:5000/alive || exit 1
ENTRYPOINT ["/entrypoint.sh"]

7
util/Server/Startup.cs

@ -33,6 +33,7 @@ namespace Bit.Server @@ -33,6 +33,7 @@ namespace Bit.Server
{
if(configuration.GetValue<bool?>("serveUnknown") ?? false)
{
app.Map("/alive", HandleMapAlive);
app.UseStaticFiles(new StaticFileOptions
{
ServeUnknownFileTypes = true,
@ -70,8 +71,14 @@ namespace Bit.Server @@ -70,8 +71,14 @@ namespace Bit.Server
}
else
{
app.Map("/alive", HandleMapAlive);
app.UseFileServer();
}
}
private static void HandleMapAlive(IApplicationBuilder app)
{
app.Run(async context => await context.Response.WriteAsync(System.DateTime.UtcNow.ToString()));
}
}
}

Loading…
Cancel
Save