准备入坑Anki,翻翻资料和手头存货,发现有几个问题要解决
- Raspberry上装了OSMC,不想删也不想动
- OSMC现在不支持64位,所以Raspberry 3B+ 上
cat /proc/cpuinfo
看到的还是ARMv7
人生苦短,感觉还是要用Dokcer来解决,装好后遇到2.1.19版与最新的mpv有兼容性问题,换成2.1.20发现也是可以sync的。
Date | AnkiDesktop version | AnkiDroid version | ankisyncd version | Tester |
---|---|---|---|---|
2020-02-06 | 2.1.19 | 2.9.1 | 2.1.0 + 2bfccf7f | kuklinistvan |
按照惯例,先上docker-compose.yml
version: "3.7"
services:
anki-sync-server:buildbuild
##下面的image是在Raspberry上build出来的,docker hub上的并非ARM版
image: anki-sync-server:tsudoko-ankisyncd-2.1.0-plus-2bfccf7f
restart: always
ports:
- "27701:27701"
volumes:
- $PWD/data:/app/data
那么怎么自己build一个OSMC上的Anki Sync Server image呢?
- Clone 代码
git clone https://github.com/ankicommunity/anki-sync-server.git
- 修改Dockerfile
cd docker-anki-sync-server/Docker/
vi Dockerfile
修改成arm32v7版的python,没找到python:3.7.0-alpine3.8, 只能用最接近的python:3.7.2-alpine3.9了
FROM library/python:3.7.0-alpine3.8
FROM arm32v7/python:3.7.2-alpine3.9
- 创建自己的image
cd docker-anki-sync-server/Docker/
## 这里会自动从ankisyncd pull 对应版本(2.1.0 + 2bfccf7f),感谢作者
./build.sh
- 启动Sync Server, 创建自己的user
docker-compose up --no-start
docker-compose start
docker exec -it anki-sync-server /bin/sh
/app/anki-sync-server # ./ankisyncctl.py adduser yourname
- 在Anki里配置Sync Server
- Launch Anki
- Go to Tools > Add-ons
- Click Get Add-ons...
- Reference the SyncRedirector plugin with the code 2124817646
- If you use docker-anki-sync-server on an external server or custom >port:
- Select SyncRedirector and click Config
- Configure your sync urls
- Restart Anki - optionally check your console output.
Plugin site: https://ankiweb.net/shared/info/2124817646
如果要在Sync Server前加个Nginx代理的话,记得设置client_max_body_size
, 不然sync的时候会提示deck太大无法sync
location /msync {
proxy_pass http://xxx.xxx.xxx:27701/msync;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /sync {
proxy_pass http://xxx.xxx.xxx:27701/sync;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}