File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,26 @@ if [ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM" ]; then
5555 exit -1
5656fi
5757
58+ # Very naively check whether there's an existing sentry-postgres volume and the PG version in it
59+ 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
60+ # If this is Postgres 9.5 data, start upgrading it to 9.6 in a new volume
61+ docker run --rm \
62+ -v sentry-postgres:/var/lib/postgresql/9.5/data \
63+ -v sentry-postgres-new:/var/lib/postgresql/9.6/data \
64+ tianon/postgres-upgrade:9.5-to-9.6
65+
66+ # Get rid of the old volume as we'll rename the new one to that
67+ docker volume rm sentry-postgres
68+ docker volume create --name sentry-postgres
69+ # There's no rename volume in Docker so copy the contents from old to new name
70+ # Also append the `host all all all trust` line as `tianon/postgres-upgrade:9.5-to-9.6`
71+ # doesn't do that automatically.
72+ docker run --rm -it -v sentry-postgres-new:/from -v sentry-postgres:/to alpine ash -c \
73+ " cd /from ; cp -av . /to ; echo 'host all all all trust' >> /to/pg_hba.conf"
74+ # Finally, remove the new old volume as we are all in sentry-postgres now
75+ docker volume rm sentry-postgres-new
76+ fi
77+
5878echo " "
5979ensure_file_from_example $SENTRY_CONFIG_PY
6080ensure_file_from_example $SENTRY_CONFIG_YML
You can’t perform that action at this time.
0 commit comments