- use rustfs instead of minio and provide migration script - Schedule clean_pending_items/purge_deleted_items with celery beat - Give celery workers the S3 access key secret - Collabora admin access needs setting a password Following the [C4DT AI Policy](https://git.coopcloud.tech/c4dt/ai-policy/src/branch/main/AI-POLICY.md): #LLM_vibe #LLM_model Claude Opus 5.5 - [x] I take full responsibility for this code - [x] I understand every line of this code - [x] I tested this code thoroughly on my own computer / servers - [x] None of the commit messages were created using LLMs - [x] I will participate in any discussion on my own and will not use an LLM for the discussion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.4 KiB
Bash
Executable File
52 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# Creates the media bucket on the RustFS object storage, with versioning
|
|
# enabled. Runs inside the backend container, which ships boto3.
|
|
|
|
# Load secrets into environment
|
|
source /abra-entrypoint.sh -e
|
|
|
|
python - <<'PYEOF'
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
import boto3
|
|
from botocore.exceptions import ClientError, EndpointConnectionError
|
|
|
|
bucket = os.environ.get("AWS_STORAGE_BUCKET_NAME", "drive-media-storage")
|
|
s3 = boto3.client(
|
|
"s3",
|
|
endpoint_url=os.environ["AWS_S3_ENDPOINT_URL"],
|
|
aws_access_key_id=os.environ["AWS_S3_ACCESS_KEY_ID"],
|
|
aws_secret_access_key=os.environ["AWS_S3_SECRET_ACCESS_KEY"],
|
|
region_name=os.environ.get("AWS_S3_REGION_NAME", "us-east-1"),
|
|
)
|
|
|
|
# Wait for the object storage to be ready (up to 60 seconds)
|
|
for i in range(60):
|
|
try:
|
|
s3.list_buckets()
|
|
break
|
|
except (ClientError, EndpointConnectionError):
|
|
time.sleep(1)
|
|
else:
|
|
sys.exit("s3-initialize: timed out waiting for the object storage")
|
|
|
|
# Idempotent: skip if bucket already exists
|
|
try:
|
|
s3.head_bucket(Bucket=bucket)
|
|
print(f"s3-initialize: bucket '{bucket}' already exists, skipping")
|
|
sys.exit(0)
|
|
except ClientError:
|
|
pass
|
|
|
|
print(f"s3-initialize: creating bucket '{bucket}'...")
|
|
s3.create_bucket(Bucket=bucket)
|
|
s3.put_bucket_versioning(
|
|
Bucket=bucket, VersioningConfiguration={"Status": "Enabled"}
|
|
)
|
|
print("s3-initialize: done")
|
|
PYEOF
|