mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-01-08 18:47:58 -05:00
Abstract persistent files through Apache OpenDAL #174
Closed
opened 2025-07-08 08:41:50 -04:00 by AtHeartEngineer
·
0 comments
No Branch/Tag Specified
main
cached-config-operations
test_dylint
1.35.1
1.35.0
1.34.3
1.34.2
1.34.1
1.34.0
1.33.2
1.33.1
1.33.0
1.32.7
1.32.6
1.32.5
1.32.4
1.32.3
1.32.2
1.32.1
1.32.0
1.31.0
1.30.5
1.30.4
1.30.3
1.30.2
1.30.1
1.30.0
1.29.2
1.29.1
1.29.0
1.28.1
1.28.0
1.27.0
1.26.0
1.25.2
1.25.1
1.25.0
1.24.0
1.23.1
1.23.0
1.22.2
1.22.1
1.22.0
1.21.0
1.20.0
1.19.0
1.18.0
1.17.0
1.16.3
1.16.2
1.16.1
1.16.0
1.15.1
1.15.0
1.14.2
1.14.1
1.14
1.13.1
1.13.0
1.12.0
1.11.0
1.10.0
1.9.1
1.9.0
1.8.0
1.7.0
1.6.1
1.6.0
1.5.0
1.4.0
1.3.0
1.2.0
1.1.0
1.0.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.0
Labels
Clear labels
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
enhancement
enhancement
enhancement
enhancement
low priority
low priority
low priority
question
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
AtHeartEngineer
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github/vaultwarden#174
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @txase on 2/21/2025
This PR represents the first set of attempting to incorporate the changes from the AWS Serverless POC in #5591 and contains two commits:
s3feature flagThe first commit looks quite large at first glance, but many changes simply make all file accesses asynchronous and fallible by returning
Resulttypes. I think the key changes worth reviewing are:initialize_keys()as needed for OpenDAL access of private key fileCONFIGis still a synchronousLazytype, but we have to calculate it from async methods. I shoehorned a tiny tokio async thread that runs to completion to calculate the value. The alternative of patching every use ofCONFIGto be async, for no runtime benefit, seemed not worth doing.opendal_operator_for_path()and the abstractedCONFIG.opendal_operator_for_path_type()methods for the core of how operators are managed for various paths.save_temp_file()that abstracts the saving of TempFiles that Rocket creates when files are uploadedThe second commit is much smaller and more straightforward. The only thing worth pointing out is that OpenDAL uses reqsign under the covers to configure AWS credentials. However, AWS SDK configs have repeatedly been extended for better credential generation. For example, I use AWS Identity Center (aka AWS SSO) to generate temporary access tokens in my dev environment. reqsign doesn't support AWS SSO configs, but it has an escape hatch I utilized to load credentials. In the escape hatch I load the official AWS SDK config and credential generation crates to generate credentials. The one annoying part of the escape hatch is that reqsign's AwsCredentialLoad trait uses
anyhow::Result, so we have to pull in anyhow just for this escape hatch :(.Trying it out
These changes should be a behavioral no-op for existing use cases. The one minor change is the attachments, icon_cache, and sends folders aren't created at startup as OpenDAL FS service creates them when the first Operator is instantiated for each.
To try out the new S3 changes:
s3feature turned onAWS_PROFILEandAWS_REGIONalong with standard AWS configs like~/.aws/config)DATA_FOLDER->s3://<bucket in the matching AWS region>[/<optional path prefix>]ALLOWED_CONNECT_SRC->https://<bucket>.s3.<region>.amazonaws.com(required if using web-vault)TMP_FOLDER->data/tmp(or your preference, but must be set to a local path)TEMPLATES_FOLDER->data/templates(or your preference, but must be set to a local path)DATABASE_URL->data/db.sqlite3(or your preference, but must be set to a valid value)