Self hosting sync

Please provide some easy way to set up your own sync server. I can never use someone else’s computers to store the content that I have. It’s simply a legal thing. I have to study and know thousands of pages of protect government information, proprietary, and intellectual property. Cloud services hosted outside your own house are really only good for public domain content. For example, there’s a popular test question website that has lately gotten in trouble (and the uploaders) for hosting military classified information. The same thing happens where I work but with proprietary/intellectual property. They keep getting after us because employees are putting this kind of information on flashcard study cloud sites. I don’t want to get fired or go to jail for using Ankiweb. But this entire problem can be avoided if Anki could be entirely contained to my property behind encryption. Even if SSL is somehow breached, I’m still legally protected because the encryption component legally demonstrates that its private property and that the nefarious actor broke federal wiretapping laws to get the data.

To that end, I host my own NextCloud virtual machine behind an NGINX reverse proxy. It’s set up to do SSL and direct traffic to many different VMs. I know there’s a sync fork on GitHub but I can’t make it work. The instructions, or lack thereof, are outdated and don’t explain things in sufficient detail for those of us that only know enough to run a few CLI commands. Maybe creating a system where one could use NextCloud to host an Anki database would be ideal. This would eliminate the need to maintain a separate sync server. Also, a NextCloud plugin could exist that allows for online flashcards. However, under no circumstance should client applications be abandoned because off-line capability is an absolute necessity above all else.

1 Like

Have you read the manual on this? Sync Server - Anki Manual

2.1.57: Preferences > Syncing

2 Likes

I have… but it’s not well written for the purposes of making the server capability accessible to most users. Compare those instructions to anything written at DigitalOcean. Notice how DigitalOcean guides explain every step and show you every step assuming no Linux or specific application knowledge.

To be fair, I’d imagine supporting a private easy to use sync server is probably very hard to do. That’s why they have AnkiWeb. For the mass consumers who can’t do stuff like that. Alternatively why not just transfer deck exports manually?

1 Like

That’s why I advocated integrating it into Nextcloud. It has a great self-hosting architecture with lots of included applications. AnkiWeb just can’t pass the legality of hosting outside of private property, and it simply never can. Once it leaves your property, the laws change. That’s the problem with all cloud services that are not self-hosted.

I am transferring them manually but it’s not useful for studying if there’s no study history between different, independent sessions on multiple devices. Also, Apple devices are completely excluded from using Anki because the only option is to use AnkiWeb, so there’s a significant amount of exclusion by design.

An option to point AnkiMobile to a self-hosted server is currently in beta testing.

I’ve noticed that in current configuration Anki desktop is doing all the server job and for example android app is just a client without build in server… Is it a goal to build in a server in anki droid as well? by doing this entire collection could be stored on even a pendrive connected to a router and not require linux or any other os… just a storage space in network… Are any plans to achieve it?

That’s fantastic. Can I ask that newbe (n00b?) instructions be set written to make a home server work on a regular linux server behind a reverse proxy?
I’ve seen instructions for Docker but that itself requires a degree in Docker.

Or better yet, integrate a self-hosting into NextCloud? I’m using Joplin as a replacement for Microsoft OneNote and it seamlessly integrates into NextCloud. The end user merely provides a self-hosted URL and login credentials.

Would that be the same as storing it on a personal cloud server like NextCloud? Connecting a pen drive to a router has a large number of unique problems.

While the mobile clients could potentially expose a sync server, I’m not sure how practical it would be, as it would require 2x the storage space, and the sync server needs to have a static IP or DNS record.

What exactly is unclear on the link @kleinerpirat posted?

It would be very useful because now (in current implementation) to sync anki desktop on laptop with anki droid on cellphone I would have to have both turned on during sync process. And with both with build in sync protocol it would be possible to sync using google drive, drop box, ftp server

Basically every single part. The litmus test is whether a non-I.T. Windows user can install Linux and get a self-hosting server running. Every single step would need to be explained without assuming the end-user knows anything. Check out the Digital Ocean tutorials on anything to see what I mean, compared to many Linux self-help guides. It’s a night and day difference in quality. By creating high quality instructions, it really opens up the software to a much greater audience.

The sync protocol requires that the “server” is always online when you sync any of the clients. A phone could potentially be used for that purpose, but you’d need to set up some way for it to have a consistent network address, and ensure the app was in the foreground.

The sync protocol does not support third-party services like Google Drive, so all the media files would need to be stored on the mobile device, and you’d need to store two copies of them if you planned to study on that device as well.

setting up server on cellphone sounds interesting. Having the same ip address in easy, can be done either on router or directly on cellphone, Still the best option would be to have it on pendrive connected to router. It would be amazing for both users and anki infrastructure since many people would host data on own servers not using up anki resources.

@dae, thanks so much for bundling this new sync server, I’ve been looking forward to something like this for a long time.

I was able to get the server working immediately, at least on a virtual machine with the client on that same machine. Contrast this with anki-sync-server, which I’ve used for the last several years which was quite difficult to set up and took a lot of investment as far as keeping things compatible between that, the client, and Ankidroid.

@stellar7 have you tried setting up your server yet? From the instructions, I was worried it was going to be hard like anki-sync-server was, but it was pretty straightforward.

Assuming Anki is installed, you launch the terminal, and the command

SYNC_USER1=user:pass anki --syncserver

starts up the server.

You then go to the settings in Anki, type the host IP into the self-hosted sync server input box under the sync tab.

Then you click sync on the client. The user name and password are the ones in the command used to start the server. So from the above it would just be “user” and “pass”, but you can change these to your liking.

I’ve been using anki-sync-server behind a reverse proxy for a few years now, so I can finally switch to the one provided by Anki, assuming I get all that set up again and working.

1 Like

is someone thinking about setting up server on linux routers? (
OpenWrt)
(https://openwrt.org/)

1 Like

How is it possible for self hosting on DSM Synology?

i got 3-4 GL inet routers. you could flash the foss openwrt but i love their close source OS (build on openwrt of course) more.the vanilla (native) openwrt is not for layman.
GL inet close source GUI is.

1 Like