Tomcat Upgrade in Place

This page provides instructions for upgrading a FlexDeploy installation to the latest version.

Upgrade Instructions

Step 1. Stop the Tomcat server. Use shutdown.sh on Linux and shutdown.bat on Windows.

Step 2. Backup the FlexDeploy schemas and Artifact Repository. In case you need to back out FlexDeploy, you can use these backup data.

For back-out purposes, it is highly recommended that a database backup of the database be taken using standard tools like RMAN for Oracle. Another option would be to export the FD, FD_ADMIN, and FF schemas using data pump. The schemas can be exported using the following data pump command for Oracle as shown below. Follow standard procedures for PostgreSQL and MySQL for database backup.

Recommendation for Oracle database backup

You will need to setup environment variables before running expdp. For example,

export ORACLE_HOME=/u01/app/oracle/product/
12.1.0/dbhome_1
export ORACLE_SID=fd01

export statements above are for example only as values will be different for your installation.

expdp system directory=DATA_PUMP_DIR dumpfile=fd_bkup.dmp schemas=FD,FF,FD_ADMIN

If this database is exclusively used for just FlexDeploy application, you can rely on Database backup and recovery processes (RMAN)
instead of export data procedure.

It is recommended that a backup of the artifact repository file system be taken in case a back-out is required. The location of the artifact repository can be identified by looking at value of -Dflexagon.fd.repository.root in setenv.sh or setenv.bat file. This file will be in <FlexDeploy Home>/apache-tomcat-flexdeploy/bin/. Standard file backup procedures can be followed. Optionally, the following command (unix only) can be used to create a tar file backup of the entire directory.

Backup Artifact Repository

cd <artifact repository location>
tar –cvzf artifact.tar.gz <artifact repository location>

Step 3. Upgrade the FlexDeploy schemas

Locate upgrade scripts folder in distribution zip file. For example, /database/oracle/upgrade, /database/postgres/upgrade, /database/mysql/upgrade. This folder(s) includes a number of folders containing migration.sql, which upgrade the FlexDeploy schemas.

You will need to execute one or more SQL script(s) from the version of FlexDeploy you currently have, up to the latest version. And they must be executed in that order.

Follow this guideline when deriving SQL files to be executed.

Current version is 4.6.0.0 or higher

  • Look at Build Version in About window.

Current version is before 4.6.0.0

  • You can find which files that you may have already executed by doing "select version, created_on, created_by from fd.fd_flexdeploy_version order by created_on desc" database query.
  • Or you can view list of patches by using Administration - FlexDeploy Patches in FlexDeploy.

See some examples below to help you understand database upgrade process.

Upgrading 5.2.0.0 to 5.3.0.3
v5.2.0.0-to-5.2.0.1/migration.sql
v5.2.0.1-to-5.3.0.0/migration.sql
v5.3.0.0-to-v5.3.0.2/migration.sql
v5.3.0.2-to-v5.3.0.3/migration.sq
Upgrading 5.1.0.0 to 5.3.0.3
v5.1.0.0-to-5.1.0.3/migration.sql
v5.1.0.3-to-v5.2.0.0/migration.sql
v5.2.0.0-to-5.2.0.1/migration.sql
v5.2.0.1-to-5.3.0.0/migration.sql
v5.3.0.0-to-v5.3.0.2/migration.sql
v5.3.0.2-to-v5.3.0.3/migration.sq
Upgrading 5.0.0.0 (or 5.0.0.x) to 5.3.0.3
v5.0.0.0-to-v5.1.0.0/migration.sql
v5.1.0.0-to-5.1.0.3/migration.sql
v5.1.0.3-to-v5.2.0.0/migration.sql
v5.2.0.0-to-5.2.0.1/migration.sql
v5.2.0.1-to-5.3.0.0/migration.sql
v5.3.0.0-to-v5.3.0.2/migration.sql
v5.3.0.2-to-v5.3.0.3/migration.sql

Executing migration files

Once you have decided which migration scripts to execute, you need to run them against your database using database specific tools in proper sequence.

Oracle

These scripts should be executed as system, sys, or another user which has privileges to create objects in other schemas, performs grants, etc.  You can load and execute these scripts using other tools such as Toad or SQL Developer. Instructions below are for using the sqlplus client.

sqlplus

Oracle SQL*Plus is part of the Oracle Client, and may be executed on any host which has it installed. If the Oracle Client is not installed on the same host as where you are installing FlexDeploy, you can copy the scripts to another host which has it installed.

