Upgrading from versions 4.2.1.x to version 4.2.1.14 in RPM
The upgrading process to the newest OpenIAM version of 4.2.1.14 is simple and straightforward, following the steps below.
Internet-based upgrade
As a pre-requisite please ensure the following utilities are installed on the server:
- wget;
- unzip;
- tar;
- curl.
- Update version in configuration by modifying the
env.conffile to specify the upgrade versions.
vi /usr/local/openiam/env.conf
Update the following variables:
export UPGRADE_TO_VERSION="4.2.1.14"export VAULT_VERSION_UPGRADE="1.18.1"
- Run the upgrade script by executing the upgrade command.
openiam-cli upgrade
Non-internet-based upgrade
As a pre-requisite please ensure the following utilities are installed on the server:
- wget;
- unzip;
- tar;
- curl.
- Update version in the
env.conffile to specify the upgrade versions:
vi /usr/local/openiam/env.conf
Update the following variables:
export UPGRADE_TO_VERSION="4.2.1.14"export VAULT_VERSION_UPGRADE="1.18.1"
- Download required files manually and place them in the
/usr/src/ directory.
cd /usr/src/wget -P /usr/src/ https://releases.hashicorp.com/vault/1.18.1/vault_1.18.1_linux_amd64.zipcurl -o openiam-4.2.1.14.noarch.x86_64.rpm https://download.openiam.com/release/enterprise/4.2.1.14/rpm/openiam-4.2.1.13.noarch.x86_64.rpmwget https://download.openiam.com/release/enterprise/4.2.1.14/binaries/frontend.tar.gzwget https://download.openiam.com/release/enterprise/4.2.1.14/binaries/backend.tar.gz
- Run the upgrade script with the upgrade command as follows.
openiam-cli upgrade
vi /bin/openiam-cli
- The current
upgrade.shscript will work smoothly only if database is installed locally. However, if you are using an external database like MsSQL/Postgres/Oracle/MySQL, then manual update is required in the script for Flyway commands. We will provide the updatedupgrade.shscript in OpenIAM version 4.2.1.15 and further you will only need to change parameters (exportFLYWAY_DATABASE_TYPE="mysql") inenv.confas per your database name.
However, for current upgrade, please use the script given below.
Pre-requisite. Ensure the following environment variables are set in env.conf before running upgrade.sh.
export FLYWAY_ACTIVITI_PORT=export FLYWAY_ACTIVITI_HOST=export FLYWAY_OPENIAM_PORT=export FLYWAY_OPENIAM_HOST=export FLYWAY_DATABASE_TYPE=" "
- export FLYWAY_OPENIAM_DATABASE_NAME=
- export FLYWAY_ACTIVITI_DATABASE_NAME=
The updated script for non-internet-based upgrade can be found in the Appendix below.
All .NET/PS connectors versions as at 5.24.0.0 version are backward compatible, hence updating it will not disrupt operation of OpenIAM versionAs 4.2.0 and higher.
Appendix
Below, there is a code for non-internet-based upgrade script. Please, run it manually in case you are using the external database like MsSQL/Postgres/Oracle/MySQL.
#!/bin/bash#### THIS IS OPENIAM UPGRADE SCRIPT#### Before running this script set UPGRADE_TO_VERSION and FLYWAY_DATABASE_TYPE in the env.conf#set -eset -x. /usr/local/openiam/env.confif [ -z "$UPGRADE_TO_VERSION" ]; thenecho "Set 'UPGRADE_TO_VERSION' variable in the env.conf equal to the version you are going to upgrade to"exit 1fiCURRENT_VERSION=$(cat ${HOME_DIR}/version)echo "Upgrading Openiam version from $CURRENT_VERSION to $UPGRADE_TO_VERSION ..."export VAULT_HOME="$HOME_DIR/utils/vault/"export FLYWAY="$HOME_DIR/flyway/flyway"export FLYWAY_OPENIAM_USERNAME=$(. ${VAULT_HOME}vault.fetch.property.sh vault.secret.jdbc.username)export FLYWAY_OPENIAM_PASSWORD=$(. ${VAULT_HOME}vault.fetch.property.sh vault.secret.jdbc.password)export FLYWAY_ACTIVITI_USERNAME=$(. ${VAULT_HOME}vault.fetch.property.sh vault.secret.activiti.jdbc.username)export FLYWAY_ACTIVITI_PASSWORD=$(. ${VAULT_HOME}vault.fetch.property.sh vault.secret.activiti.jdbc.password)function downloadfile() {if [ -f $HOME_DIR/$1 ]; thenecho "$1 exists. Remove..."rm -rf $HOME_DIR/$1ficurl -k -s -q "https://openiam.com/" > /dev/nullif [[ "0" == "$?" ]]; thenecho "Download file $1 from OpenIAM website"curl -k -q $2 --output $HOME_DIR/$1if [[ "0" == "$?" ]]; thenreturn 0fiecho "Can't download file. Please download file $2 manually to location: $HOME_DIR/$1 and repeat the installation"return 1elseecho "Can't route to openiam website. Please download file $2 manually to location: $HOME_DIR/$1 and repeat the installation"return 1fi}/usr/bin/openiam-cli stop# Waiting for esb process is exitedwhile pgrep -f "/usr/local/openiam/jdk/bin/java -Dlogging.level.org.elasticsearch.client=ERROR -Dlogging.level.root=ERROR -Dlogging.level.org.openiam=ERROR -Dconfpath=/usr/local/openiam -jar -Xmx2048m -Djdk.tls.client.protocols=TLSv1.2 /usr/local/openiam/services/bin/openiam-esb.jar" > /dev/null; do sleep 2; doneecho "ESB Stopped, continue updating..."REDIS_PASSWORD=$(. ${VAULT_HOME}vault.fetch.property.sh vault.secret.redis.password)redis-cli -a $REDIS_PASSWORD flushdbredis-cli -a $REDIS_PASSWORD flushallecho "stopping openiam-vault"systemctl stop openiam-vault# Backup openiam filescd $HOME_DIRtar -cvf /tmp/openiam-$CURRENT_VERSION-files.tar *if [ ! -d $HOME_DIR/backup ]; thenmkdir $HOME_DIR/backupfimv -f /tmp/openiam-$CURRENT_VERSION-files.tar $HOME_DIR/backup/# Cleanup foldersrm -rf $HOME_DIR/services/bin/rm -rf $HOME_DIR/ui/webapps/rm -rf $HOME_DIR/health/*.health# Download filesdownloadfile backend.tar.gz https://download.openiam.com/${OPENIAM_ENV}/${OIAM_TYPE}/${UPGRADE_TO_VERSION}/binaries/backend.tar.gzdownloadfile frontend.tar.gz https://download.openiam.com/${OPENIAM_ENV}/${OIAM_TYPE}/${UPGRADE_TO_VERSION}/binaries/frontend.tar.gzecho "Downloading openiam-$UPGRADE_TO_VERSION.noarch.x86_64.rpm"curl https://download.openiam.com/${OPENIAM_ENV}/enterprise/$UPGRADE_TO_VERSION/rpm/openiam-$UPGRADE_TO_VERSION.noarch.x86_64.rpm --output /usr/src/openiam-$UPGRADE_TO_VERSION.noarch.x86_64.rpmcd /usr/srcecho "Extracting from openiam-$UPGRADE_TO_VERSION.noarch.x86_64.rpm ..."rpm2cpio openiam-$UPGRADE_TO_VERSION.noarch.x86_64.rpm | cpio -idmvtar -xvzf /usr/src/tmp/openiam-tmproot/openiam.tar.gzcd $HOME_DIRmkdir -p $HOME_DIR/services/bin/mkdir -p $HOME_DIR/ui/webapps/tar -xvf $HOME_DIR/backend.tar.gz --directory=$HOME_DIR/services/bin/tar -xvf $HOME_DIR/frontend.tar.gz --directory=$HOME_DIR/ui/webapps/chown -R openiam:openiam $HOME_DIR/services/bin/chown -R openiam:openiam $HOME_DIR/ui/webapps/dnf install wget unzip -ywget -P /usr/src/ "https://releases.hashicorp.com/vault/${VAULT_VERSION_UPGRADE}/vault_${VAULT_VERSION_UPGRADE}_linux_amd64.zip"unzip /usr/src/vault_${VAULT_VERSION_UPGRADE}_linux_amd64.zip -d /usr/src/chmod +x /usr/src/vaultmv -f /usr/src/vault /usr/bin/vaultrm -rf "/usr/src/vault_${VAULT_VERSION_UPGRADE}_linux_amd64.zip"systemctl start openiam-vaultopeniam_jdbc_url=''activiti_jdbc_url=''db_host_url=''if ! command -v unzip &> /dev/null; thenecho "Install unzip"dnf install unzip -yfi# Update Janusgraphsystemctl stop janusgraphrm -rf $HOME_DIR/janusgraphcp -rf /usr/src/etc/systemd/system/janusgraph.service /etc/systemd/system/cp -rf /usr/src/openiam/janusgraph $HOME_DIR/chown -R openiam:openiam $HOME_DIR/janusgraphsystemctl daemon-reloadsystemctl start janusgraphsleep 5./cassandra_tombstones_issue_fix.shif [ "$CURRENT_VERSION" == "4.2.1.2" ]; thenecho "Update sas lib"mkdir -p $HOME_DIR/sas_lib/mv $HOME_DIR/services/bin/sas-lib.zip $HOME_DIR/sas_lib/unzip -o $HOME_DIR/sas_lib/sas-lib.zip -d /chmod 444 /usr/local/Thales/javaapi/bsidkey/Agent.bsidkeychmod 766 /usr/local/Thales/javaapi/logcp -rf /usr/src/etc/systemd/system/openiam-sas.service /etc/systemd/system/systemctl daemon-reloadrabbitmqctl add_vhost openiam_sasrabbitmqctl set_permissions -p openiam_sas openiam ".*" ".*" ".*"# $HOME_DIR/utils/sas/init.sh# systemctl enable --now openiam-sas.servicefi# ---------- NEW DB CONFIG BLOCK BASED ON FLYWAY_DATABASE_TYPE ----------if [ -z "$FLYWAY_DATABASE_TYPE" ]; thenecho "FLYWAY_DATABASE_TYPE not set in env.conf. Exiting..."exit 1ficase "$FLYWAY_DATABASE_TYPE" inmysql)rm -rf "$HOME_DIR/conf/schema/mysql/openiam"cp -rf /usr/src/openiam/conf/schema/mysql/openiam "$HOME_DIR/conf/schema/mysql/"db_host_url="jdbc:mysql://${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT}"openiam_jdbc_url="jdbc:mysql://${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT}/${FLYWAY_OPENIAM_DATABASE_NAME}?autoReconnect=true&useUnicode=true&characterEncoding=utf8&connectionCollation=utf8_general_ci&serverTimezone=UTC"activiti_jdbc_url="jdbc:mysql://${FLYWAY_ACTIVITI_HOST}:${FLYWAY_ACTIVITI_PORT}/${FLYWAY_ACTIVITI_DATABASE_NAME}?autoReconnect=true&useUnicode=true&characterEncoding=utf8&connectionCollation=utf8_general_ci&serverTimezone=UTC";;postgres)rm -rf "$HOME_DIR/conf/schema/postgres/openiam"cp -rf /usr/src/openiam/conf/schema/postgres/openiam "$HOME_DIR/conf/schema/postgres/"db_host_url="jdbc:postgresql://${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT}"openiam_jdbc_url="jdbc:postgresql://${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT}/${FLYWAY_OPENIAM_DATABASE_NAME}?useUnicode=true&characterEncoding=UTF-8"activiti_jdbc_url="jdbc:postgresql://${FLYWAY_ACTIVITI_HOST}:${FLYWAY_ACTIVITI_PORT}/${FLYWAY_ACTIVITI_DATABASE_NAME}?useUnicode=true&characterEncoding=UTF-8";;mssql)rm -rf "$HOME_DIR/conf/schema/mssql/openiam"cp -rf /usr/src/openiam/conf/schema/mssql/openiam "$HOME_DIR/conf/schema/mssql/"db_host_url="jdbc:sqlserver://${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT};encrypt=true;trustServerCertificate=true"openiam_jdbc_url="jdbc:sqlserver://${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT};databaseName=${FLYWAY_OPENIAM_DATABASE_NAME};encrypt=true;trustServerCertificate=true"activiti_jdbc_url="jdbc:sqlserver://${FLYWAY_ACTIVITI_HOST}:${FLYWAY_ACTIVITI_PORT};databaseName=${FLYWAY_ACTIVITI_DATABASE_NAME};encrypt=true;trustServerCertificate=true";;oracle)rm -rf "$HOME_DIR/conf/schema/oracle/openiam"cp -rf /usr/src/openiam/conf/schema/oracle/openiam "$HOME_DIR/conf/schema/oracle/"if [ ! -z "$FLYWAY_ORACLE_SID" ]; thenopeniam_jdbc_url="jdbc:oracle:thin:@${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT}:${FLYWAY_ORACLE_SID}"activiti_jdbc_url="jdbc:oracle:thin:@${FLYWAY_ACTIVITI_HOST}:${FLYWAY_ACTIVITI_PORT}:${FLYWAY_ORACLE_SID}"cp "${FLYWAY_UTIL_HOME}oracle.sid.properties.m4" "${FLYWAY_UTIL_HOME}${FLYWAY_DATABASE_TYPE}.properties.m4"elif [ ! -z "$FLYWAY_ORACLE_SERVICE_NAME" ]; thenopeniam_jdbc_url="jdbc:oracle:thin:@${FLYWAY_OPENIAM_HOST}:${FLYWAY_OPENIAM_PORT}/${FLYWAY_ORACLE_SERVICE_NAME}"activiti_jdbc_url="jdbc:oracle:thin:@${FLYWAY_ACTIVITI_HOST}:${FLYWAY_ACTIVITI_PORT}/${FLYWAY_ORACLE_SERVICE_NAME}"cp "${FLYWAY_UTIL_HOME}oracle.service.properties.m4" "${FLYWAY_UTIL_HOME}${FLYWAY_DATABASE_TYPE}.properties.m4"elseecho "Oracle SID or Service Name not set. Exiting..."exit 1fi;;*)echo "Unsupported FLYWAY_DATABASE_TYPE: $FLYWAY_DATABASE_TYPE. Exiting..."exit 1;;esac# Run Flyway migrations$FLYWAY -url="${openiam_jdbc_url}" \-user=${FLYWAY_OPENIAM_USERNAME} \-password=${FLYWAY_OPENIAM_PASSWORD} \-baselineVersion=$FLYWAY_BASELINE_VERSION baseline \-locations="filesystem:${HOME_DIR}/conf/schema/${FLYWAY_DATABASE_TYPE}/openiam/" \-mixed=true \-placeholderReplacement=false repair$FLYWAY -url="${openiam_jdbc_url}" \-user=${FLYWAY_OPENIAM_USERNAME} \-password=${FLYWAY_OPENIAM_PASSWORD} \-baselineVersion=$FLYWAY_BASELINE_VERSION baseline \-locations="filesystem:${HOME_DIR}/conf/schema/${FLYWAY_DATABASE_TYPE}/openiam/" \-mixed=true \-placeholderReplacement=false migrate$FLYWAY -url="${activiti_jdbc_url}" \-user=${FLYWAY_ACTIVITI_USERNAME} \-password=${FLYWAY_ACTIVITI_PASSWORD} \-baselineVersion=$FLYWAY_BASELINE_VERSION baseline \-locations="filesystem:${HOME_DIR}/conf/schema/${FLYWAY_DATABASE_TYPE}/activiti" \-mixed=true \-placeholderReplacement=false migrateopeniam-cli startecho "$UPGRADE_TO_VERSION" > ${HOME_DIR}/version# Clean up upgrading trashrm -rf /usr/src/*echo "Done"echo "Backup of old version: ${HOME_DIR}/backup/openiam-$CURRENT_VERSION-files.tar"echo "Upgrading log: ${HOME_DIR}/upgrade.log"