How to build a Syncthing MSI package for distribution #syncthing-msi

Long story short:

  • This topic should share my existing work on an MSI package which can be used, for example, to distribute Syncthing easily in Windows Domain Environments or to give friends an “easy to install and connect to your server” setup experience.

  • As I guess every Syncthing user has other demands when it comes to Syncthing’s configuration. For example, some users may like relaying and global discovery and others like to strictly use static IP connections or local site connections only. For that reason, I’ve put everything into BATCH files. If you need to “BUILD YOUR OWN”, just change the port numbers and/or xml setting lines in the batch to fit your needs :-).

  • The build script I’m personally using to bundle Syncthing into a MSI already “lives” for a long time. I’ve now decided to improve it to reproducibly build with “live-downloaded” packages instead of statically distributing my local set of build (portable EXE) tools. This should also head forward if later someone like to integrate the script into an official Syncthing build server.

I’ll now showcase where to find the MSI build script and how to use it.

References:

Neat

1 Like

thanks for sharing, I’m sure many admins will find this helpful!

1 Like

Starting Syncthing under Windows I has so far been done by the task planner. However, this does not always work perfectly. It rarely happens that Syncthing does not start and after a long period of running of the computer it could happen that Syncthing no longer ran. This happened repeatedly, especially after an energy-saving mode.

The MSI package is therefore installed on my Windows computers. It has been running perfectly so far. In addition, a service is stored that can be stopped and adjusted. “Local service” is stored by default as the user account, and directory rights are to be assigned to this user.

In my case, I saved the user account as in the task planner and took over the AppData completely from the previous installaion. After the service starts, Syncthing run as before.

Also good work that MSI!

However, that means with the MSI package, as with the SPK package for Synology, that any new updated MSI must be installed when the version changes, since updates are no longer permitted via the GUI. But it means also, that the installation of RCs is officially not possible. I think in the whole it’s a clean solution.

1 Like

I made this modifikation with Orca and remove in the MSI the rows about STNOUPGRADE in property and registry and try a very new installation, but without effect.

Until others I use the MSIs for updating.

With the same effect:

grafik

In the MSI is now:

grafik

Registry shows as follow:

But the result is the same as in picture one, if I remove the entrance complete or if STNOUPGRADE is 1, no change.

After repeating the installation and using the old database, I used up to the MSI package, it runs now …

grafik

So it seems, there is also a database entrance about that, which is no good solution, if a change is needed after a installation.

1 Like

What is the behavior when updating via an MSI package? Is it safe to simply install the new MSI over the current installation without losts or other modifications?

I dont know about that.

The installation of the MSI with standard parameters the auto upgrade is not possible. It was not possible to change back, if needed, also after modification of the Registry. Also after Deinstallation without deleting of the settings and database and new Installation of MSI with the modified MSI package there was no change.

In which way I change such parameters (activate auto upgrade) after the installation?

In my case this was only possible to set with the modified MSI package and a very green installation.

Exactly that work not for me. I dont know why, the difference is, that I use after the installation my old dataset from the “normal” installation, it means done without MSI.

In the config.xml was standard parameters and in that way also automatic updates enabled.

Regarding your advice, I doe also that way. Finally I imagine, that also in the database maybe are informations about parameters.

It could at least explain the behavior as observed. Nevertheless, it would not be entirely plausible because after the installation I exchanged the complete settings directory together with the database for the previous version in which the automatic upgrade was activated.

That’s why I came across the registry, as it was independent of it. But it also seems to me that there are other entries of STNOUPGRADE besides

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\The Syncthing Authors\Syncthing

I found e.g.

Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\ Environment

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

I don’t know if they have any influence. However, it appears to be typically backup entries from Windows.

Maybe you could do it differently. By definition, an MSI is an installer package with no optional features. Wouldn’t it make more sense to make an EXE in which various installation options can be selected?

The database records the schema version and minimum version required to open it, as Catfriend1 guessed. It does not store anything at all related to enabling or disabling upgrades.

1 Like

On my Windows systems the MSI package is installed in

C:\Server\Syncthing\

and the database are in the subfolder there

C:\Server\Syncthing\AppData\index-v0.14.0.db

If I want to run a CLI command, e.g.

C:\Server\Syncthing\syncthing.exe -reset-deltas

not the above data folder is used, instead a folder from the official version is used

C:\Users\>user<\AppData\Local\Syncthing\index-v0.14.0.db

What is instead the right command to run syncthing.exe -reset-deltas?

Same way as you otherwise start it, just adding -reset-deltas if that’s what you want.

First time I installed a modified version of MSI, that the package can run internal updates. If I install a newer version of MSI, such settings are lost or not?

This issue brings me back to my request

as an “internal” feature to be platform independent. I have similar issues with Linux Mint and my Synology servers. Would that be possible to implement?

1 Like

Maybe the same possibility here.

That possibility seems no longer to work

I installed Windows 11 and also a new MSI and I modified the newest MSI v1.18.2 with Orca, but I can´t set the update feature as known

Maybe is a better way to implement a feature I can chosse during installation.

1 Like

Is a comment possible?