-
Notifications
You must be signed in to change notification settings - Fork 315
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
honor pkg_svc_user/pkg_svc_group #1012
Conversation
Plans that specify pkg_svc_user and pkg_svc_group will have SVC_USER and SVC_GROUP artifact metafiles created during build. The supervisor will attempt to run the child service process as the given user/group. additionally: - if SVC_USER and SVC_GROUP exist, the supervisor will verify the user and group specified within exists. If we are running as the specified user:group, the process will start without changing user:group. If we aren't running as the specified user:group, but are running as root, we exec the child process as SVC_USER:SVC_GROUP. If a pkg_svc_user and pkg_svc_group aren't specified, try running the service as hab:hab if that user:group exists, otherwise, fall back to the current uid:gid. - we no longer symlink to hooks, they are copied to /hab/svc/foo/*. This is so we can chmod the run script as the user/group running the service. - friendlier chmod/chown/mkdir errors that bubble up to the CLI - Tracing added for chmod/chown/mkdir functions - a RuntimeConfig struct is passed into Supervisor that specifies additional params used during child process exec. - Supervisor provides a platform-dependent start_platform() function to allow for future expansion. - hooks are executed as SVC_USER:SVC_GROUP - Platform dependent users module, currently support Linux (osx untested but might just work) Signed-off-by: Dave Parfitt <[email protected]>
4de01a0
to
aeba4cf
Compare
use error::{Result, Error}; | ||
use hcore::package::PackageInstall; | ||
|
||
static LOGKEY: &'static str = "USERS"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep with a two-letter convention for LOGKEY
, or expand it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bumped it up because I can't ever tell what the two-letter key is. I don't mind either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are those keys documented anywhere? I've never known what any of them mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure we just make them up as we go along. This could be a useful question for @ryankeairns as to whether this output format is even helpful to people
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By reading the original comment, I presume the LOGKEY in the output is hab-sup(XX):
... if so, I too have always wondered and never understood it. As Nathan asked, is this documented? The definitions for the abbreviations ought to be readily available but even so, you're likely still getting that info after the fact (if you can locate it).
What would the extended version look like? e.g. what does hab-sup(PK):
translate/expand to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 👍 👍 👍 on changing the LOGKEYs and/or behavior, but I feel like this should be discussed in a separate Github issue as to not distract the original intent of the PR.
🇺🇸 🇺🇸 🇺🇸 🇺🇸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of the two character log key isn't for informing users or about their readability, but developer access and debugging. We are supposed to be using these to identify which module a log even is coming from without needing to specify the full path plus crate name of the module in the log output. This is much like the way we log error messages in the servers with a very similar format.
I would stick with two or three character log prefixes, expanding them is going to clutter the log and I don't think it makes things any easier to track down.
☔ The latest upstream changes (presumably #1024) made this pull request unmergeable. Please resolve the merge conflicts. |
Does this make |
Closed in favor of #1050 |
Plans that specify pkg_svc_user and pkg_svc_group will have SVC_USER and
SVC_GROUP artifact metafiles created during build. The supervisor will
attempt to run the child service process as the given user/group.
and group specified within exists. If we are running as the specified
user:group, the process will start without changing user:group. If we
aren't running as the specified user:group, but are running as root,
we exec the child process as SVC_USER:SVC_GROUP. If a pkg_svc_user and
pkg_svc_group aren't specified, try running the service as hab:hab if
that user:group exists, otherwise, fall back to the current uid:gid.
is so we can chmod the run script as the user/group running the service.
additional params used during child process exec.
to allow for future expansion.
SVC_USER:SVC_GROUP
if they are specified, otherwise, they fall back tohab:hab
,current_uid:current_gid
, and finally panic.untested but might just work)
hab:hab
.initdb
(in theinit
hook) requires a non-root user to run.Staring without user
dparfitt
, which is specified in my local testcore/redis
package:Staring with user
dparfitt
, which is specified in my local testcore/redis
package:Staring w/
dparfitt:dparfitt
, but without write access to/hab/svc/redis
:/hab/svc/
file permissions for a running service that useshab:hab
:TODO:
chpst
removedhab:hab
hab file upload
and check permissions