Repository navigation
feat: Add compatibility improvements to S3CloudStorage for S3-compatible providers (MinIO, LocalStack, etc.) - #4200
mathis6787 wants to merge 22 commits into
Conversation
…and S3CloudStorage
…e and enhancing header management
…file existence check in S3CloudStorage
…n useHttps parameter
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
d9b52e7 to
de70c70
Compare
nielsenko
left a comment
There was a problem hiding this comment.
You have added a number of optional arguments at various places, that is needed when building endpoints in the case we are not calling aws s3.
Would it be an idea, to abstract the code that needs these arguments into a callback type, use a default version for S3, and allow caller to pass another factory if needed?
This way you get more flexibility and less custom params (only an optional callback)?
Just food for thought. Otherwise, I'm prepared to accept this PR.
|
Hi! Thanks a lot for the feedback — I appreciate it. I am new to open source contribution so before implementing the factory/callback abstraction, I want to confirm one important point to avoid going in the wrong direction because I am not sure to understand your intention. ✔️ My current understanding The idea is to avoid having multiple optional parameters (endpointUrl, host, useHttps, etc.) and replace them with a single abstraction (factory or similar) that lets callers customize the S3 client in a cleaner, more flexible way. ✔️ Why I’m unsure about the factory-only approach A clientFactory gives full control over how AwsS3Client is created. It builds its own URL internally: Because AwsS3Uploader is completely independent from AwsS3Client: ➤ Even if we add a clientFactory, we would still need endpointUrl on AwsS3Uploader anyway. So the factory alone does not remove optional parameters from the constructor. This is why I’m unsure how the factory solves the “too many optional S3 params” problem. ✔️ Why an override object may be more consistent If we had something like: class S3Overrides {
final String? endpointUrl;
final String? host;
final bool useHttps;
}Then both components could use it: In that approach, the only optional parameter of S3CloudStorage would be a single overrides argument, and callers would pass a S3Overrides object.
|
|
@mathis6787 Thank you for taking the time to consider my suggestion. A simple callback is indeed too simple. I like your |
…or S3 cloud storage module
…rove configuration
refactor/s3 overrides refactor
Refactor S3 storage configuration with S3OverridesReplaced multiple optional S3 configuration parameters ( Changes
UsageAWS S3 (unchanged behavior): S3CloudStorage(
serverpod: pod,
storageId: 'default',
region: 'us-east-1',
bucket: 'my-bucket',
public: true,
)MinIO/S3-compatible: S3CloudStorage(
serverpod: pod,
storageId: 'default',
region: 'us-east-1',
bucket: 'my-bucket',
public: false,
overrides: S3Overrides(
endpointUrl: 'http://localhost:9000',
host: 'localhost:9000',
useHttps: false,
),
)Tested with MinIO and with AWS S3. |
nielsenko
left a comment
There was a problem hiding this comment.
Sorry for the delay, I had more urgent tasks on my plate.
I took another look. I would like you to consider making S3Options a pure interface (perhaps think a bit about the name). Also, I would like you to adopt a similar approach on the client side to avoid a breaking change.
Do you agree to these suggestions?
refactor:s3 override
|
Thanks for the feedback!
I hope this aligns with what you had in mind |
|
@nielsenko |
|
@mathis6787 Sorry for the delay. I do have a pending review, but the race to release 3.0 took precedence. I'm currently on vacation, but will return in the new year. |
|
@mathis6787 We decided to do an overhaul of the storage implementations in 3.4. You may want to try building your min-io integration on top. |
|
Your new package works very well with s3 Compat. I am closing this PR |
This PR improves the compatibility of S3CloudStorage with S3-compatible providers such as MinIO, LocalStack, and other self-hosted or local S3 implementations.
It aligns the behavior of Serverpod with non-AWS S3 providers while preserving full AWS S3 compatibility.
These adjustments make the S3 storage backend usable in local development environments and with S3-compatible services.
⸻
💡 Why
Many developers use S3-compatible storage such as MinIO or LocalStack for:
• local development
• CI testing
• on-premise/self-hosted deployments
Serverpod’s current S3 implementation is AWS-specific, which makes it difficult to use these environments.
This PR expands compatibility without introducing breaking changes.
⸻
❌ Breaking changes
None — existing AWS configurations continue to work exactly the same.