Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upgrade): Fix upgrade instructions and script #304

Merged
merged 3 commits into from
Dec 30, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
more robust reruns
  • Loading branch information
BYK committed Dec 25, 2019
commit f270f996ca900a2966a881c54d3fe9c4bc576ebb
9 changes: 6 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ if [ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM" ]; then
exit -1
fi

# Ensure nothing is working while we install/update
docker-compose stop
# Clean up old stuff and ensure nothing is working while we install/update
docker-compose down --rmi local --remove-orphans

echo ""
echo "Creating volumes for persistent storage..."
Expand Down Expand Up @@ -85,13 +85,15 @@ echo "Building and tagging Docker images..."
echo ""
# Build the sentry onpremise image first as it is needed for the cron image
docker-compose pull --ignore-pull-failures
docker pull ${SENTRY_IMAGE:-getsentry/sentry:latest}
docker-compose build --force-rm web
docker-compose build --force-rm
echo ""
echo "Docker images built."

# Very naively check whether there's an existing sentry-postgres volume and the PG version in it
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
docker volume rm sentry-postgres-new || true
# If this is Postgres 9.5 data, start upgrading it to 9.6 in a new volume
docker run --rm \
-v sentry-postgres:/var/lib/postgresql/9.5/data \
Expand Down Expand Up @@ -127,7 +129,8 @@ fi
SENTRY_DATA_NEEDS_MIGRATION=$(docker run --rm -v sentry-data:/data alpine ash -c "[ ! -d '/data/files' ] && ls -A1x /data | wc -l || true")
if [ "$SENTRY_DATA_NEEDS_MIGRATION" ]; then
echo "Migrating file storage..."
docker run --rm -v sentry-data:/data alpine ash -c \
# Use the web (Sentry) image so the file owners are kept as sentry:sentry
docker-compose run --rm --entrypoint /bin/bash web -c \
"mkdir -p /tmp/files; mv /data/* /tmp/files/; mv /tmp/files /data/files"
fi

Expand Down