-
-
Notifications
You must be signed in to change notification settings - Fork 779
Packaging: Add conf files to deb/rpm packages #6330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+181
−3
Conversation
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
This was in the st2-packages.git Makefile's post_install target.
To keep this portable so that it runs with all versions of sed, avoid features that are only in gnu sed (like \s). And use crudini instead of sed for more straightforward edits.
When testing the packages, we should discover any non-root processes that rely on access to st2.conf. Hopefully giving them access will be as simple as switching the group to ST2_SVC_USER. Otherwise, we might need to revert this change and make st2.conf world readable. Also note that ST2 now supports passing secrets in env vars. So, people could theoretically include the secrets in systemd conf files that are only accessible by root. If any utils, like st2ctl, need access to those secrets, however, they will need to get them from somewhere else if they are not in st2.conf.
11e8b1d to
ae649f9
Compare
guzzijones
approved these changes
Apr 25, 2025
nzlosh
approved these changes
Apr 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
logging
nginx
pantsbuild
size/L
PR that changes 100-499 lines. Requires some effort to review.
st2-packages
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.
This PR is working towards doing packaging via pantsbuild. Eventually, I hope to archive and stop using st2-packages.git.
Previous PRs in this series:
nfpm_deb_packageandnfpm_rpm_package) was added in Packaging: Add basic BUILD metadata for rpm/deb packages #6325 along with the deb maintainer scripts and rpm scriptlets.pex_binary(needed for this PR)This PR focuses on adding the conf files installed by this st2-packages.git Makefile:
https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/packages/st2/Makefile#L66-L104
shell_commandtargetsFor the most part, adding the conf files to deb/rpm packages is fairly straightforward. But, in a few cases, the old Makefile made changes to the files on the fly. So, this PR adds
shell_commandBUILD targets to make those edits./etc/st2/htpasswdThe
/etc/st2/htpasswdfile was generated on the fly like this:I used
touchto do effectively the same thing with a shell_command.st2/conf/BUILD
Lines 61 to 67 in ae649f9
/etc/st2/st2.confThe
/etc/st2/conffile hadvirtualenv_optsmodified on the fly like this:I used crudini to do something similar with a
shell_command.st2/conf/BUILD
Lines 69 to 76 in ae649f9
To simplify, I make this modification for all OSes. If any of them fail when we test the built packages, we can revisit making this OS-specific. Here are some historical references about the os-specific virtualenv_opts:
/etc/st2/logging.*confand/etc/st2/syslog.*confThe logging conf files were modified to change the log directory and the default log level like this:
This PR uses a portable
sedcommand to make the log directory change, and uses crudini to change the log level in a reliable and portable way:st2/pants-plugins/macros.py
Lines 234 to 247 in ae649f9
This
shell_commandis in a newst2_logging_conf_for_nfpmmacro so that it was fairly simple to run it on all the logging conf files.