kuklinistvan / docker-anki-sync-server Goto Github PK
View Code? Open in Web Editor NEWAnki Sync Server with Docker - and it works!
License: GNU General Public License v3.0
Anki Sync Server with Docker - and it works!
License: GNU General Public License v3.0
Syncing with AnkiDroid works
When trying to use the Windows Desktop client (Version 2.1.22) and the SyncRedirector plugin with this config:
{
"msyncUrl": "http://192.168.2.80:27701/msync/",
"syncUrl": "http://192.168.2.80:27701/sync/"
}
(Username and password has been put into the authentication pop up.)
I'm getting the following error message whenever a sync is triggered:
"Your client is using unsupported sync protocol (10, supported version: 9)
Followed by this error:
AnkiWeb ID or password was incorrect; please try again.
Logs from docker container:
[2020-04-03 10:23:02,669]:INFO:ankisyncd.CollectionThread[user]:Running meta(*[], **{'v': 10, 'cv': 'ankidesktop,2.1.22 (0ecc189a),win:10'})
[2020-04-03 10:24:32,762]:INFO:ankisyncd.ThreadingCollectionManager:Monitor is closing collection on inactive CollectionThread[user]
This issue is about your plugin SyncRedirector
(2124817646), not docker-anki-sync-server
. SyncRedirector
can support earlier versions of anki.
My client is windows, and the server is tsudoko/anki-sync-server
(not using your docker-anki-sync-server
).
First of all, I installed 2.1.15. I want to use SyncRedirector
, but the version 2.1.15 is not supported..
After that, I installed 2.1.22, and I can use SyncRedirector
.
But I have another problem:"Your client is using unsupported sync protocol (10, supported version: 9)". This may be because 2.1.22 is too new. This may require tsudoko/anki-sync-server
to provide support.
So I switched back to 2.1.15 and found that SyncRedirector
could still be used.
As for tsudoko/anki-sync- server
, the author stated in README that 2.1.1 to 2.1.11 can be supported, and my tests show that 2.1.15 and 2.1.16 are also possible.
So I think SyncRedirector
can also support versions after 2.1.1.
Maybe you can make the "min_point_version": 19
in SyncRedirector
's meta.json
a little smaller.
In this way, more versions can use it.
ankisyncd.conf found
auth.db found
collections directory exists
Starting tsudoko's anki-sync-server
[2019-08-11 12:22:26,842]:INFO:ankisyncd:Loaded config from /app/anki-sync-server/ankisyncd.conf
[2019-08-11 12:22:26,842]:INFO:ankisyncd.users:Found auth_db_path in config, using SqliteUserManager for auth
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/app/anki-sync-server/ankisyncd/main.py", line 11, in
ankisyncd.sync_app.main()
File "/app/anki-sync-server/ankisyncd/sync_app.py", line 663, in main
ankiserver = SyncApp(config)
File "/app/anki-sync-server/ankisyncd/sync_app.py", line 401, in init
self.user_manager = get_user_manager(config)
File "/app/anki-sync-server/ankisyncd/users.py", line 202, in get_user_manager
return SqliteUserManager(config['auth_db_path'], config['data_root'])
File "/app/anki-sync-server/ankisyncd/users.py", line 49, in init
self._ensure_schema_up_to_date()
File "/app/anki-sync-server/ankisyncd/users.py", line 63, in _ensure_schema_up_to_date
raise Exception("Outdated database schema, run utils/migrate_user_tables.py")
Exception: Outdated database schema, run utils/migrate_user_tables.py
I'm getting the following error when trying to test this with the docker image running locally:
Syncing failed:
Traceback (most recent call last):
File "/usr/share/anki/aqt/sync.py", line 340, in run
self._sync()
File "/usr/share/anki/aqt/sync.py", line 365, in _sync
self.hkey = self.server.hostKey(*self.auth)
File "/usr/share/anki/anki/sync.py", line 599, in hostKey
self.hkey = json.loads(ret.decode("utf8"))['key']
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This is on a new deck in the anki gui. When I click sync, it asks me for the username and password (which I set up by entering the running image) and then immediately gives me the above error.
The documentation for the config on Android says:
specify the same two urls you've specified on the desktop client.
For me this did not work. I had to leave out /sync
in the url to get AnkiDroid to log in.
I testet this on AnkiDroid 2.9, 2.9.1 and 2.9.5. They all came up with a network error when trying to sign in with http://192.168.0.10:27701/sync
. Anki on Windows (2.1.15) works perfectly fine with http://192.168.0.10:27701/sync/
I was receiving the error at #12 whilst attempting to login on Anki 2.1.15-1, after manually installing the SyncRedirector addon (at ~/.local/share/Anki2/addons21
) as the addon on the website doesn't support that Anki version, and setting up the config.json with the values listed, e.g. http://domain.com/sync
and http://domain.com/msync
.
I decided to update to Anki 2.1.23-1 as it's available in the Arch Linux Community-Testing repository, which fixed the error I was receiving above.
EDIT: I've since reinstalled Anki 2.1.23-1 and found that updating wasn't what fixed #12. The reason for this issue (for me) was because I had http://domain.com/sync
and http://domain.com/msync
and not https://domain.com/sync
and https://domain.com/msync
- switching to https solved this issue for me, given that domain.com is https only.
However, I now receive a new error when attempting to login (no matter what the username and password input is):
Syncing failed:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/aqt/sync.py", line 397, in run
self._sync()
File "/usr/lib/python3.8/site-packages/aqt/sync.py", line 420, in _sync
self.hkey = self.server.hostKey(*self.auth)
File "/usr/lib/python3.8/site-packages/anki/sync.py", line 571, in hostKey
ret = self.req(
File "/usr/lib/python3.8/site-packages/anki/sync.py", line 554, in req
self.assertOk(r)
File "/usr/lib/python3.8/site-packages/anki/sync.py", line 487, in assertOk
raise Exception("Unknown response code: %s" % resp.status_code)
Exception: Unknown response code: 404
I've tried every combination of http://domain.com/sync
, http://domain.com/
, http://domain.com
, etc on config.json - assuming it was to do with reaching a 404 on domain.com, however that made no difference.
For reference, when visiting these URLs in a browser:
http://domain.com/
displays Anki Sync Server
.
http://domain.com/sync
and http://domain.com/msync
both return 404.
This is a fresh install using docker-compose and nginx (with a reverse proxy from 127.0.0.1:27701 to domain.com), hosted on a server.
Any help would be appreciated, thanks for your hard work. :)
Reproduction (what did you do - the more details you give, the better):
显示插件无法使用,需要anki的版本小于某个版本才行。什么时候可以更新插件?增加对新版本的支持?
The display plug-in is not available and requires a smaller version of anki. When can the plug-in be updated? Add support for the new version?
What was expected to happen:
What happened instead (the more details you give, the better):
Hi folks!
Thanks so much for this awesome software and packaging. Works like a dream on Ankidroid now!
I installed SyncDirector on Anki 2.1 on my mac, and I set up the urls
{
"msyncUrl": "https://anki-sync-server.coldbloomlabs.com/msync/",
"syncUrl": "https://anki-sync-server.coldbloomlabs.com/sync/"
}
Please note these work fine on Ankidroid.
When I try to log in on Anki for macOS, I get the following error in Anki
Syncing failed:
Traceback (most recent call last):
File "aqt/sync.py", line 342, in run
File "aqt/sync.py", line 367, in _sync
File "anki/sync.py", line 581, in hostKey
File "json/init.py", line 354, in loads
File "json/decoder.py", line 339, in decode
File "json/decoder.py", line 357, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
and the following request in the server logs.
2019-05-02T21:42:12.368269003Z app[web.1]: [2019-05-02 21:42:12,367]:INFO:ankisyncd.http:172.17.0.1 "POST /5sync/hostKey HTTP/1.1" 200 16
I think that 5 is incorrect... where is it coming from?!
Any thoughts?
Because Anki 2.1.9 requires recent updates of tsudoko/anki-sync-server.
I've run your build.sh locally and it runs fine. Thanks in advance.
Problem:
(also, on DockerHub, the name of tsudoko is misspelled)
This issue is sort of a reminder for myself.
Is there a particular reason for not wanting to add Docker support directly to tsudoku/anki-sync-server and adding the Docker setup docs to a file there (or the wiki)? I have just submitted a PR reorganising the code for better extensibility (tsudoko/anki-sync-server#13), and support for configuring all values via environment variables (tsudoko/anki-sync-server#14). It would be great to centralise our efforts to Make Ankisyncd Great Again :-).
Reproduction (what did you do - the more details you give, the better):
Install Anki desktop version (mac) I've tried 2.1.15, 2.1.23, 2.1.15
What was expected to happen:
Be able to install SyncRedirector via the extension # (2124817646)
What happened instead (the more details you give, the better):
Anki gives an error saying that the plugin doesn't support my current Anki version
Luckily you have 2.1.19 linked on your github page, as I wasn't able to find it on apps.ankiweb.net.
Just wanted to let you know. Thanks!
Hey , Thank you for all your hand work.
I created https://github.com/ankicommunity to allow a team of maintainers to work together to help maintain the original anki-sync-server and other projects like it.
I recently found this project and can see all the hard work you've put into dockerizing the @tsudoko's project. I want to offer my help and would love if you'd consider moving this project to our organisation. We've currently forked your repo but it would be great to have your say in upcoming improvements.
Also see: tsudoko/anki-sync-server#70.
Hi Istvan!
Thanks for you great work here.
However, I can only get to run the sync-server via the kitematic GUI of the Docker Toolbox (regular x64 Docker does not work on W10 Home).
When I create the anki-sync-server repo from you repo (btw. you don't have "latest" tag in your repo), the server runs.
But I cannot figure out how to access the container now and setup the user, collection etc.
Am I missing something?
Thank you
Syncing failed:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 156, in _new_conn
conn = connection.create_connection(
File "/usr/lib/python3.8/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/lib/python3.8/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 665, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.8/http/client.py", line 1230, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1276, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1225, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1004, in _send_output
self.send(msg)
File "/usr/lib/python3.8/http/client.py", line 944, in send
self.connect()
File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 168, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f98d8304730>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 719, in urlopen
retries = retries.increment(
File "/usr/lib/python3.8/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=27701): Max retries exceeded with url: /sync/hostKey (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f98d8304730>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/share/anki/aqt/sync.py", line 342, in run
self._sync()
File "/usr/share/anki/aqt/sync.py", line 367, in _sync
self.hkey = self.server.hostKey(*self.auth)
File "/usr/share/anki/anki/sync.py", line 575, in hostKey
ret = self.req(
File "/usr/share/anki/anki/sync.py", line 556, in req
r = self.client.post(self.syncURL()+method, data=body, headers=headers)
File "/usr/share/anki/anki/sync.py", line 440, in post
return self.session.post(
File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=27701): Max retries exceeded with url: /sync/hostKey (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f98d8304730>: Failed to establish a new connection: [Errno 111] Connection refused'))
Running the basic command: docker run -it --mount type=bind,source="$ANKI_SYNC_DATA_DIR",target=/app/data -p 27701:27701 --name anki-container --rm kuklinistvan/anki-sync-server:latest
I get
standard_init_linux.go:211: exec user process caused "exec format error"
According to what I'm seeing it looks like it could be related to https://stackoverflow.com/questions/42494853/standard-init-linux-go178-exec-user-process-caused-exec-format-error
I'm ssh'ing into the pi from windows. I get the same result when running directly on the pi from a terminal though, for the record.
Hi folks!
I tried this today. I created a new user, logged in successfully in Ankidroid, and synced. It says it synced the collection fine, but failed syncing the media data.
Collection synchronized
Error syncing media data
org.json.JSONException: Value Anki of type java.lang.String cannot be converted to JSONObject
I tried it a few times, and it's consistent.
I am on AnkiDroid 2.8.4.
terminal imput:
docker run -it
--mount type=bind,source="$ANKI_SYNC_DATA_DIR",target=/app/data
-p 27701:27701
--name anki-container
--rm
kuklinistvan/anki-sync-server:latest
and then:
http://127.0.0.1:27701/msync/
but got:
172.17.0.1 - - [15/Dec/2019 08:46:20] "GET /msync/ HTTP/1.1" 403 157
172.17.0.1 - - [15/Dec/2019 08:46:20] "GET /favicon.ico HTTP/1.1" 200 16
Thanks.
Hey!
I am getting the same error message, but I already double-checked that there are no trailing slashes.
There is a logged request and it looks a lot like the requests made by my desktop, but it ends in 200 16 and not 200 52, if that is useful at all.
Originally posted by @kunberg in #5 (comment)
Thanks very much for this great project.
I've got your container running, and have Anki Desktop running on my Windows 10 desktop and Anki Desktop running on my MacOS Mojave laptop, with the plugin installed and configured with my anki sync server's IP. I'm able to curl the page from the Mac:
$ curl http://192.168.11.60:27701/msync
Anki Sync Server
$ curl http://192.168.11.60:27701/sync
Anki Sync Server
I've got a user set up on the anki sync server and profiles of the same name configured on each machine, but nothing appears to be syncing; cards made on one machine don't show up on the other machine, and my data/collections/ directory is empty:
root@foinix:/gnosis/AppData/ankisyncd/data/collections/ndroftheline# ls
root@foinix:/gnosis/AppData/ankisyncd/data/collections/ndroftheline#
so I'm afraid I've missed something, anything you can recommend I try?
Thanks again!
Reproduction (what did you do - the more details you give, the better): Using docker-anki-sync-server in anki latest version
What was expected to happen: SyncRedirector do not support the version
What happened instead (the more details you give, the better):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.