From 96aaa2aed43cd8bf6835e971d67b782d9f135388 Mon Sep 17 00:00:00 2001 From: Jean Khawand <22157081+jeankhawand@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:35:21 +0200 Subject: [PATCH] Update base images and introduce health endpoint (#3273) * Update base images and introduce health endpoint sync-server: introduce `/health` endpoint to check if the service is reachable. bump(alpine): bump alpine base image from `3.19` to `3.20` bump(rust): bump rust-alpine build image from `1.76` to `1.79` * fix cargo fmt * add allow clippy::extra_unused_type_parameters * Remove unused type param (dae) * Route /health directly (dae) * Fix for latest axum (dae) --- docs/syncserver/Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/syncserver/Dockerfile b/docs/syncserver/Dockerfile index 72bb9ba4b5f..8482f0e1c0e 100644 --- a/docs/syncserver/Dockerfile +++ b/docs/syncserver/Dockerfile @@ -1,14 +1,14 @@ -FROM rust:1.76-alpine3.19 AS builder +FROM rust:1.79-alpine3.20 AS builder ARG ANKI_VERSION="23.12.1" RUN apk update && apk add --no-cache build-base protobuf && rm -rf /var/cache/apk/* RUN cargo install --git https://github.com/ankitects/anki.git \ - --tag ${ANKI_VERSION} \ - --root /anki-server \ - anki-sync-server +--tag ${ANKI_VERSION} \ +--root /anki-server \ +anki-sync-server -FROM alpine:3.19.1 +FROM alpine:3.20 RUN adduser -D -h /home/anki anki @@ -25,8 +25,9 @@ EXPOSE ${SYNC_PORT} CMD ["anki-sync-server"] -# TODO - consider exposing endpoint /health to check on health cause currently it will return 404 error -# HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ -# CMD wget -qO- http://localhost:${SYNC_PORT} || exit 1 +# This health check will work for Anki versions 24.06.3 and newer. +# For older versions, it may incorrectly report an unhealthy status, which should not be the case. +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD wget -qO- http://localhost:${SYNC_PORT}/health || exit 1 LABEL maintainer="Jean Khawand " \ No newline at end of file