Browse Source

health checks for docker

pull/539/head
Kyle Spearrin 6 years ago
parent
commit
f78b212aa8
  1. 6
      .editorconfig
  2. 3
      src/Admin/Dockerfile
  3. 3
      src/Api/Dockerfile
  4. 8
      src/Billing/Controllers/HomeController.cs
  5. 8
      src/Events/Controllers/CollectController.cs
  6. 3
      src/Events/Dockerfile
  7. 3
      src/Icons/Dockerfile
  8. 3
      src/Identity/Dockerfile
  9. 11
      src/Notifications/Controllers/SendController.cs
  10. 3
      src/Notifications/Dockerfile

6
.editorconfig

@ -105,4 +105,8 @@ csharp_new_line_before_else = true @@ -105,4 +105,8 @@ csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_anonymous_types = true
# All files
[*]
guidelines = 120

3
src/Admin/Dockerfile

@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden" @@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gosu \
curl \
libcurl3 \
&& rm -rf /var/lib/apt/lists/*
@ -15,4 +16,6 @@ COPY obj/Docker/publish . @@ -15,4 +16,6 @@ COPY obj/Docker/publish .
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
HEALTHCHECK CMD curl -f http://localhost:5000 || exit 1
ENTRYPOINT ["/entrypoint.sh"]

3
src/Api/Dockerfile

@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden" @@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gosu \
curl \
libcurl3 \
&& rm -rf /var/lib/apt/lists/*
@ -15,4 +16,6 @@ COPY obj/Docker/publish/Api . @@ -15,4 +16,6 @@ COPY obj/Docker/publish/Api .
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
HEALTHCHECK CMD curl -f http://localhost:5000/alive || exit 1
ENTRYPOINT ["/entrypoint.sh"]

8
src/Billing/Controllers/HomeController.cs

@ -6,6 +6,14 @@ namespace Billing.Controllers @@ -6,6 +6,14 @@ namespace Billing.Controllers
{
public class HomeController : Controller
{
[HttpGet("~/alive")]
[HttpGet("~/now")]
[AllowAnonymous]
public DateTime GetAlive()
{
return DateTime.UtcNow;
}
/*
[Authorize]
public IActionResult Index()

8
src/Events/Controllers/CollectController.cs

@ -32,6 +32,14 @@ namespace Bit.Events.Controllers @@ -32,6 +32,14 @@ namespace Bit.Events.Controllers
_cipherRepository = cipherRepository;
}
[HttpGet("~/alive")]
[HttpGet("~/now")]
[AllowAnonymous]
public DateTime GetAlive()
{
return DateTime.UtcNow;
}
[HttpPost]
public async Task<IActionResult> Post([FromBody]IEnumerable<EventModel> model)
{

3
src/Events/Dockerfile

@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden" @@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gosu \
curl \
libcurl3 \
&& rm -rf /var/lib/apt/lists/*
@ -15,4 +16,6 @@ COPY obj/Docker/publish/Events . @@ -15,4 +16,6 @@ COPY obj/Docker/publish/Events .
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
HEALTHCHECK CMD curl -f http://localhost:5000/alive || exit 1
ENTRYPOINT ["/entrypoint.sh"]

3
src/Icons/Dockerfile

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

3
src/Identity/Dockerfile

@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden" @@ -5,6 +5,7 @@ LABEL com.bitwarden.product="bitwarden"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gosu \
curl \
libcurl3 \
&& rm -rf /var/lib/apt/lists/*
@ -15,4 +16,6 @@ COPY obj/Docker/publish . @@ -15,4 +16,6 @@ COPY obj/Docker/publish .
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
HEALTHCHECK CMD curl -f http://localhost:5000/.well-known/openid-configuration || exit 1
ENTRYPOINT ["/entrypoint.sh"]

11
src/Notifications/Controllers/SendController.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Bit.Core.Utilities;
@ -19,6 +20,14 @@ namespace Bit.Notifications @@ -19,6 +20,14 @@ namespace Bit.Notifications
_hubContext = hubContext;
}
[HttpGet("~/alive")]
[HttpGet("~/now")]
[AllowAnonymous]
public DateTime GetAlive()
{
return DateTime.UtcNow;
}
[HttpPost("~/send")]
public async Task PostSend()
{

3
src/Notifications/Dockerfile

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

Loading…
Cancel
Save