deployment: OpenVidu Pro - Add AMI as argument to upgrade script

pull/713/head
cruizba 2022-03-30 18:13:55 +02:00
parent a39249eaaf
commit 47c4c91f7a
1 changed files with 8 additions and 7 deletions

View File

@ -185,6 +185,13 @@ 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
# 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:-}"
AWS_REGION=$(get_previous_env_variable AWS_DEFAULT_REGION)
if [[ -n ${AWS_REGION} ]]; then
[[ -z ${NEW_AMI_ID} ]] && fatal_error "You need to copy and specify an AMI Id for Media Nodes. Check https://docs.openvidu.io/en/${OPENVIDU_VERSION}/deployment/pro/upgrading/#option-2-update-current-deployment-to-2220"
fi
printf '\n' printf '\n'
printf '\n =======================================' printf '\n ======================================='
printf '\n Upgrade OpenVidu Pro %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${OPENVIDU_VERSION}" printf '\n Upgrade OpenVidu Pro %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${OPENVIDU_VERSION}"
@ -368,12 +375,6 @@ upgrade_ov() {
AWS_REGION=$(get_previous_env_variable AWS_DEFAULT_REGION) AWS_REGION=$(get_previous_env_variable AWS_DEFAULT_REGION)
if [[ -n ${AWS_REGION} ]]; then if [[ -n ${AWS_REGION} ]]; then
# Get new AMI ID
NEW_AMI_ID=$(curl https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/CF-OpenVidu-Pro-${OPENVIDU_VERSION//v}.yaml --silent |
sed -n -e '/KMSAMIMAP:/,/Metadata:/ p' |
grep -A 1 "${AWS_REGION}" | grep AMI | tr -d " " | cut -d":" -f2)
[[ -z ${NEW_AMI_ID} ]] && fatal_error "Error while getting new AWS_IMAGE_ID for Media Nodes"
# Get previous values # Get previous values
PREV_AWS_DEFAULT_REGION=$(get_previous_env_variable AWS_DEFAULT_REGION) PREV_AWS_DEFAULT_REGION=$(get_previous_env_variable AWS_DEFAULT_REGION)
PREV_AWS_INSTANCE_TYPE=$(get_previous_env_variable AWS_INSTANCE_TYPE) PREV_AWS_INSTANCE_TYPE=$(get_previous_env_variable AWS_INSTANCE_TYPE)
@ -448,7 +449,7 @@ fi
# Check type of installation # Check type of installation
if [[ -n "$1" && "$1" == "upgrade" ]]; then if [[ -n "$1" && "$1" == "upgrade" ]]; then
upgrade_ov upgrade_ov "$2"
else else
new_ov_installation new_ov_installation
fi fi