-
Notifications
You must be signed in to change notification settings - Fork 2
/
import-sql-dump.sh
executable file
·32 lines (24 loc) · 1017 Bytes
/
import-sql-dump.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/../"
SENTRY_INSTALL_FOLDER=/srv/sentry
SENTRY_FOLDER="${SENTRY_INSTALL_FOLDER}/onpremise"
echo "Please run this script before 'install.sh' from ${SENTRY_FOLDER}/sentry!"
if test -f "${SENTRY_FOLDER}/install/create-docker-volumes.sh"; then
# shellcheck disable=SC1091
source "${SENTRY_FOLDER}/install/create-docker-volumes.sh"
fi
(
cd ${SENTRY_FOLDER}
docker-compose stop
docker-compose up -d postgres
docker-compose up wait_postgres
)
cp scripts/dump/dump.sql "$(docker volume inspect sentry-postgres | jq -r .[0].Mountpoint)/"
(
cd ${SENTRY_FOLDER}
docker-compose exec postgres bash -c "dropdb -U postgres postgres; createdb -U postgres postgres"
docker-compose exec postgres psql -U postgres postgres -f /var/lib/postgresql/data/dump.sql
# In case you need to perform SQL command before launching migration uncomment next line
# docker-compose exec postgres psql -U "postgres" -d "postgres" -c "YOUR REQUEST HERE"
)