Skip to content

Commit 5a670d1

Browse files
authored
fix: ensure seaweedfs lifecycle policy is set correctly (#4040)
1 parent 61c5078 commit 5a670d1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

install/bootstrap-s3-nodestore.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ if [[ $(echo "$bucket_list" | tail -1 | awk '{print $3}') != 's3://nodestore' ]]
6262

6363
$dc exec seaweedfs mkdir -p /data/idx/
6464
$s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' mb s3://nodestore
65+
else
66+
echo "Node store already exists, skipping creation..."
67+
fi
6568

69+
if [[ -z "${APPLY_AUTOMATIC_CONFIG_UPDATES:-}" || "$APPLY_AUTOMATIC_CONFIG_UPDATES" == 1 ]]; then
6670
# XXX(aldy505): Should we refactor this?
6771
lifecycle_policy=$(
6872
cat <<EOF
@@ -79,13 +83,11 @@ if [[ $(echo "$bucket_list" | tail -1 | awk '{print $3}') != 's3://nodestore' ]]
7983
</LifecycleConfiguration>
8084
EOF
8185
)
82-
$dc exec seaweedfs sh -c "printf '%s' '$lifecycle_policy' > /tmp/nodestore-lifecycle-policy.xml"
83-
$s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' setlifecycle /tmp/nodestore-lifecycle-policy.xml s3://nodestore
8486

8587
echo "Making sure the bucket lifecycle policy is all set up correctly..."
88+
$dc exec seaweedfs sh -c "printf '%s' '$lifecycle_policy' > /tmp/nodestore-lifecycle-policy.xml"
89+
$s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' setlifecycle /tmp/nodestore-lifecycle-policy.xml s3://nodestore
8690
$s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://nodestore
87-
else
88-
echo "Node store already exists, skipping..."
8991
fi
9092

9193
echo "${_endgroup}"

0 commit comments

Comments
 (0)