microsoft / microsoft/aspire

Include a healthcheck binary for use in a docker compose environment

Open
#3,407 4 comments 5 reactions 1 assignee Claimed by @samsp-msft View on GitHub
area-dashboard
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

in order to have a healthcheck in docker compose we need a command that returns a 0 exit code.

we either need a dashboard sub-command (e.g. `dotnet /app/Aspire.Dashboard.dll readyz`) or an http client (e.g. `curl`) binary available inside the container.

a healthcheck endpoint should also be available, so we can use this in other places, like k8s.

for example, in this hypothetical docker compose file, I'm using `curl` (but a better approach would be to implement something equivalent of this example, but as a dashboard sub-command, e.g., `dotnet /app/Aspire.Dashboard.dll readyz`):

```yaml
# see https://github.com/compose-spec/compose-spec/blob/master/spec.md
# see https://github.com/opencontainers/image-spec/blob/master/annotations.md
services:
aspire-dashboard:
# see https://mcr.microsoft.com/product/dotnet/nightly/aspire-dashboard/about
# see https://github.com/dotnet/dotnet-docker/issues/5128
# see https://github.com/dotnet/aspire/issues/2248#issuecomment-1947902486
# see https://github.com/dotnet/aspire/tree/main/src/Aspire.Dashboard
image: mcr.microsoft.com/dotnet/nightly/aspire-dashboard:8.0.0-preview.5
environment:
- DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true
ports:
# web ui.
- 18888:18888
# otlp grpc.
#- 18889:18889
healthcheck:
test: ["CMD", "curl", "--silent", "--fail-with-body", "--max-time", "5", "http://localhost:18888/healthz/ready"]
interval: 15s
timeout: 5s
retries: 2
restart: on-failure
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.