mirror of
https://github.com/Sea-Haven-Industries/forgejo.git
synced 2026-09-30 10:03:11 +00:00
Some checks failed
Deploy / deploy (push) Has been cancelled
* Initial plan * fix: remove archive/ prefix from S3 lifecycle rule to cover root-level objects The archive-to-glacier rule had prefix: "archive/" which caused pre-migration backup files written to the bucket root to be excluded from any transition policy. Removing the prefix makes the rule apply to all objects in the bucket, ensuring root-level dump files also transition to Glacier after 30 days. Closes #4 * fix: remove archive/ prefix from lifecycle rule in forgejo-replica-stack.ts --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import * as cdk from "aws-cdk-lib";
|
|
import * as s3 from "aws-cdk-lib/aws-s3";
|
|
import { Construct } from "constructs";
|
|
|
|
export class ForgejoReplicaStack extends cdk.Stack {
|
|
public readonly replicaBucketArn: string;
|
|
public readonly replicaBucketName: string;
|
|
|
|
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
super(scope, id, props);
|
|
|
|
const replicaBucket = new s3.Bucket(this, "ReplicaBucket", {
|
|
bucketName: "forgejo-backups-replica-328440206208",
|
|
encryption: s3.BucketEncryption.S3_MANAGED,
|
|
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
|
|
versioned: true,
|
|
objectLockEnabled: true,
|
|
objectLockDefaultRetention: s3.ObjectLockRetention.governance(
|
|
cdk.Duration.days(90)
|
|
),
|
|
lifecycleRules: [
|
|
{
|
|
id: "archive-to-glacier",
|
|
transitions: [
|
|
{
|
|
storageClass: s3.StorageClass.GLACIER,
|
|
transitionAfter: cdk.Duration.days(30),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: "cleanup-noncurrent-versions",
|
|
noncurrentVersionExpiration: cdk.Duration.days(90),
|
|
},
|
|
],
|
|
removalPolicy: cdk.RemovalPolicy.RETAIN,
|
|
});
|
|
|
|
this.replicaBucketArn = replicaBucket.bucketArn;
|
|
this.replicaBucketName = replicaBucket.bucketName;
|
|
}
|
|
}
|