-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Skip DB ops during install completely on cache hit (#3496)
Follow up to #3488 A new record: 2m 8s for installing self-hosted: ![image](https://github.com/user-attachments/assets/7cc6409d-5388-49ba-ad87-b7a1e99c9acc)
- Loading branch information
Showing
2 changed files
with
54 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
echo "${_group}Setting up / migrating database ..." | ||
|
||
# Fixes https://github.com/getsentry/self-hosted/issues/2758, where a migration fails due to indexing issue | ||
$dc up --wait postgres | ||
if [[ -z "${SKIP_DB_MIGRATIONS:-}" ]]; then | ||
# Fixes https://github.com/getsentry/self-hosted/issues/2758, where a migration fails due to indexing issue | ||
$dc up --wait postgres | ||
|
||
os=$($dc exec postgres cat /etc/os-release | grep 'ID=debian') | ||
if [[ -z $os ]]; then | ||
echo "Postgres image debian check failed, exiting..." | ||
exit 1 | ||
fi | ||
os=$($dc exec postgres cat /etc/os-release | grep 'ID=debian') | ||
if [[ -z $os ]]; then | ||
echo "Postgres image debian check failed, exiting..." | ||
exit 1 | ||
fi | ||
|
||
# Using django ORM to provide broader support for users with external databases | ||
$dcr web shell -c " | ||
# Using django ORM to provide broader support for users with external databases | ||
$dcr web shell -c " | ||
from django.db import connection | ||
with connection.cursor() as cursor: | ||
cursor.execute('ALTER TABLE IF EXISTS sentry_groupedmessage DROP CONSTRAINT IF EXISTS sentry_groupedmessage_project_id_id_515aaa7e_uniq;') | ||
cursor.execute('DROP INDEX IF EXISTS sentry_groupedmessage_project_id_id_515aaa7e_uniq;') | ||
" | ||
|
||
if [[ -n "${CI:-}" || "${SKIP_USER_CREATION:-0}" == 1 ]]; then | ||
$dcr web upgrade --noinput --create-kafka-topics | ||
echo "" | ||
echo "Did not prompt for user creation. Run the following command to create one" | ||
echo "yourself (recommended):" | ||
echo "" | ||
echo " $dc_base run --rm web createuser" | ||
echo "" | ||
if [[ -n "${CI:-}" || "${SKIP_USER_CREATION:-0}" == 1 ]]; then | ||
$dcr web upgrade --noinput --create-kafka-topics | ||
echo "" | ||
echo "Did not prompt for user creation. Run the following command to create one" | ||
echo "yourself (recommended):" | ||
echo "" | ||
echo " $dc_base run --rm web createuser" | ||
echo "" | ||
else | ||
$dcr web upgrade --create-kafka-topics | ||
fi | ||
else | ||
$dcr web upgrade --create-kafka-topics | ||
echo "Skipped DB migrations due to SKIP_DB_MIGRATIONS=$SKIP_DB_MIGRATIONS" | ||
fi | ||
|
||
echo "${_endgroup}" |