-
-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Automate file ownership setting from host migration process #609
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
base: main
Are you sure you want to change the base?
Conversation
cliffmccarthy
commented
Aug 7, 2025
- Added a step to deploy_chatmail() that sets ownership of paths that are copied over as part of the upgrade process.
- Removed manual chown step from README.md.
- Added a step to deploy_chatmail() that sets ownership of paths that are copied over as part of the upgrade process. - Removed manual chown step from README.md.
A possible reason for not proceeding with this change (at least in its current form) is that the |
And a changelog entry would be nice :) |
Added, though this will probably become a merge conflict with #608, so after one is merged, I'll rebase the other (unless we decide not to proceed with this one (or the other one)). |
I should clarify what I mean about |
The word you're looking for is "idempotent" :) but if |
# | ||
stateful_paths = { | ||
"/etc/dkimkeys": "opendkim", | ||
"/home/vmail/mail": "vmail", |
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 just realized - /home/vmail/mail
can be very large. On large instances, chowning it can take several minutes (e.g. almost 48 minutes on nine.testrun.org); not something we should call on every cmdeploy run
.
I suggest that we only call the chown steps when --disable-mail
was passed? Then they will not be executed during every deploy.
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 suspected this could be high overhead on a server like that, so I agree that we should make this something that runs outside the normal operational flow. It seems like there are probably other use cases for --disable-mail
where you still wouldn't want to incur that 48-minute overhead, so I'm starting to think we need a different "verb" for fixing up the state of a migrated server, to be called as a separate step. Or we just keep those steps manual in the docs.
Thanks for submitting the issue in pyinfra!
Another possibility for how to deal with this occurred to me. What if we establish standard numeric UIDs for the users that own these directories? Then, any move between hosts that follow the standard would not need the chown. I assume there is the potential for these UIDs to "drift" depending on what exact set of packages is installed on the host, and that's what we're trying to address with the chown. Do we have a requirement to accommodate systems where these usernames are pre-existing with arbitrary UIDs? If not, forcing specific UIDs could be a solution. (And then we would need to re-order the migration steps to do the tar after the initial In fact, is doing the tar after creating the users (with arbitrary UIDs) sufficient to ensure proper ownership? I haven't tested this, but I think tar will attempt to use the username embedded in the archive, so as long as the same username exists on both sides, it should come across correctly. Is there a reason we have to populate the stateful paths before the first (There may still be other non- |