Make sure to spool output to a file, so it can be analyzed later if necessary.

To launch sqlplus:

export ORACLE_HOME=<your Oracle Home directory>
export ORACLE_SID=<the SID of your database>
spool migration5.2.0.out #(change for each script execution so logs are preserved)
$ORACLE_HOME/bin/sqlplus #(login as sys or system when prompted)
SQL> <<execute scripts as shown above>>

If running on another host other than the database server, you must update your tnsnames file and and launch sqlplus as follows:

export ORACLE_HOME=<your Oracle Home directory>
export ORACLE_SID=<the SID of your database>
spool migration5.2.0.out #(change for each script execution so logs are preserved)
$ORACLE_HOME/bin/sqlplus system@<tnsname>
SQL> <<execute scripts as shown above>>

For example,

PostgreSQL

These scripts should be executed as postgres or another super user which has privileges to create objects in other schemas, performs grants, etc. Change the bold text as needed in your environment.

Linux
  • Run FlexDeploy migration scripts. Type the password when asked. PostgresDDL.txt records the output of the script so that you can refer back to it later.
    • cd <Flexdeploy Unzip Folder>\database\postgres\upgrade\vx.y.0.z-v.a.b.0.c
    • /path/to/psql -U postgres -h hostname -p 5432 -d flexdeploy -a -b -e -f migration.sql > PostgresDDL.txt
Windows
  • Run FlexDeploy scripts. Type the password when asked. PostgresDDL.txt records the output of the script so that you can refer back to it later. 
    • cd <Unzip Folder>/database/postgres/upgrade/vx.y.0.z-v.a.b.0.c
    • C:\path\to\psql -U postgres -h hostname -p 5432 -d flexdeploy -a -b -e -f migration.sql > PostgresDDL.txt

Step 4. From the FlexDeploy Tomcat distribution, copy /apache-tomcat-flexdeploy/webapps/flexdeploy.war into <FlexDeploy Home>/apache-tomcat-flexdeploy/webapps (overwrite existing file). If you want to take backup of existing file, please copy it outside of FlexDeploy installation folder to avoid confusion later. If you keep copy of older war in webapps folder, then two applications will start and cause issues as well.

Step 5. Review <FlexDeploy Home>/apache-tomcat-flexdeploy/conf/context.xml changes as per FlexDeploy 5.2 Release Notes - See Platform Recommendations. Alternatively, you can compare your context.xml file with FlexDeploy Tomcat distribution (/apache-tomcat-flexdeploy/conf/context.xml) and make changes as necessary.

Step 6. From the FlexDeploy Tomcat distribution, copy /apache-tomcat-flexdeploy/lib/FlexDeployAPI.jar into <FlexDeploy Home>/apache-tomcat-flexdeploy/lib (overwrite existing file if present). If you want to take backup of existing file, please copy it outside of FlexDeploy installation folder to avoid confusion later

Step 7. Copy plugins from download zip for auto upload.

FlexDeploy download zip contains plugin jar files. You just need to 1) copy plugin jars from download zip to plugins folder in your installation (details explained below) and 2) all files will be automatically uploaded and 3) activated on the server startup.

  1. Plugin files to copy are in following location in download zip.
    • Tomcat Download - application/plugins
    • WebLogic Download - plugins

  2. Let's determine where to copy files in your installation now. Locate flexagon.fd.install.root folder for your FlexDeploy installation, which is FlexDeploy working directory. This is specified on the Java command line. For example, -Dflexagon.fd.install.root=/u01/flexdeploy/application.
    • For Tomcat, you can look for this information in setenv.bat or setenv.sh file depending whether using Windows or Unix.
    • For Weblogic, find it in the managed server startup settings.
       
  3. Create plugins folder if it does not exist under flexagon.fd.install.root folder. Copy files from download zip (#1 above) to this plugins folder.

     

Step 8 . Start tomcat by running the following script

<FlexDeploy Home>/apache-tomcat-flexdeploy/bin/startup.sh (startup.bat on Windows)

Step 9. Launch FlexDeploy in your browser - http://<hostname>:<port>/flexdeploy

Step 10. There is no need to activate plugins manually. FlexDeploy will automatically upload and activate new versions of plugins once they are copied to plugins folder. You will notice that plugins that you copied in Step 8 will eventually be uploaded automatically and folder will not have any jar files left. You can also look at Administration - Plugins in UI and see newer versions of plugins.

The following macros are not currently supported in the footer:
  • style