Syncthing for software distribution

I’ve been poring through syncthing documentation for a bit now, and I’ve been unable to answer a question to my satisfaction; I was hoping someone with experience could weigh in before I spend time going down the rabbit-hole.

I would like to distribute software to computer labs for installation. Ideally, I’d like to have a master software repository on a central server, and sync to it. Right now, I have a script on the server that generates torrent seed files and hosts them, along with a tracker, and clients go to the file share for the seed file.

This is unwieldy, because modifications to the files on the master don’t quickly get reflected in the seed file, and because I have to generate seed files.

So I’d like to do something like btsync/syncthing.

Ideally, I’d like to point syncthing on the master server at a big list of folders containing potentially hundreds of thousands of files, say “share this out” and allow any of several hundred or thousand pre-approved clients to connect and download, selectively, any of those folders.

In my ideal world, I could image lab machines, have them spin up a syncthing instance during their setup, and syncronize automatically against a list of folders on the server - some computers might get program A and B but not program C. It should attempt to download as much as it can while the bandwidth is available. But then, when it comes time to install program A, I’d like to be able to block, and say “this program cannot install until folder A is finished”. Once folder A is finished downloading, I’d like the software to unblock and allow the process to continue installing program A, while syncthing goes along its merry way.

Is this something that I might be able to do, or get close to accomplishing?

The only way you can accomplish this now, is if you make sure that other clients are not going to mess up the files you are syncing. If you cannot guarantee that, then it will not work. Then you can query the REST API to check if the sync is done or not…

In BTSync you’d probably just give everyone readonly secrets, and this way the master would keep in control, though I don’t think you can do that in Syncthing. I don’t know if they have any form of API for knowing when stuff is ready.

This would actually work with my pull request here, if/when I improve it some more.

The idea is that there are API functions like /rest/file/read/, which can be used to access a file. If the file does not exist on the local disk, it would be downloaded from other nodes and directly streamed as HTTP download.