echo"FAIL: Expected minimum docker-compose version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION"
exit1
fi
if["$RAM_AVAILABLE_IN_DOCKER"-lt"$MIN_RAM"];then
echo"FAIL: Expected minimum RAM available to Docker to be $MIN_RAM MB but found $RAM_AVAILABLE_IN_DOCKER MB"
exit1
fi
#SSE4.2 required by Clickhouse (https://clickhouse.yandex/docs/en/operations/requirements/)
# On KVM, cpuinfo could falsely not report SSE 4.2 support, so skip the check. https://github.com/ClickHouse/ClickHouse/issues/20#issuecomment-226849297
echo"FAIL: The CPU your machine is running on does not support the SSE 4.2 instruction set, which is required for one of the services Sentry uses (Clickhouse). See https://git.io/JvLDt for more info."
echo"Migrated TSDB to Snuba. Old configuration file backed up to $SENTRY_CONFIG_PY.bak"
return
fi
echo"Failed to automatically migrate TSDB. Reverting..."
mv"$SENTRY_CONFIG_PY.bak""$SENTRY_CONFIG_PY"
echo"$SENTRY_CONFIG_PY restored from backup."
fi
echo"WARN: Your Sentry configuration uses a legacy data store for time-series data. Remove the options SENTRY_TSDB and SENTRY_TSDB_OPTIONS from $SENTRY_CONFIG_PY and add:"
echo""
echo"$tsdb_settings"
echo""
echo"For more information please refer to https://github.com/getsentry/onpremise/pull/430"
fi
}
replace_tsdb
echo""
echo"Fetching and updating Docker images..."
echo""
# We tag locally built images with an '-onpremise-local' suffix. docker-compose pull tries to pull these too and
# shows a 404 error on the console which is confusing and unnecessary. To overcome this, we add the stderr>stdout
# redirection below and pass it through grep, ignoring all lines having this '-onpremise-local' suffix.
SNUBA_TRANSACTIONS_TABLE_CONTENTS=$(clickhouse_query"SELECT * FROM transactions_local LIMIT 1")
if[-z$SNUBA_TRANSACTIONS_TABLE_CONTENTS];then
echo"Dropping the old transactions table from Clickhouse...";
clickhouse_query'DROP TABLE transactions_local'
echo"Done."
else
echo"Seems like your Clickhouse transactions table is old and non-empty. You may experience issues if/when you have more than 10000 records in this table. See https://github.com/getsentry/sentry/pull/19882 for more information and consider disabling the 'discover2.tags_facet_enable_sampling' feature flag.";