Storage Node Installer for Windows
This design doc outlines how we setup Storage Node on Windows.
Currently we are using Docker to maintain Storage Nodes.
Unfortunately Docker is not supported for Windows Home, which is popular OS among Storage Node Operators.
Similarly, Docker ends up using more resources than running natively on Windows.
Therefore, it would be nice to be able to run Storage Node without Docker.
For an easy setup process we would need an installer that:
- Sets up Storage Node to run in background,
- sets up automatic updates and
- ensures we log everything properly.
We need to take care that we:
- avoid triggering UAC unnecessarily,
- start storage node before logging in and
- restart on crashes.
The high-level idea is to create an installer using WIX and make Storage Node a Windows service.
For creating an installer we can use WIX Toolkit.
There is go-msi, which helps to get us setup the basic template.
We also need to ensure that we supply all the Operator information during installation.
To make the installer work we need to:
- Install go-msi on the build server.
- Create a wix.json file like this one
- Add a guid with
go-msi set-guidto uniquely identify the process.
- The wix.json should contain steps for:
- adding Dashboard shortcut to the desktop
- setting service recovery properties.
- configuring Storage Node Operator information:
- Wallet Address
- Address/ Port
- Identity directory
- Storge Directory
- install storagenode binary
- register storagenode as a service
- adding Storage Node binary to Windows UserPath (optional)
- open Dashboard at the end of the installer.
- Finally run
go-msi make --msi your_program.msi --version 0.0.2to create the installer.
We need to Storage Node to implement Windows service API, as shown in:
- Modify storage node/automatic updater startup code to implement ServiceMain.
- See golang/sys
- Create inbound firewall rule using the following Powershell command:
New-NetFirewallRule -DisplayName "Storj v3" -Direction Inbound –Protocol TCP –LocalPort 28967 -Action allow
This means that Windows handles starting and restarting the binary in the background.
- Modify the storage node startup to implement ServiceMain so that the binary is considered a Windows Service.
- Create script for registering binary as a Windows Background Service. (sc.exc command)
- Create wix.json file for building an MSI.
- Update the build process to include the creation of the MSI.
- Ensure the windows installer is working properly
- Install Storage Node using msi.
- Ensure binaries run on Windows startup, and it runs as a background process when not logged in.
- Ensure UAC(s) is not triggered after installation.
- Ensure that storage node restarts automatically after a crash
Open Issues/ Comments (if applicable)
- Consider writing an uninstaller.
- How do we prevent UAC from triggering?
- Consider using wix without go-msi.
- We need to sign both the binaries and the installer, make sure its done for the MSI.