Repository navigation
fix(docs): keep the systemd unit and environment file out of the app directory - #611
Merged
Merged
Conversation
…directory The installation guides put hyperglass.service and hyperglass.env in /etc/hyperglass, which systemd reads as root and the Docker container can write to. Install the unit as a regular file in /etc/systemd/system, read the environment from a root-owned /etc/default/hyperglass, and document a one-time migration for existing installs. Closes #515
Split the migration into review, move and start steps so a changed environment file or unit is checked before systemd runs it, tolerate the link that systemctl disable already removed, and replace an existing link with cp --remove-destination instead of writing through it into the app directory. Note the custom app path and link the move section from both upgrade paths.
…t-of-app-dir # Conflicts: # CHANGELOG.md
jsenecal
force-pushed
the
fix/515-host-files-out-of-app-dir
branch
from
November 25, 2026 20:45
109adac to
830d901
Compare
WilhelmZA
approved these changes
Nov 25, 2026
WilhelmZA
left a comment
Collaborator
There was a problem hiding this comment.
Approving at 830d901.
Checked both sample units, the install and upgrade steps in the Docker, manual, environment-variable and upgrading guides against #515, and confirmed no remaining reference to the old unit or env file paths. CI gate passes and all commits are signed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #515
The Docker and manual guides put the systemd unit and its environment file in the app directory:
/etc/hyperglass/hyperglass.service, linked into/etc/systemd/system, and/etc/hyperglass/hyperglass.env, read throughEnvironmentFile. systemd reads both as root, and with Docker the container user owns that directory (since #486), so a compromised container could editExecStartor setCOMPOSE_FILEto a Compose file that mounts the host's root filesystem, and get root on the host at the next restart.This follows the proposal in the issue:
.samplesnow readEnvironmentFile=/etc/default/hyperglass.docker.mdxandmanual.mdxcreate/etc/default/hyperglass(root, mode 0600) and copy the unit to/etc/systemd/system/hyperglass.serviceinstead of linking it from/etc/hyperglass.docker.mdxgets a "Host files" section that explains why, and warns against pointingHYPERGLASS_APP_PATHat/opt/hyperglassor any directory holding host files.environment-variables.mdxnames the new path. While there, it no longer says the env file "does not configure Compose": systemd exports it todocker compose, which is whatCOMPOSE_FILErelies on. It now says.envapplies to everydocker composecommand and the env file only when systemd runs Compose.upgrading.mdxhas a one-time migration in three steps, with what to check between them, so the old files are reviewed before anything runs them: stop and disable the service and show the old env file and adiffof the old unit against the new sample; copy the env file withinstall -o root -g root -m 600(notmv, which would keep the container user as owner afterchown -R 10001:10001), replace the link with a copy of the sample and remove the old files; then reload, enable and start. Users with a customHYPERGLASS_APP_PATHare told to substitute it. Both upgrade paths and the 2.0.4 migration list link to it.cp --remove-destination, so an existing link from an older install is replaced rather than written through into the app directory.Why
/etc/default/hyperglass: it is the conventional root-owned place for a service's environment file, it is outside every mount, and it keeps the env file out of the/opt/hyperglassgit checkout. RHEL users can use/etc/sysconfigif they prefer, by editing the unit.Backward compatibility: no code changes. An installed unit keeps its own
EnvironmentFilepath, so existing installs keep working (and keep the risk) until they migrate. A unit copied from the new sample does not start until/etc/default/hyperglassexists, which the guides and the migration create.Out of scope, as in the issue: mounting the app directory read-only, which needs the UI build output to move elsewhere first.
Docs and sample units only; the full test suite passes.