Add note about anki and howto install a self hosted anki sync server.
This commit is contained in:
96
20220319091825-anki.org
Normal file
96
20220319091825-anki.org
Normal file
@@ -0,0 +1,96 @@
|
||||
:PROPERTIES:
|
||||
:ID: 97d8c2d9-a539-4f0b-ad2e-953bf7845e8c
|
||||
:mtime: 20220319160846
|
||||
:ctime: 20220319091825
|
||||
:END:
|
||||
#+title: anki
|
||||
|
||||
* Introduction
|
||||
TODO
|
||||
|
||||
* Installer son serveur Anki
|
||||
** Howto
|
||||
*** On the server:
|
||||
#+BEGIN_SRC shell
|
||||
# Get last version source code.
|
||||
cd /opt/
|
||||
ROOT=/opt/anki-sync-server
|
||||
mkdir ${ROOT}
|
||||
chown ubuntu ${ROOT}
|
||||
git clone https://github.com/ankicommunity/anki-sync-server.git
|
||||
cd ${ROOT}
|
||||
git checkout tags/v2.3.0
|
||||
|
||||
# Prépare virtual environment.
|
||||
PATH=/home/ubuntu/.local/bin:$PATH
|
||||
virtualenv .
|
||||
. bin/activate
|
||||
make init
|
||||
|
||||
# Create first user
|
||||
./src/ankisyncctl.py adduser <user>
|
||||
|
||||
# Edit daemon config file.
|
||||
CONFIG_PATH=${ROOT}/src/ankisyncd.conf
|
||||
sed -i 's/port = 27701/port = 27702/' ${CONFIG_PATH}
|
||||
sed -i 's/host = 0.0.0.0/host = 127.0.0.1/' ${CONFIG_PATH}
|
||||
|
||||
# Configure ngingx
|
||||
cat >/etc/nginx/sites-available/anki-sync-server <<EOF
|
||||
server {
|
||||
server_name anki.adrien.run;
|
||||
|
||||
# Increase timeouts for XXL collections through slow bandwidth
|
||||
proxy_read_timeout 3000;
|
||||
proxy_connect_timeout 3000;
|
||||
proxy_send_timeout 3000;
|
||||
|
||||
# log files
|
||||
access_log /var/log/nginx/anki-sync-server.access.log;
|
||||
error_log /var/log/nginx/anki-sync-server.error.log;
|
||||
|
||||
# Handle / requests
|
||||
location / {
|
||||
proxy_http_version 1.0;
|
||||
proxy_pass http://127.0.0.1:27702/;
|
||||
client_max_body_size 222M;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
ln -s /etc/nginx/sites-available/anki-sync-server /etc/nginx/sites-enabled/
|
||||
systemctl reload nginx
|
||||
|
||||
# Generate certificates signed by certbot
|
||||
certbot --nginx -d anki.adrien.run
|
||||
systemctl reload nginx
|
||||
|
||||
# Add systemd service
|
||||
cat>/etc/systemd/system/anki-sync-server.service <<EOF
|
||||
Description=Anki sync server
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/anki-sync-server
|
||||
ExecStart=/opt/anki-sync-server/bin/python /opt/anki-sync-server/src/ankisyncd/__main__.py
|
||||
Restart=on-abort
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable anki-sync-server.service
|
||||
systemctl start anki-sync-server.service
|
||||
#+END_SRC
|
||||
|
||||
*** For AnkiDroid:
|
||||
Update configuration (in menu parameters/advanced/Custom sync server):
|
||||
* URL: https://anki.adrien.run
|
||||
* Media URL: https://anki.adrien.run/msync
|
||||
|
||||
*** For Anki2.1
|
||||
Cf. https://github.com/ankicommunity/anki-sync-server#anki-21
|
||||
|
||||
** Références
|
||||
* [[https://github.com/ankicommunity/anki-sync-server][Github]]
|
||||
|
Reference in New Issue
Block a user