docker/scripts/upgrade

62 lines
1.6 KiB
Plaintext
Raw Normal View History

2020-05-26 20:09:02 +02:00
#!/bin/bash
set -e
cd $(dirname $0)/..
if [ -z $RESTARTED ]
then
echo "# pull newest bigblugbutton-docker.git"
git pull
2020-05-26 20:09:02 +02:00
# restart script, since it might have changed.
RESTARTED=1 ./scripts/upgrade
exit
2020-05-26 20:09:02 +02:00
else
2020-07-30 12:11:34 +02:00
echo ""
echo "# recreate docker-compose.yml"
./scripts/generate-compose
2020-05-26 20:09:02 +02:00
echo ""
echo "# checking for old volumes & migrate them"
COMPOSE_PREFIX=$(docker compose config | grep '^name:' | awk '{print $2}')
function migrate {
VOLUME=${COMPOSE_PREFIX}_${1}
EXISTING=$(docker volume ls | grep $VOLUME | tail -n1 | awk '{print $2}')
if [ -n "$EXISTING" ]; then
# ensure volume is not used
docker compose down --remove-orphans
echo "Migrating $VOLUME to $2"
docker run --rm -v $VOLUME:/src -v $2:/dest --entrypoint /bin/sh eeacms/rsync -c 'rsync -av /src/ /dest'
docker volume rm $EXISTING
fi
}
migrate bigbluebutton ./data/bigbluebutton
migrate vol-freeswitch ./data/freeswitch-meetings
migrate vol-mediasoup ./data/mediasoup
# TODO: migrate postgres database
# TODO: migrate greenlight-data
2020-05-26 20:09:02 +02:00
echo ""
echo "# pull newest images"
2023-05-07 11:07:09 +02:00
docker compose pull --ignore-pull-failures
2020-05-26 20:09:02 +02:00
COMMIT_HASH=$(git rev-parse --short HEAD)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
2020-05-26 20:09:02 +02:00
echo ""
echo "-------------------------------------"
echo "update is ready!"
2020-05-26 20:09:02 +02:00
echo "we are on $COMMIT_HASH ($BRANCH_NAME)"
echo ""
echo "use following command for restarting bbb:"
2023-05-07 11:07:09 +02:00
echo " $ docker compose up -d --no-build"
2020-05-26 20:09:02 +02:00
echo "-------------------------------------"
fi