From 1d33ae6b04a6270d41e59cdc05163c2caca70794 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Fri, 3 Jan 2020 22:52:22 +0300 Subject: [PATCH] fix(migration): Move Snuba bootstrapping before DB upgrade (#317) Since we are [moving the eventstream into a proper db migration](https://github.com/getsentry/sentry/pull/16226), we need Snuba and its friends ready at the time of `sentry upgrade` command. This patch does exactly that. Co-authored-by: Lyn Nagara --- install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 2caaa4c..250ef22 100755 --- a/install.sh +++ b/install.sh @@ -101,6 +101,16 @@ $dc build --force-rm echo "" echo "Docker images built." +echo "Bootstrapping Snuba..." +$dc up -d kafka redis clickhouse +until $($dcr clickhouse clickhouse-client -h clickhouse --query="SHOW TABLES;" | grep -q sentry_local); do + # `bootstrap` is for fresh installs, and `migrate` is for existing installs + # Running them both for both cases is harmless so we blindly run them + $dcr snuba-api bootstrap --force || true; + $dcr snuba-api migrate || true; +done; +echo "" + # Very naively check whether there's an existing sentry-postgres volume and the PG version in it if [[ $(docker volume ls -q --filter name=sentry-postgres) && $(docker run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null) == "9.5" ]]; then docker volume rm sentry-postgres-new || true @@ -145,16 +155,6 @@ if [ "$SENTRY_DATA_NEEDS_MIGRATION" ]; then "mkdir -p /tmp/files; mv /data/* /tmp/files/; mv /tmp/files /data/files" fi -echo "Boostrapping Snuba..." -$dc up -d kafka redis clickhouse -until $($dcr clickhouse clickhouse-client -h clickhouse --query="SHOW TABLES;" | grep -q sentry_local); do - # `bootstrap` is for fresh installs, and `migrate` is for existing installs - # Running them both for both cases is harmless so we blindly run them - $dcr snuba-api bootstrap --force || true; - $dcr snuba-api migrate || true; -done; -echo "" - set -o allexport source .env set +o allexport