deployment: Update script of upgrading

- Throw error while upgrading between different OpenVidu Editions.
- Move coturn volume to rollback directory while upgrading.
pull/750/head
cruizba 2022-09-16 19:09:41 +02:00
parent 7f1684fb78
commit ace1a1f5a4
2 changed files with 25 additions and 0 deletions

View File

@ -133,6 +133,15 @@ upgrade_ov() {
fatal_error "You can't update from version ${OPENVIDU_PREVIOUS_VERSION} to ${OPENVIDU_VERSION}.\nNever upgrade across multiple major versions." fatal_error "You can't update from version ${OPENVIDU_PREVIOUS_VERSION} to ${OPENVIDU_VERSION}.\nNever upgrade across multiple major versions."
fi fi
# Check installation is a valid OpenVidu edition
if grep -q '.*image:.*\/openvidu-server-pro:.*' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"; then
if grep -q '.*image:.*\/replication-manager:.*' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"; then
fatal_error "You can't upgrade. Installed version is OpenVidu Enterprise"
else
fatal_error "You can't upgrade. Installed version is OpenVidu PRO."
fi
fi
printf '\n' printf '\n'
printf '\n =======================================' printf '\n ======================================='
printf '\n Upgrade OpenVidu CE %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${OPENVIDU_VERSION}" printf '\n Upgrade OpenVidu CE %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${OPENVIDU_VERSION}"
@ -219,6 +228,10 @@ upgrade_ov() {
printf '\n - custom-nginx-locations' printf '\n - custom-nginx-locations'
fi fi
if [ -d "${OPENVIDU_PREVIOUS_FOLDER}/coturn" ]; then
mv "${OPENVIDU_PREVIOUS_FOLDER}/coturn" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous directory 'coturn'"
fi
# Move tmp files to Openvidu # Move tmp files to Openvidu
printf '\n => Updating files:' printf '\n => Updating files:'

View File

@ -196,6 +196,14 @@ upgrade_ov() {
fatal_error "You can't update from version ${OPENVIDU_PREVIOUS_VERSION} to ${OPENVIDU_VERSION}.\nNever upgrade across multiple major versions." fatal_error "You can't update from version ${OPENVIDU_PREVIOUS_VERSION} to ${OPENVIDU_VERSION}.\nNever upgrade across multiple major versions."
fi fi
# Check installation is a valid OpenVidu edition
if grep -q '.*image:.*\/openvidu-server:.*' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"; then
fatal_error "You can't upgrade. Installed version is OpenVidu CE"
fi
if grep -q '.*image:.*\/replication-manager:.*' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"; then
fatal_error "You can't upgrade. Installed version is OpenVidu ENTERPRISE"
fi
# If deployment has AWS_DEFAULT_REGION defined (deployed with cloudformation), check if new AMI of the media node is present as argument # If deployment has AWS_DEFAULT_REGION defined (deployed with cloudformation), check if new AMI of the media node is present as argument
NEW_AMI_ID="${1:-}" NEW_AMI_ID="${1:-}"
AWS_REGION=$(get_previous_env_variable AWS_DEFAULT_REGION) AWS_REGION=$(get_previous_env_variable AWS_DEFAULT_REGION)
@ -319,6 +327,10 @@ upgrade_ov() {
printf '\n - custom-nginx-locations' printf '\n - custom-nginx-locations'
fi fi
if [ -d "${OPENVIDU_PREVIOUS_FOLDER}/coturn" ]; then
mv "${OPENVIDU_PREVIOUS_FOLDER}/coturn" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous directory 'coturn'"
fi
# Move tmp files to Openvidu # Move tmp files to Openvidu
printf '\n => Updating files:' printf '\n => Updating files:'