From 4ce0b832b051225d6f56441c9b2c2d3e67eec33c Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Wed, 8 Apr 2026 09:17:44 +0700 Subject: [PATCH 01/10] fix: move vroom-seaweed migration upwards Closes https://github.com/getsentry/self-hosted/issues/4263 --- install.sh | 4 ++-- install/bootstrap-s3-profiles.sh | 1 + install/migrate-s3-profiles.sh | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 install/migrate-s3-profiles.sh diff --git a/install.sh b/install.sh index fb41671798e..643e1e6da1a 100755 --- a/install.sh +++ b/install.sh @@ -29,6 +29,8 @@ source install/check-minimum-requirements.sh # in order to determine whether or not the clickhouse version needs to be upgraded. source install/upgrade-clickhouse.sh source install/update-docker-images.sh +source install/ensure-correct-permissions-profiles-dir.sh +source install/bootstrap-s3-profiles.sh source install/turn-things-off.sh source install/create-docker-volumes.sh source install/ensure-files-from-examples.sh @@ -39,8 +41,6 @@ source install/build-docker-images.sh source install/bootstrap-s3-nodestore.sh source install/bootstrap-snuba.sh source install/upgrade-postgres.sh -source install/ensure-correct-permissions-profiles-dir.sh -source install/bootstrap-s3-profiles.sh source install/set-up-and-migrate-database.sh source install/migrate-pgbouncer.sh source install/geoip.sh diff --git a/install/bootstrap-s3-profiles.sh b/install/bootstrap-s3-profiles.sh index 447570a9d22..10d8d829407 100644 --- a/install/bootstrap-s3-profiles.sh +++ b/install/bootstrap-s3-profiles.sh @@ -84,6 +84,7 @@ if [[ "$COMPOSE_PROFILES" == "feature-complete" ]]; then $dc exec vroom sh -c 's3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=seaweedfs:8333 --host-bucket="seaweedfs:8333/%(bucket)" sync /var/vroom/sentry-profiles/ s3://profiles/' echo "Migration completed." + $dc exec vroom sh -c 'rm -rf /var/vroom/sentry-profiles/*' else echo "No files found in 'sentry-vroom' volume. Skipping files migration." fi diff --git a/install/migrate-s3-profiles.sh b/install/migrate-s3-profiles.sh new file mode 100644 index 00000000000..e87dac06a93 --- /dev/null +++ b/install/migrate-s3-profiles.sh @@ -0,0 +1,4 @@ +if [[ "$COMPOSE_PROFILES" == "feature-complete" ]]; then + echo "${_group}Migrating profiles data from sentry-vroom volume to SeaweedFS..." + + From 6a246fa969c186b7d643c19d930bad1eab7f277e Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Wed, 8 Apr 2026 09:19:26 +0700 Subject: [PATCH 02/10] ref: remove unwanted file --- install/migrate-s3-profiles.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 install/migrate-s3-profiles.sh diff --git a/install/migrate-s3-profiles.sh b/install/migrate-s3-profiles.sh deleted file mode 100644 index e87dac06a93..00000000000 --- a/install/migrate-s3-profiles.sh +++ /dev/null @@ -1,4 +0,0 @@ -if [[ "$COMPOSE_PROFILES" == "feature-complete" ]]; then - echo "${_group}Migrating profiles data from sentry-vroom volume to SeaweedFS..." - - From 737375566e6508ef2c9c1f2f9e11e1ff06404929 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Wed, 8 Apr 2026 14:46:09 +0700 Subject: [PATCH 03/10] fix: create volume first --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 643e1e6da1a..01bc76b15f4 100755 --- a/install.sh +++ b/install.sh @@ -29,10 +29,10 @@ source install/check-minimum-requirements.sh # in order to determine whether or not the clickhouse version needs to be upgraded. source install/upgrade-clickhouse.sh source install/update-docker-images.sh +source install/create-docker-volumes.sh source install/ensure-correct-permissions-profiles-dir.sh source install/bootstrap-s3-profiles.sh source install/turn-things-off.sh -source install/create-docker-volumes.sh source install/ensure-files-from-examples.sh source install/check-memcached-backend.sh source install/ensure-relay-credentials.sh From 96315ae2cf8d4e22bfe672b5ccd6d1b65800342a Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Wed, 8 Apr 2026 15:08:14 +0700 Subject: [PATCH 04/10] fix: ensure sentry config exists --- install/bootstrap-s3-profiles.sh | 91 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/install/bootstrap-s3-profiles.sh b/install/bootstrap-s3-profiles.sh index 10d8d829407..5b3c82487ec 100644 --- a/install/bootstrap-s3-profiles.sh +++ b/install/bootstrap-s3-profiles.sh @@ -21,55 +21,57 @@ if [[ "$COMPOSE_PROFILES" == "feature-complete" ]]; then if ! echo "$bucket_list" | grep -q "s3://profiles"; then apply_config_changes_profiles=0 - # Only touch if no existing profiles config is found - if ! grep -q "filestore.profiles-backend" $SENTRY_CONFIG_YML; then - if [[ -z "${APPLY_AUTOMATIC_CONFIG_UPDATES:-}" ]]; then - echo - echo "We are migrating the Profiles data directory from the 'sentry-vroom' volume to SeaweedFS." - echo "This migration will ensure profiles ingestion works correctly with the new 'vroomrs'" - echo "and allows both 'sentry' and 'vroom' to transition smoothly." - echo "To complete this, your sentry/config.yml file needs to be modified." - echo "Would you like us to perform this modification automatically?" - echo + # Ensure `$SENTRY_CONFIG_YML` file exists + if [[ -f "$SENTRY_CONFIG_YML" ]]; then + # Only touch if no existing profiles config is found + if ! grep -q "filestore.profiles-backend" $SENTRY_CONFIG_YML; then + if [[ -z "${APPLY_AUTOMATIC_CONFIG_UPDATES:-}" ]]; then + echo + echo "We are migrating the Profiles data directory from the 'sentry-vroom' volume to SeaweedFS." + echo "This migration will ensure profiles ingestion works correctly with the new 'vroomrs'" + echo "and allows both 'sentry' and 'vroom' to transition smoothly." + echo "To complete this, your sentry/config.yml file needs to be modified." + echo "Would you like us to perform this modification automatically?" + echo - yn="" - until [ ! -z "$yn" ]; do - read -p "y or n? " yn - case $yn in - y | yes | 1) - export apply_config_changes_profiles=1 - echo - echo -n "Thank you." - ;; - n | no | 0) - export apply_config_changes_profiles=0 - echo - echo -n "Alright, you will need to update your sentry/config.yml file manually before running 'docker compose up'." - ;; - *) yn="" ;; - esac - done + yn="" + until [ ! -z "$yn" ]; do + read -p "y or n? " yn + case $yn in + y | yes | 1) + export apply_config_changes_profiles=1 + echo + echo -n "Thank you." + ;; + n | no | 0) + export apply_config_changes_profiles=0 + echo + echo -n "Alright, you will need to update your sentry/config.yml file manually before running 'docker compose up'." + ;; + *) yn="" ;; + esac + done - echo - echo "To avoid this prompt in the future, use one of these flags:" - echo - echo " --apply-automatic-config-updates" - echo " --no-apply-automatic-config-updates" - echo - echo "or set the APPLY_AUTOMATIC_CONFIG_UPDATES environment variable:" - echo - echo " APPLY_AUTOMATIC_CONFIG_UPDATES=1 to apply automatic updates" - echo " APPLY_AUTOMATIC_CONFIG_UPDATES=0 to not apply automatic updates" - echo - sleep 5 - fi + echo + echo "To avoid this prompt in the future, use one of these flags:" + echo + echo " --apply-automatic-config-updates" + echo " --no-apply-automatic-config-updates" + echo + echo "or set the APPLY_AUTOMATIC_CONFIG_UPDATES environment variable:" + echo + echo " APPLY_AUTOMATIC_CONFIG_UPDATES=1 to apply automatic updates" + echo " APPLY_AUTOMATIC_CONFIG_UPDATES=0 to not apply automatic updates" + echo + sleep 5 + fi - if [[ "$APPLY_AUTOMATIC_CONFIG_UPDATES" == 1 || "$apply_config_changes_profiles" == 1 ]]; then - profiles_config=$(sed -n '/filestore.profiles-backend/,/s3v4"/{p}' sentry/config.example.yml) - echo "$profiles_config" >>$SENTRY_CONFIG_YML + if [[ "$APPLY_AUTOMATIC_CONFIG_UPDATES" == 1 || "$apply_config_changes_profiles" == 1 ]]; then + profiles_config=$(sed -n '/filestore.profiles-backend/,/s3v4"/{p}' sentry/config.example.yml) + echo "$profiles_config" >>$SENTRY_CONFIG_YML + fi fi fi - $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' mb s3://profiles # Check if there are files in the sentry-vroom volume @@ -84,7 +86,6 @@ if [[ "$COMPOSE_PROFILES" == "feature-complete" ]]; then $dc exec vroom sh -c 's3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=seaweedfs:8333 --host-bucket="seaweedfs:8333/%(bucket)" sync /var/vroom/sentry-profiles/ s3://profiles/' echo "Migration completed." - $dc exec vroom sh -c 'rm -rf /var/vroom/sentry-profiles/*' else echo "No files found in 'sentry-vroom' volume. Skipping files migration." fi From 9fc67eab7f08aa747eeea3eedd16253961594dd9 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Sun, 17 May 2026 18:03:28 +0700 Subject: [PATCH 05/10] chore: set timeout for getlifecycle on seaweedfs --- install/bootstrap-s3-nodestore.sh | 2 +- install/bootstrap-s3-profiles.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/install/bootstrap-s3-nodestore.sh b/install/bootstrap-s3-nodestore.sh index 02a243d1c1d..da3734353be 100644 --- a/install/bootstrap-s3-nodestore.sh +++ b/install/bootstrap-s3-nodestore.sh @@ -87,7 +87,7 @@ EOF echo "Making sure the bucket lifecycle policy is all set up correctly..." $dc exec seaweedfs sh -c "printf '%s' '$lifecycle_policy' > /tmp/nodestore-lifecycle-policy.xml" $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 - $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://nodestore + timeout 30s $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://nodestore >/dev/null 2>&1 || true fi echo "${_endgroup}" diff --git a/install/bootstrap-s3-profiles.sh b/install/bootstrap-s3-profiles.sh index 5b3c82487ec..c2e6a2a2961 100644 --- a/install/bootstrap-s3-profiles.sh +++ b/install/bootstrap-s3-profiles.sh @@ -112,9 +112,7 @@ EOF $dc exec seaweedfs sh -c "printf '%s' '$lifecycle_policy' > /tmp/profiles-lifecycle-policy.xml" $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' setlifecycle /tmp/profiles-lifecycle-policy.xml s3://profiles - - echo "Making sure the bucket lifecycle policy is all set up correctly..." - $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://profiles + timeout 30s $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://profiles >/dev/null 2>&1 || true fi echo "${_endgroup}" fi From 46c9e6686de3840ed1939fe997577e10440ebb62 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Sun, 17 May 2026 18:09:05 +0700 Subject: [PATCH 06/10] fix: timeout for 60s for applying the command, and provide a warning if it fails --- install/bootstrap-s3-nodestore.sh | 15 ++++++++++++++- install/bootstrap-s3-profiles.sh | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/install/bootstrap-s3-nodestore.sh b/install/bootstrap-s3-nodestore.sh index da3734353be..b528ac088f1 100644 --- a/install/bootstrap-s3-nodestore.sh +++ b/install/bootstrap-s3-nodestore.sh @@ -86,7 +86,20 @@ EOF echo "Making sure the bucket lifecycle policy is all set up correctly..." $dc exec seaweedfs sh -c "printf '%s' '$lifecycle_policy' > /tmp/nodestore-lifecycle-policy.xml" - $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 + setlifecycle_cmd="$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" + if ! timeout 60s sh -c "$setlifecycle_cmd"; then + echo + echo + echo "====== WARNING ======" + echo + echo "Applying the lifecycle policy for the 'nodestore' bucket took too long or failed." + echo "This policy is important to ensure that old nodestore data is automatically deleted after $SENTRY_EVENT_RETENTION_DAYS days, which helps manage storage usage." + echo "Please run this command manually as soon as possible to set the lifecycle policy for the 'nodestore' bucket:" + echo + echo " $setlifecycle_cmd" + echo + sleep 5 + fi timeout 30s $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://nodestore >/dev/null 2>&1 || true fi diff --git a/install/bootstrap-s3-profiles.sh b/install/bootstrap-s3-profiles.sh index c2e6a2a2961..6b27e467a8d 100644 --- a/install/bootstrap-s3-profiles.sh +++ b/install/bootstrap-s3-profiles.sh @@ -111,7 +111,21 @@ EOF ) $dc exec seaweedfs sh -c "printf '%s' '$lifecycle_policy' > /tmp/profiles-lifecycle-policy.xml" - $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' setlifecycle /tmp/profiles-lifecycle-policy.xml s3://profiles + setlifecycle_cmd="$s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' setlifecycle /tmp/profiles-lifecycle-policy.xml s3://profiles" + if ! timeout 60s sh -c "$setlifecycle_cmd"; then + echo + echo + echo "====== WARNING ======" + echo + echo "Applying the lifecycle policy for the 'profiles' bucket took too long or failed." + echo "This policy is important to ensure that old profiles are automatically deleted after $SENTRY_EVENT_RETENTION_DAYS days, which helps manage storage usage." + echo "Please run this command manually as soon as possible to set the lifecycle policy for the 'profiles' bucket:" + echo + echo " $setlifecycle_cmd" + echo + sleep 5 + + fi timeout 30s $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://profiles >/dev/null 2>&1 || true fi echo "${_endgroup}" From 2b98d2a90f484febdd1ab54bf022e59c7377893a Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Mon, 18 May 2026 05:04:10 +0700 Subject: [PATCH 07/10] Update bootstrap-s3-nodestore.sh Co-authored-by: Amin Vakil --- install/bootstrap-s3-nodestore.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install/bootstrap-s3-nodestore.sh b/install/bootstrap-s3-nodestore.sh index b528ac088f1..b9437810c75 100644 --- a/install/bootstrap-s3-nodestore.sh +++ b/install/bootstrap-s3-nodestore.sh @@ -96,6 +96,9 @@ EOF echo "This policy is important to ensure that old nodestore data is automatically deleted after $SENTRY_EVENT_RETENTION_DAYS days, which helps manage storage usage." echo "Please run this command manually as soon as possible to set the lifecycle policy for the 'nodestore' bucket:" echo + echo " $dc up --wait seaweedfs" + echo " $dc exec seaweedfs apk add --no-cache s3cmd" + echo " $dc exec seaweedfs sh -c \"printf '%s' '$lifecycle_policy' > /tmp/nodestore-lifecycle-policy.xml\"" echo " $setlifecycle_cmd" echo sleep 5 From 1e0f323d5647ebc87a05166b4e913ebe80357bb5 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Mon, 18 May 2026 05:04:17 +0700 Subject: [PATCH 08/10] Update bootstrap-s3-profiles.sh Co-authored-by: Amin Vakil --- install/bootstrap-s3-profiles.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install/bootstrap-s3-profiles.sh b/install/bootstrap-s3-profiles.sh index 6b27e467a8d..da468ef131f 100644 --- a/install/bootstrap-s3-profiles.sh +++ b/install/bootstrap-s3-profiles.sh @@ -121,6 +121,9 @@ EOF echo "This policy is important to ensure that old profiles are automatically deleted after $SENTRY_EVENT_RETENTION_DAYS days, which helps manage storage usage." echo "Please run this command manually as soon as possible to set the lifecycle policy for the 'profiles' bucket:" echo + echo " $dc up --wait seaweedfs" + echo " $dc exec seaweedfs apk add --no-cache s3cmd" + echo " $dc exec seaweedfs sh -c \"printf '%s' '$lifecycle_policy' > /tmp/profiles-lifecycle-policy.xml\"" echo " $setlifecycle_cmd" echo sleep 5 From c457055d260a21439e052e912b886d2734daf377 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Tue, 19 May 2026 05:21:06 +0700 Subject: [PATCH 09/10] Update bootstrap-s3-nodestore.sh Co-authored-by: Amin Vakil --- install/bootstrap-s3-nodestore.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install/bootstrap-s3-nodestore.sh b/install/bootstrap-s3-nodestore.sh index b9437810c75..79d80974996 100644 --- a/install/bootstrap-s3-nodestore.sh +++ b/install/bootstrap-s3-nodestore.sh @@ -98,7 +98,9 @@ EOF echo echo " $dc up --wait seaweedfs" echo " $dc exec seaweedfs apk add --no-cache s3cmd" - echo " $dc exec seaweedfs sh -c \"printf '%s' '$lifecycle_policy' > /tmp/nodestore-lifecycle-policy.xml\"" + echo " $dc exec -T seaweedfs sh -c 'cat > /tmp/nodestore-lifecycle-policy.xml' <<'EOF'" + echo "$lifecycle_policy" + echo "EOF" echo " $setlifecycle_cmd" echo sleep 5 From 71e7106314a0d64ee75e32e8dc4125e346e4834b Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Tue, 19 May 2026 05:21:15 +0700 Subject: [PATCH 10/10] Update bootstrap-s3-profiles.sh Co-authored-by: Amin Vakil --- install/bootstrap-s3-profiles.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install/bootstrap-s3-profiles.sh b/install/bootstrap-s3-profiles.sh index da468ef131f..313fa0dfb17 100644 --- a/install/bootstrap-s3-profiles.sh +++ b/install/bootstrap-s3-profiles.sh @@ -123,7 +123,9 @@ EOF echo echo " $dc up --wait seaweedfs" echo " $dc exec seaweedfs apk add --no-cache s3cmd" - echo " $dc exec seaweedfs sh -c \"printf '%s' '$lifecycle_policy' > /tmp/profiles-lifecycle-policy.xml\"" + echo " $dc exec -T seaweedfs sh -c 'cat > /tmp/profiles-lifecycle-policy.xml' <<'EOF'" + echo "$lifecycle_policy" + echo "EOF" echo " $setlifecycle_cmd" echo sleep 5