Automating API GATEWAY database upgrade process 11.1.x via script command line
search cancel

Automating API GATEWAY database upgrade process 11.1.x via script command line

book

Article ID: 372796

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Starting in Gateway 11.1.1 Database Upgrades are mandatory for even minor version changes. 

For speed  and automation ability,  it may be desired to allow automation or Scripts to upgrade the CA API Gateway database automatically.

Note: This will not create a new database but it will allow an upgrade to apply schema changes between versions.

As such a new feature has been added to allow a scripted or headless gateway startup that upgrades the underlying gateway database. 

Environment

CA API Gateway 11.1.x and above

Resolution

A script has been created named = db_upgrade_v2.sh 

This requires a proper $JAVA_HOME to be set on the running environment.

The script works on both Appliance and Software-install Gateways.

And has been tested against Gateway 11.1.1.

 

The script is based on a Gateway Virtual Machine as it references specific Gateway directories and the script requires execution permission.

Note: It is best used (and tested) with an admin user account or the privileged user.

The command used to do the upgrade would be:

cd /opt/SecureSpan/Gateway/config
printf '%s\n' yes ${ADMIN_DB_USERNAME} ${ADMIN_DB_USERPASSWORD} | ${JAVA_HOME}/bin/java -jar DatabaseUpgrader.jar -databaseUpgrade

 

A sample  script is attached,

copy the .sh to the Gateway VM

chmod a+x ./path/to/script/db_upgrade_v2.sh

./path/to/script/db_upgrade_v2.sh <db_admin_username> <db_admin_userpass> 

 

The script takes in 2 inputs, the same inputs the ssgconfig menu's dbupgrade asks for,

The db_upgrade_v2.sh script performs the equivalent of the below ssgconfig menu.

Attachments

db_upgrade_v2.zip get_app