Skip to content
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

Fallback to not chown'ing ./data/archive dir if it's a network mount that prevents ownership changes #1312

Merged
merged 2 commits into from
Jan 6, 2024

Conversation

gnattu
Copy link
Contributor

@gnattu gnattu commented Jan 5, 2024

Summary

On mounted network shares, chmod might be hard or impossible to do without modify the server config. However, we can ignore the archive folder because we already tested if that folder is writeable and printed warnings to the user when we failed.

This PR ignores the archive folder and its contents when doing the chmod step, which is useful for mounted NFS/CIFS shares on archive folder specifically but the rest of the data folder remains a local directory. When modifying the config of the server is not an option, this can still enable users to use archivebox with network shares to store the most storage consuming part of the web archives.

This PR also modifies the warning message to be more accurately reflect the permission error is happening on the archive folder specifically, not the whole data folder.

I also noticed that there are "create archive folder if not exist" comment, but the shell script actually create the logs folder. I don't know if it is the intended behavior so I leave it as-is.

Related issues

This is a followup of #1304, providing an alternative method when modifying server config is not an option.

Changes these areas

  • Bugfixes
  • Feature behavior
  • Command line interface
  • Configuration options
  • Internal architecture
  • Snapshot data layout on disk

On mounted network shares, chmod might be hard or impossible to do without modify the server config. Ignore the archive folder because we already tested if that folder is writeable and printed warnings to the user.
@pirate pirate changed the base branch from main to dev January 6, 2024 00:06
@pirate
Copy link
Member

pirate commented Jan 6, 2024

Thanks! I try to be fairly strict about all the permissions matching the expected PUID/PGID since it prevents so many sneaky bugs later on, but I guess on some network filesystems that's really not possible. I'm ok relaxing the requirements slightly as a fallback, but I want to keep the default behavior strict.

I pushed a commit to slightly modify your code:

  • try chowning the entire ./data folder first the way it was originally (the best-case/most common scenario)
  • silently fall back to a your chown that avoids the ./data/archive folder if a full chown fails
  • add a comment explaining why ./data/logs is created
  • recommend the user chown the entire folder at once in any hint messages since that's still the recommended option with the least chance of causing issues later
  • recommend the user disables root_squash in the hints now, since it's a common failure point

@pirate pirate merged commit 975b1b5 into ArchiveBox:dev Jan 6, 2024
@pirate pirate changed the title fix: handle archive folder permission more graceful Fallback to not chown'ing ./data/archive dir if it's a network mount that prevents ownership changes Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants