deploy: systemd template unit for declarative multi-instance - #146
Merged
Merged
Conversation
Running a second websh instance (per team / per environment) meant hand-editing a copy of the unit. websh@.service makes it declarative: printf 'PORT=8766\n' > /etc/websh/staging.env systemctl enable --now websh@staging One env file per instance; PORT is the only mandatory knob (instances collide on the default otherwise) and anything from configuration.md can ride along. Each instance gets its own writable state via StateDirectory=websh-%i. A missing env file fails the unit loudly instead of booting a misconfigured instance. The template carries the exact hardening set of websh.service (verified identical line-by-line); both files now cross-reference each other so future hardening changes land in both. systemd-analyze verify passes for both units.
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.
What
Running a second websh instance (per team / per environment) means hand-editing a copy of the unit today.
websh@.servicemakes it declarative:EnvironmentFile=/etc/websh/%i.env);PORTis the only mandatory knob (instances collide on the default otherwise), anything fromconfiguration.mdcan ride along.StateDirectory=websh-%i(pointWEBSH_CREDS_PATHthere when enabling the vault).EnvironmentFileis deliberately strict (no-prefix): a missing env file fails the unit loudly instead of booting a misconfigured instance.websh.service(diffed line-by-line); both files now cross-reference each other so future hardening changes land in both.docs/deployment.mdgains a Multiple instances section.systemd-analyze verifypasses for both units (incl. an instantiatedwebsh@x.service). The single-instancewebsh.serviceremains the default path.