mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-27 11:20:42 +01:00
feat: add cloud S3 bulk storage defaults
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
a323bdf0af
commit
84c03f2dee
10 files changed
+184
-28
No files matched your search
Executable
+22
@@ -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"
|
||||
Reference in new issue
Block a user