ankicommunity / anki-devops-services

Anki Sync Server with Docker - and it works!
GNU General Public License v3.0
257 stars 29 forks source link

"error decoding response body" on sync in macos #47

Open arupakaa opened 2 years ago

arupakaa commented 2 years ago

Hi,

Thanks for the awesome work with all of this. I just wish I could get it setup properly on my end ... :'(

Any chance a super-noob friendly guide can be thrown out by someone? I am on mac/osx. Docker installed fine. anki-sync-server installed fine to Docker. Cool. And it runs. And the CLI button provides a prompt that allows me to setup an account.

Great.

However, I cannot connect to this server. I am guessing it might have something to do with the directory not being set up properly? But, really, I have no clue. Any chance for a step-by-step -- e.g., the steps to reproduce the "test" mentioned in RM?

Thanks in advance! <3 <3

VikashKothary commented 2 years ago

Hi @aruberuku, I'll be happy to help. We're always looking for opportunities to improve our documentation to make the set up process as easy as possible.

First question: how you had a look at this existing tutorials?

  1. We should cover how to setup the anki-sync-server: https://ankicommunity.github.io/Tutorials/Docker/Howto/
  2. And how to configure the desktop and Android clients to use the server: https://ankicommunity.github.io/Tutorials/anki_custom_sync_server/

If you can let me know at which part you're getting stuck we can work through it together.

arupakaa commented 2 years ago

Hi @VikashKothary,

I took another look at the guide you provided and managed to successfully setup the server. However, on synch, I am now getting the "error decoding response body" error described here:

https://forums.ankiweb.net/t/error-decoding-response-body-sync-error/1316/12

edit, here is my console output:

[2022-01-28 07:19:52,460]:INFO:ankisyncd.http:127.0.0.1 "GET / HTTP/1.1" 200 16 [2022-01-28 07:19:56,980]:INFO:ankisyncd.http:172.17.0.1 "GET /msync/begin?k=d45ad3d80c550041d79504988867b640&v=anki%2C2.1.49+%28dc80804a%29%2Cmac%3A10.16 HTTP/1.1" 403 157 [2022-01-28 07:19:57,027]:INFO:ankisyncd.CollectionThread[useraccount]:Running meta(*[], **{'v': 10, 'cv': 'anki,2.1.49 (dc80804a),mac:10.16'}) [2022-01-28 07:19:57,029]:INFO:ankisyncd.http:172.17.0.1 "POST /sync/meta HTTP/1.1" 200 99 [2022-01-28 07:19:57,577]:INFO:ankisyncd.http:127.0.0.1 "GET / HTTP/1.1" 200 16

and, here's a screenshop of what the macos client reports:

image

Any suggestions? Thanks in advance!

VikashKothary commented 2 years ago

Hi @arupakaa, this is a known issue, see: https://github.com/ankicommunity/anki-sync-server/issues/117 and https://github.com/ankicommunity/anki-sync-server/issues/56.

Can you confirm you're using the latest develop branch?

arupakaa commented 2 years ago

Thanks. I'll try in a bit, or probably again over the next couple of day.s

On Tue, May 17, 2022 at 7:27 AM Vikash Kothary @.***> wrote:

Hi @arupakaa https://github.com/arupakaa, this is a known issue, see: ankicommunity/anki-sync-server#117 https://github.com/ankicommunity/anki-sync-server/issues/117 and ankicommunity/anki-sync-server#56 https://github.com/ankicommunity/anki-sync-server/issues/56.

Can you confirm you're using the latest develop branch?

— Reply to this email directly, view it on GitHub https://github.com/ankicommunity/anki-devops-services/issues/47#issuecomment-1128198389, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOJJYPDXVKPCML3HNGLKH3VKLDVFANCNFSM5M5H5UXA . You are receiving this because you were mentioned.Message ID: @.***>

kevinsung commented 2 years ago

@VikashKothary Which docker image should we use? The README links to https://hub.docker.com/r/kuklinistvan/anki-sync-server but that was last updated two yeras ago.

VikashKothary commented 2 years ago

You can now find the latest docker images here: https://hub.docker.com/r/ankicommunity/anki-sync-server

kevinsung commented 2 years ago

Thanks, I tried that image, but then the instructions in the README don't seem to apply anymore: image

Specifically, the line

/app/anki-sync-server # ./ankisyncctl.py --help

is no longer applicable.

VikashKothary commented 2 years ago

Yes I apologies, that is my mistake. I was refactoring the CLI and broke backward-compatibility. You can see that discussion here: https://github.com/ankicommunity/anki-sync-server/issues/128.

You can see the same issue about the CLI here: https://github.com/ankicommunity/anki-devops-services/issues/48

Zocker1999NET commented 2 years ago

Could these be reflected in the README.md? It took me some time to find this issue regarding that the Docker image url changed. I can propose a change myself if you don't have enough time, however I might not have enough knowledge about this project because I started using it an hour ago

VikashKothary commented 2 years ago

