Add S3 storage support for mirror repository data #336
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mirror repositories store metadata and zipballs on the local filesystem, which prevents running Packeton in stateless container deployments. When using S3 for regular package storage (
STORAGE_SOURCE=s3), the/datadirectory still accumulates mirror data that cannot be shared across replicas.This change extends the existing Flysystem-based S3 storage abstraction to mirror repositories. Both metadata (packages.json, provider includes, package JSON files) and distribution archives are now stored in S3 when configured.
For zipball storage, hash-based path sharding is implemented to optimize S3 performance. S3 partitions data by key prefix, so distributing files across prefixes like
ab/cd/...prevents hot spots when mirroring large repositories like packagist.org.Local caching is optional and configurable via
MIRROR_METADATA_CACHE_DIRandMIRROR_DIST_CACHE_DIRenvironment variables. When empty, all operations go directly to S3 for fully stateless operation. When set to/tmppaths, ephemeral caching improves read performance while maintaining statelessness across container restarts.The streaming fallback in
MirrorControllerhandles cases where local cache writes fail, ensuring zipball downloads still work by streaming directly from S3.Closes issue #304