feat: add cloud S3 bulk storage defaults

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-08-14 07:18:28 +00:00
1 parent a323bdf0af
commit 84c03f2dee
10 files changed
+184 -28

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail
: "${PAPERCLIP_STORAGE_S3_BUCKET:?PAPERCLIP_STORAGE_S3_BUCKET is required}"
prefix="${PAPERCLIP_STORAGE_S3_PREFIX:-}"
prefix="${prefix#/}"
prefix="${prefix%/}"
base="${prefix:+${prefix}/}"
config="$(mktemp)"
trap 'rm -f "$config"' EXIT
cat >"$config" <<JSON
{"Rules":[{"ID":"paperclip-run-logs-90d","Status":"Enabled","Filter":{"Prefix":"${base}run-logs/"},"Expiration":{"Days":90}},{"ID":"paperclip-retained-snapshots-90d","Status":"Enabled","Filter":{"Prefix":"${base}retention/90-days/"},"Expiration":{"Days":90}}]}
JSON
if [[ "${PAPERCLIP_LIFECYCLE_DRY_RUN:-false}" == "true" ]]; then
cat "$config"
exit 0
fi
aws s3api put-bucket-lifecycle-configuration \
--bucket "$PAPERCLIP_STORAGE_S3_BUCKET" \
--lifecycle-configuration "file://$config"