Saphan StudioDocs
Deployment

Per-user vs system-wide state (the --system flag)

Where the binaries go and where the state goes are separate decisions, and the state's is made by the installation's mode, not by the install directory.

One prefix holds the installation, and which one is decided by its mode:

modeprefixchosen by
per user (the default)~/.saphan/running as an ordinary user
machine-wide/opt/saphan/the global --system flag, or running as root

Under the prefix, the same directories on both platforms: etc/ (the configuration file saphan.conf and the credentials file credentials.json beside it), run/ (sockets and pidfiles), logs/, trust/, machine/ (this machine's device key) and bin/. Each of the first three can be moved on its own with SAPHAN_CONFIG_DIR, SAPHAN_RUNTIME_DIR and SAPHAN_LOG_DIR.

Where the binaries are installed does not move any of it. The installer's --prefix moves the executables only, and a package puts them in /usr/bin; configuration, keys and logs still follow the mode. A system-wide package does not imply system-wide state either: it ships no service units and starts nothing.

Every server process of the machine payload — saphan-server, saphan-gateway and saphan server — is started by an explicit verb, or by the units saphan service registers, and keeps its pidfile under the same prefix. A machine-wide installation registers system services that start at boot; a per-user one registers services that start when you log in. See Central servers.