Healtcheck endpoint on anki-sync-server

This issue concerns the self-hosted sync server (git hub dot com/ankitects/anki/tree/main/docs/syncserver).

After the update to 24.11, the healthcheck endpoint should work. However, building using the provided Dockerfile or the docker hub images (hub dot docker dot com/r/jeankhawand/anki-sync-server) creates a healthcheck endpoint that still returns unhealthy no matter what.

I was able to fix it making the following change to the Dockerfile:

- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
-     CMD wget -qO- http://localhost:${SYNC_PORT}/health || exit 1
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
+     CMD wget -qO- http://0.0.0.0:${SYNC_PORT}/health || exit 1

Perhaps this is due to my configuration, but it may be worth documenting this possible fix it if not done already.

My configuration:

  • Anki sync server running in docker
  • Nginx running on Ubuntu 24.04.1 LTS host (not containerized)

docker-compose.yml:

services:
  anki-server-sync:
    build:
      context: .
      args:
        ANKI_VERSION: 24.11
    image: anki-server-sync:latest
    environment:
      SYNC_PORT: 5805
      SYNC_USER1: ***:***
      SYNC_USER2: ***:***
    ports:
      - 5805:5805
    volumes:
    - ./syncserver:/home/anki/.syncserver
    restart: unless-stopped

Dockerfile: see change above relative to the source file (git hub dot com/ankitects/anki/blob/main/docs/syncserver/Dockerfile)

Nginx config:

upstream anki-livesync {
        server 127.0.0.1:5805;
}

server {
        listen 443 ssl;
        server_name ***;
        ssl_certificate     cert/domain.cert.pem;
        ssl_certificate_key cert/private.key.pem;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_ciphers         HIGH:!aNULL:!MD5;

                location / {
                        proxy_pass http://anki-livesync;
                        proxy_set_header    Host            $host;
                        proxy_set_header    X-Real-IP       $remote_addr;
                        proxy_set_header    X-Forwarded-for $remote_addr;
                        proxy_set_header        X-Forwarded-Proto       $scheme;
                        client_max_body_size 100M;
                }
}
1 Like

I’ve made a note where the PR author should see it: Add distroless Dockerfile and implement internal health check by jeankhawand · Pull Request #3366 · ankitects/anki · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.