Hi @Zocker1999NET, thank you for bringing this to my attention.

You flagging that information in the README is out-of-date really helps me know where to focus my efforts so it's much appreciated. If you can raise a PR, that would be very welcome. If not, I'll try and update the README when I next have time.

piotryordanov commented 2 years ago

@VikashKothary in the meantime, could you tell us how to make it run? unfortunately, the current configuration doesn't even run :(

cc: @Zocker1999NET

michojel commented 2 years ago

@piotryordanov Although far from ideal, my current work-around is this: https://github.com/michojel/NixOS/blob/master/michowps/ankisyncd.nix#L76

piotryordanov commented 2 years ago

@michojel thx for the link. However, could you help me run this script? I never worked with nix os before! 🙈

michojel commented 2 years ago

Here is the generated /etc/systemd/system/docker-ankisyncd.service:

[Unit]
After=docker.service
Description=Anki Sync Server
Requires=docker.service

[Service]
Environment="LOCALE_ARCHIVE=/nix/store/r4jm7wfirgdr84zmsnq5qy7hvv14c7l7-glibc-locales-2.34-210/lib/locale/locale-archive"
Environment="PATH=/nix/store/7jr7pr4c6yb85xpzay5xafs5zlcadkhz-coreutils-9.0/bin:/nix/store/140f6s4nwiawrr3xyxarmcv2mk62m62y-findutils-4.9.0/bin:/nix/store/qd9jxc0q00cr7fp30y6jbbww20gj33lg-gnugrep-3.7/bin:/nix/store/lgvd2fh4cndlv8mnyy49jp1nplpml3xp-gnused-4.8/bin:/nix/store/k5blnxr0jrna87aig0pfjz0afkf9b3w9-systemd-250.4/bin:/nix/store/7jr7pr4c6yb85xpzay5xafs5zlcadkhz-coreutils-9.0/sbin:/nix/store/140f6s4nwiawrr3xyxarmcv2mk62m62y-findutils-4.9.0/sbin:/nix/store/qd9jxc0q00cr7fp30y6jbbww20gj33lg-gnugrep-3.7/sbin:/nix/store/lgvd2fh4cndlv8mnyy49jp1nplpml3xp-gnused-4.8/sbin:/nix/store/k5blnxr0jrna87aig0pfjz0afkf9b3w9-systemd-250.4/sbin"
Environment="TZDIR=/nix/store/n83qx7m848kg51lcjchwbkmlgdaxfckf-tzdata-2022a/share/zoneinfo"

ExecStart=/nix/store/4c571rkjks3llinrrk58v1qzipsygwq3-unit-script-docker-ankisyncd-start/bin/docker-ankisyncd-start 
ExecStartPre=/nix/store/qiiljpn9cigl7ang4fxs47xiwfgwckga-unit-script-docker-ankisyncd-pre-start/bin/docker-ankisyncd-pre-start
ExecStop=/nix/store/6z9ixsrsa9vjwlhlg01xrpy5vznxvmsb-unit-script-docker-ankisyncd-pre-stop/bin/docker-ankisyncd-pre-stop
Restart=always
TimeoutStartSec=30

ExecStart script:

#!/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash
set -e
# TODO: fix protobof issues instead of using python implementation
# TODO: set PYTHONPATH on the image
/nix/store/1dvhsx6l4mjx4nk4hs9l6yf8is26b800-docker-20.10.17/bin/docker run -u 62384:62384 --rm --name ankisyncd \
    -v /var/lib/private/ankisyncd:/srv/ankisyncd:rw \
    -v /nix/store/p76davgdny7ihvzk5dvz34ps4146mc0j-ankisyncd.conf:/opt/ankisyncd/ankisyncd.conf:ro \
    -e PYTHONPATH=/opt/ankisyncd \
    -e PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
    -e ANKISYNCD_SESSION_DB_PATH=/srv/ankisyncd/session.db \
    -e ANKISYNCD_AUTH_DB_PATH=/srv/ankisyncd/auth.db \
    -p 27701:27701 \
    docker.io/michojel/anki-sync-server:latest

ExecPreStart:

#!/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash
set -e
/nix/store/1dvhsx6l4mjx4nk4hs9l6yf8is26b800-docker-20.10.17/bin/docker stop ankisyncd 2>/dev/null ||:
/nix/store/1dvhsx6l4mjx4nk4hs9l6yf8is26b800-docker-20.10.17/bin/docker rm   ankisyncd 2>/dev/null ||:
/nix/store/1dvhsx6l4mjx4nk4hs9l6yf8is26b800-docker-20.10.17/bin/docker pull docker.io/michojel/anki-sync-server:latest

ExecStop:

#!/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash
set -e
/nix/store/1dvhsx6l4mjx4nk4hs9l6yf8is26b800-docker-20.10.17/bin/docker stop ankisyncd ||:

You may want to replace docker.io/michojel/anki-sync-server:latest with the official one or the one built by you.