Project Soon

Syncthing

Syncthing, a distributed file sharing service. Usually you just fire it up, input the ID from another device and suddenly they are connected and can share folders, files being transferred like any other cloud service. However, each device still need to find each other, so a discovery server is necessary, which several are provided by default. Then comes the transfer of the files, if you are on the same network, they can figure this out and connect automatically. But if both are behind a NAT, there is no way to transfer. Therefore relay servers are a necessity, providing a bridge over the NAT.

So, to host this yourself, you need to first download both stdiscosrv and strelaysrv. Both are most optimal, but it is okay to have only one if you do not need the other. Then set up the service to be enabled for boot. Lastly make sure that permissions and folders are properly set up for either services, including or without certificates. Unless you want others to use your bandwidth, make sure to disable pool joining.

The part which is a bit confusing is that discovery supports HTTPS, but relay does not. I.e., it is possible to put discovery behind a reverse proxy, but relay needs a dedicated port (usually 22067). Optionally enable HTTP mode for discovery to reduce overhead for internal traffic (It is still HTTPS from the reverse proxy). When this is done, set up each client to use them, recommendation is to set up two subdomains, while both are pointed to the same IP externally, I need that for internal use.

I already had done this years ago, but just recently I moved it out to an Alpine VM with Ansible. Way a bit tricky to get OpenRC to work properly, but as the task at hand was simple enough, I now know how to do this in the future.