Skip to content

Replace minio with built-in S3 endpoint - #3258

Merged
stgraber merged 12 commits into
lxc:mainfrom
stgraber:deprecation
Apr 30, 2026
Merged

stgraber merged 12 commits into
lxc:mainfrom
stgraber:deprecation

Conversation

@stgraber

Copy link
Copy Markdown
Member

Closes #2956
Closes #2726

@stgraber
stgraber force-pushed the deprecation branch 10 times, most recently from e5cc6a9 to a70fd51 Compare April 30, 2026 16:43
stgraber added 12 commits April 30, 2026 18:56
Signed-off-by: Stéphane Graber <[email protected]>
Signed-off-by: Stéphane Graber <[email protected]>
Signed-off-by: Stéphane Graber <[email protected]>
This introduces a new built-in S3 listener supporting the basic S3 operations.
It stores data on the filesystem under the data/ directory and uses a
.meta suffix for S3 JSON metadata.

Signed-off-by: Stéphane Graber <[email protected]>
This replaces the old minio proxy logic with instead using the new
built-in S3 listener logic.

Signed-off-by: Stéphane Graber <[email protected]>
Rather than implement this as a potentially very slow one-time operation
on startup, we instead will be doing the migration as buckets get
accessed. A lock is in place to avoid concurent migration and the
migration will be triggered until the minio directory is fully converted
(allows for resuming after a crash).

We can still add a patch later down the line converting whatever is
left, but this should reduce the impact of the transition to our own S3
listener.

The original minio metadata (.minio) is kept within the bucket so no
data is lost during conversion.

The migration logic handles both large chunked files and small file
storage in minio. It's made slightly harder because of minio writing a
32 byte checksum every 1MiB which needs to be stripped during
conversion.

Signed-off-by: Stéphane Graber <[email protected]>
The minio client hardcoded us-east-1 as the region which would then
break uploads to other AWS S3 regions. Add some logic to try and guess
the correct region.

Signed-off-by: Stéphane Graber <[email protected]>
Signed-off-by: Stéphane Graber <[email protected]>

@bensmrs bensmrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’d be very dishonest to say that I carefully reviewed this, but the tests are happy, and so am I.

const minioMetaFile = "xl.meta"

// migrateLocks serialises migrations per bucket directory.
var migrateLocks sync.Map // map[string]*sync.Mutex

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the comment? leftover attempt?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's trying to indicate the effective type of the sync.Map so it's easier to remember what the values need to be cast to.

const accessKeyAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
const secretKeyAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

randomString := func(alphabet string, n int) (string, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn’t there a safe crypto implementation?

@stgraber
stgraber merged commit 0ba6b1a into lxc:main Apr 30, 2026
154 of 160 checks passed
dtomvan added a commit to dtomvan/puntbestanden that referenced this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Replace minio Issues with multiple minio s3 buckets

2 participants