fix(upgrade): Fix upgrade instructions and script (#304)
This commit is contained in:
parent
3af61c8f55
commit
3dfc01ec2d
@ -41,14 +41,7 @@ and [Nginx](http://nginx.org/). You'll likely want to add this service to your `
|
|||||||
|
|
||||||
## Updating Sentry
|
## Updating Sentry
|
||||||
|
|
||||||
Updating Sentry using Compose is relatively simple. Just use the following steps to update. Make sure that you have the latest version set in your Dockerfile. Or use the latest version of this repository.
|
The included `install.sh` script is meant to be idempotent and to bring you to the latest version. What this means is you can and should run `install.sh` to upgrade to the latest version available.
|
||||||
|
|
||||||
Use the following steps after updating this repository or your Dockerfile:
|
|
||||||
```sh
|
|
||||||
docker-compose build --pull # Build the services again after updating, and make sure we're up to date on patch version
|
|
||||||
docker-compose run --rm web upgrade # Run new migrations
|
|
||||||
docker-compose up -d # Recreate the services
|
|
||||||
```
|
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
|
12
install.sh
12
install.sh
@ -55,8 +55,8 @@ if [ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM" ]; then
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure nothing is working while we install/update
|
# Clean up old stuff and ensure nothing is working while we install/update
|
||||||
docker-compose stop
|
docker-compose down --rmi local --remove-orphans
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Creating volumes for persistent storage..."
|
echo "Creating volumes for persistent storage..."
|
||||||
@ -84,6 +84,8 @@ echo ""
|
|||||||
echo "Building and tagging Docker images..."
|
echo "Building and tagging Docker images..."
|
||||||
echo ""
|
echo ""
|
||||||
# Build the sentry onpremise image first as it is needed for the cron image
|
# 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 web
|
||||||
docker-compose build --force-rm
|
docker-compose build --force-rm
|
||||||
echo ""
|
echo ""
|
||||||
@ -91,6 +93,7 @@ echo "Docker images built."
|
|||||||
|
|
||||||
# Very naively check whether there's an existing sentry-postgres volume and the PG version in it
|
# 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
|
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
|
# If this is Postgres 9.5 data, start upgrading it to 9.6 in a new volume
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v sentry-postgres:/var/lib/postgresql/9.5/data \
|
-v sentry-postgres:/var/lib/postgresql/9.5/data \
|
||||||
@ -123,10 +126,11 @@ else
|
|||||||
docker-compose run --rm web upgrade
|
docker-compose run --rm web upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SENTRY_DATA_NEEDS_MIGRATION=$(docker run --rm -v sentry-data:/data alpine ash -c "[ ! -d '/data/files' ] && ls -A1x /data | wc -l")
|
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
|
if [ "$SENTRY_DATA_NEEDS_MIGRATION" ]; then
|
||||||
echo "Migrating file storage..."
|
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"
|
"mkdir -p /tmp/files; mv /data/* /tmp/files/; mv /tmp/files /data/files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user