Skip to content

Commit

Permalink
feat: enable bucket versioning (#270)
Browse files Browse the repository at this point in the history
* docs(cli): add laf cli docs;

* chore: fix doc link

* feat: enable bucket versioning in sys server;
  • Loading branch information
maslow authored Aug 14, 2022
1 parent 59a15c7 commit f7c3efd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deploy/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- laf_shared_network

oss:
image: 'bitnami/minio:2022.4.12'
image: 'bitnami/minio:2022.8.11'
environment:
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
- laf_shared_network

oss:
image: 'bitnami/minio:2022.4.12'
image: 'bitnami/minio:2022.8.11'
environment:
- MINIO_ROOT_USER=minio-root-user
- MINIO_ROOT_PASSWORD=minio-root-password
Expand Down
14 changes: 13 additions & 1 deletion packages/system-server/src/support/minio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert = require("assert")
import * as cp from 'child_process'
import { promisify } from 'util'
import { STSClient, AssumeRoleCommand } from '@aws-sdk/client-sts'
import { CreateBucketCommand, DeleteBucketCommand, DeleteBucketPolicyCommand, PutBucketPolicyCommand, S3 } from '@aws-sdk/client-s3'
import { CreateBucketCommand, DeleteBucketCommand, DeleteBucketPolicyCommand, PutBucketPolicyCommand, PutBucketVersioningCommand, S3 } from '@aws-sdk/client-s3'
import { logger } from "./logger"
import Config from "../config"
import { IApplicationData } from "./application"
Expand Down Expand Up @@ -175,6 +175,18 @@ export class MinioAgent {
await this.setBucketQuota(name, quota)
}

const version_cmd = new PutBucketVersioningCommand({
Bucket: name,
VersioningConfiguration: {
Status: 'Enabled'
}
})

const version_res = await s3.send(version_cmd)
if (version_res?.$metadata?.httpStatusCode === 200) {
logger.info(`bucket ${name} versioning enabled`)
}

return res
}

Expand Down

0 comments on commit f7c3efd

Please sign in to comment.