docker/scripts/upgrade
chandi a3f346d8a0 all data under ./data instead in docker volumes
- easier backups
- people can access recordings with existing scripts
2024-01-07 23:52:08 +01:00

62 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -e
cd $(dirname $0)/..
if [ -z $RESTARTED ]
then
echo "# pull newest bigblugbutton-docker.git"
git pull
# restart script, since it might have changed.
RESTARTED=1 ./scripts/upgrade
exit
else
echo ""
echo "# recreate docker-compose.yml"
./scripts/generate-compose
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
echo ""
echo "# pull newest images"
docker compose pull --ignore-pull-failures
COMMIT_HASH=$(git rev-parse --short HEAD)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
echo ""
echo "-------------------------------------"
echo "update is ready!"
echo "we are on $COMMIT_HASH ($BRANCH_NAME)"
echo ""
echo "use following command for restarting bbb:"
echo " $ docker compose up -d --no-build"
echo "-------------------------------------"
fi