When I try to start Anki with SYNC_USER1=user:pass anki --syncserver Anki does not start and I must press Ctrl + C
Anki starting…
2024-11-16T10:57:50.888891Z INFO listening addr=0.0.0.0:8080
^CTraceback (most recent call last):
File “anki.syncserver”, line 14, in run_sync_server
File “anki._backend”, line 93, in syncserver
Exception
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 1, in
File “aqt”, line 38, in
File “anki.syncserver”, line 14, in run_sync_server
KeyboardInterrupt
If I set https://localhost::8080/ under Self-hosted sync server option I receive this warning: Invalid sync server specified. Please check the preferences.
I just want to confirm, which of the following are you trying to do?
Run the custom sync server directly on your local PC.
Run it inside a Docker container.
If it’s option 1, you don’t need to refer to the link you provided. Just follow the instructions on this page.
Anki starting…
2024-11-16T10:57:50.888891Z INFO listening addr=0.0.0.0:8080
These lines indicate that the custom sync server has started correctly. If you’d like to run the Anki desktop client on the same PC, simply start Anki in a separate command session.
If it’s option 2, you can follow the instructions in the link you provided, and run the following steps to start the custom sync server:
Build the Docker image with the docker build command. Make sure to configure <Dockerfile> and <version> appropriately in the command.
If you want to start the server using the docker compose up command, my previous post might be helpful.
If I set https://localhost::8080/ under Self-hosted sync server option I receive this warning: Invalid sync server specified. Please check the preferences.
The documentation says that “The server listens on an unencrypted HTTP connection”, so try replacing https with http.
There are various ways to achieve that, but I think one of the simplest methods is to configure a reverse proxy using Caddy. From this thread, it appears you’ve already experimented with Nginx, but if your goal is just to enable HTTPS, Caddy is much easier to configure. You can refer to the documentation here: Automatic HTTPS — Caddy Documentation.
Here’s an example configuration:
First, get your own domain name (if you don’t already have one).
Next, here is an example setup for an Anki custom sync server with Caddy:
Finally, make sure to enter https://your.domain.name in the sync server field in the Anki client settings (for Desktop, AnkiDroid, or AnkiMobile). There’s no need to include a port number (it should work even if you explicitly specify port 443).
FROM rust:1.82.0-alpine3.20 AS builder
ARG ANKI_VERSION
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
FROM alpine:3.20.2
RUN adduser -D -h /home/anki anki
COPY --from=builder /anki-server/bin/anki-sync-server /usr/local/bin/anki-sync-server
RUN apk update && apk add --no-cache bash && rm -rf /var/cache/apk/*
USER anki
ENV SYNC_PORT=${SYNC_PORT:-"8080"}
EXPOSE ${SYNC_PORT}
CMD ["anki-sync-server"]
# This health check will work for Anki versions 24.08.x 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 <jk@jeankhawand.com>"
@hkr Do you see the issue. I would like to have the server in my local network first and in next step I’ll move to a cloud server. Before I would like to see that all is working…
Can you look in the ./caddy/data folder on your host and see if there’s a certificate there for you to install? But right now I have it set up with Traefik so there shouldn’t be any trouble there at least (in regards to Anki sync-server with reverse proxies).