Manual Upgrade
Download Informat Installation Package
Obtain the installation package link address for the corresponding version through the Informat Installation Package Source Address.
shell
informat_next_2.23.zip informat_next_installerExample:
Download version 2.23 of the Informat installation package to the server's /tmp directory
shell
cd /tmp/
curl -O https://repo.informat.cn/downloads/packages/informat_next_2.23.zipBack up Database
Important note: Please back up your database before upgrading to ensure data security!
Execute Upgrade Script
Use the following command to execute the upgrade:
shell
./informat-upgrade.sh /tmp/informat_next_2.23.zipContent of the upgrade script informat-upgrade.sh:
shell
#!/bin/bash
is_integer() {
local str="$1"
# First check for empty string
if [[ -z "$str" ]]; then
return 1 # Empty string is not an integer
fi
# Regular match: optional minus sign + at least one digit
if [[ "$str" =~ ^-?[0-9]+$ ]]; then
return 0 # It is an integer
else
return 1 # It is not an integer
fi
}
INFORMAT_PACKAGE=$1 #informat_next_2.23.zip
current=`date "+%Y%m%d%H%M%S"`
unzip_dir=informat_next_${current}
unzip ${INFORMAT_PACKAGE} -d ${unzip_dir}
cat ${unzip_dir}/VERSION
oldAppVersion=`curl -s http://127.0.0.1:8881/web/main/app_version | grep -o '"appVersion":"[^"]*"' | sed 's/"appVersion":"//;s/"//'`
echo "oldAppVersion:"${oldAppVersion}
newAppVersion=`grep -o '"db":"[^"]*"' ${unzip_dir}/VERSION | sed 's/"db":"//;s/"//'`
echo "newAppVersion:"${newAppVersion}
#
if is_integer "${oldAppVersion}";then
echo 'oldAppVersion is digit'
else
echo 'oldAppVersion is not digit'
exit 1
fi
if is_integer "${newAppVersion}";then
echo 'newAppVersion is digit'
else
echo 'newAppVersion is not digit'
exit 1
fi
if [ "$oldAppVersion" -ge "$newAppVersion" ]; then
echo "error app version is too low"
exit 1
fi
export PGPASSWORD="database password"
DB_VERSION_DIR=${unzip_dir}"/db/version"
for ((version = oldAppVersion + 1; version <= newAppVersion; version++)); do
account_file="${DB_VERSION_DIR}/${version}_account.sql"
echo "/usr/local/pgsql/bin/psql -U postgres -d db_informat2_account_prd -f ${account_file}"
/usr/local/pgsql/bin/psql -U postgres -d db_informat2_account_prd -f ${account_file}
biz_file="${DB_VERSION_DIR}/${version}_biz.sql"
echo "/usr/local/pgsql/bin/psql -U postgres -d db_informat2_biz_prd_0 -f ${biz_file}"
/usr/local/pgsql/bin/psql -U postgres -d db_informat2_biz_prd_0 -f ${biz_file}
done
cp -fv /informat-next/instance/informat-account/informat-account-1.0.0.jar /informat-next/instance/informat-account/informat-account-1.0.0.jar${current}
cp -fv ${unzip_dir}/informat-account-1.0.0.jar /informat-next/instance/informat-account/informat-account-1.0.0.jar
cp -fv /informat-next/instance/informat-biz/informat-biz-1.0.0.jar /informat-next/instance/informat-biz/informat-biz-1.0.0.jar${current}
cp -fv ${unzip_dir}/informat-biz-1.0.0.jar /informat-next/instance/informat-biz/informat-biz-1.0.0.jarNotes
The default database username for this script is postgres. Please modify it if it's different. Replace export PGPASSWORD="database password" with your actual database password. /usr/local/pgsql/bin/psql is the default PostgreSQL command path. Please modify it if it's different.
Restart informat-account service
shell
# cd /informat-next
# ./informat restart informat-accountRestart informat-biz service
shell
# cd /informat-next
# ./informat restart informat-biz
