# Healtcheck endpoint on anki-sync-server

**URL:** <https://forums.ankiweb.net/t/healtcheck-endpoint-on-anki-sync-server/52582>\
**Category:** Syncing & AnkiWeb\
**Created:** [December 1, 2024, 4:29am UTC](https://forums.ankiweb.net/t/healtcheck-endpoint-on-anki-sync-server/52582 "2024-12-01T04:29:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bertogatti](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@bertogatti](https://forums.ankiweb.net/u/bertogatti)\
**Post date:** [December 1, 2024, 4:29am UTC](https://forums.ankiweb.net/t/healtcheck-endpoint-on-anki-sync-server/52582/1 "2024-12-01T04:29:42Z")

</div>

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:

```diff
- 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`:

```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:

```nginx
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;
                }
}

```

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [December 6, 2024, 10:03am UTC](https://forums.ankiweb.net/t/healtcheck-endpoint-on-anki-sync-server/52582/2 "2024-12-06T10:03:26Z")

</div>

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](https://github.com/ankitects/anki/pull/3366)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [January 5, 2025, 10:04am UTC](https://forums.ankiweb.net/t/healtcheck-endpoint-on-anki-sync-server/52582/3 "2025-01-05T10:04:16Z")

</div>

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