2
0

fix(sentry-data): Don't migrate when not needed (#297)

With this patch, `./install.sh` becomes safer as it won't recursively move things under `/data/file`. It also won't try to migrate an empty volume.
This commit is contained in:
Burak Yigit Kaya 2019-12-09 21:18:43 +03:00 committed by GitHub
parent 4af4ecfd0e
commit 3c9e8c28ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,9 +130,12 @@ until $(docker-compose run --rm clickhouse clickhouse-client -h clickhouse --que
done;
echo ""
echo "Migrating file storage..."
docker run --rm -v sentry-data:/data alpine ash -c \
SENTRY_DATA_NEEDS_MIGRATION=$(docker run --rm -v sentry-data:/data alpine ash -c "[ ! -d '/data/files' ] && ls -A1x /data | wc -l")
if [ "$SENTRY_DATA_NEEDS_MIGRATION" ]; then
echo "Migrating file storage..."
docker run --rm -v sentry-data:/data alpine ash -c \
"mkdir -p /tmp/files; mv /data/* /tmp/files/; mv /tmp/files /data/files"
fi
cleanup