storj/docs/blueprints/storage-node-windows-installer.md
JT Olio c81e4fcb9e
design/blueprints (#2927)
we've decided to rename design docs to blueprints to indicate that we don't intend to keep blueprints up to date once completed. instead, the final step of blueprint implementation is to archive the blueprint and update actual documentation elsewhere (potentially copying and pasting most of the blueprint). this PR updates the template and readme
2019-09-09 08:55:05 -06:00

3.6 KiB

Storage Node Installer for Windows

Abstract

This design doc outlines how we setup Storage Node on Windows.

Background

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:

  1. Sets up Storage Node to run in background.
  2. Sets up automatic updates.
  3. Ensures we log everything properly.

We need to take care that we:

  • Avoid triggering UAC unnecessarily.
  • Start storage node before user login.
  • Restart on crashes.

Design

The high-level idea is to create an installer using the WiX toolset and make Storage Node a Windows service.

The installer shall:

  • Display a GUI for collecting user configuration about:
    • Wallet address
    • Email
    • External address/port
    • Advertised bandwidth
    • Advertised storage
    • Identity directory
    • Installation directory
    • Storage directory
  • Install the storage node binary in the installation directory.
  • Generate config.yaml file with the user configuration.
  • Register the storage node binary as a Windows Service: https://wixtoolset.org/documentation/manual/v3/xsd/util/serviceconfig.html
  • Create a firewall exception for port 28967: https://wixtoolset.org/documentation/manual/v3/xsd/firewall/firewallexception.html
  • Create shortcut for opening the Dashboard
  • Add installation directory to user PATH (optional)
  • Open the dashboard when the installation is complete (optional)
  • Install the auto-updater binary and run it as a Windows service (if auto-updater is implemented at this point)

We must ensure that both the storage node binary and the MSI installer are signed with Storj code-sign certificate to avoid warning popups to users.

Rationale

The initial idea was to use go-msi for creating the Windows installer. It utilizes the WiX toolset to build the actual installer.

There are a number of reasons to use the WiX toolset directly instead of go-msi:

  • More flexibility as we can access all WiX toolset features directly instead of through the go-msi wrapper
  • One less dependency
  • The go-msi project is stall for 2 years. None of the issues and question has been answered for the last year.
  • The go-msi project lacks support for Windows Services and Firewall Rules, although the WiX toolset natively supports them.

Implementation

  1. Implement MSI installer using the WiX toolset.
  2. Update the build process to build and sign the MSI installer.
  3. Ensure the MSI installer works properly
    • Install Storage Node using the MSI installer.
    • 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
    • Verify that service writes to the logs properly

Open issues

  • Consider writing an uninstaller.
    • MSI package support unintsalling too. We must test to check what files are left on disk after uninstall.
  • How do we prevent UAC from triggering?
    • Hopefully, code-signing will prevent UAC.
  • Consider implementing ServiceMain in the storage node binary
    • We should ensure that the storage node process shutdowns gracefully on "Stop Service" and "Restart Service" events. Otherwise, we should handle them in the ServiceMain.
    • See golang/sys for example.