Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page is for system administrators who are upgrading Tomcat

before upgrading their PhixFlow instance

.

Overview

The instructions on this page provide guidance on how to upgrade:

  • a standard Tomcat setup 
This method of upgrading is based on installing
  • a Tomcat setup with some configuration changes to server.xml and web.xml

Most PhixFlow installations use a standard Tomcat setup. Some common variations are:

  • SSL termination is handled in Tomcat to provide a secure connection. This means you have installed a certificate.

  • Tomcat uses a non-standard port number.

  • PhixFlow can export large files because the limit set by maxPostSize has been increased or disabled.

To upgrade, we recommend you install the target version of

tomcat

Tomcat as a new

install, and moving over

installation, then move resources and configuration changes from the previous install.

Tomcat does provide

This means the common variations listed above will be moved into the new installation.

Tomcat provides a tool for comparing configuration files between patch versions; for example, for version 9

:

see https://tomcat.apache.org/migration-9.html#Upgrading_9.0.x. However, at PhixFlow, we have found

that

it

is generally simpler

easier and more reliable to treat even minor upgrades as new installations.


Panel
borderColor#7da054
titleColorwhite
titleBGColor#7da054
borderStylesolid
titleSections on this page

Table of Contents
maxLevel3
indent12px
stylenone


On Linux

The following instructions assume that tomcat Tomcat is installed in /opt/tomcat, as recommended in PhixFlow’s installation guide for tomcat. But if instructions. If you have installed it elsewhere, replace Tomcat somewhere else, remember to replace /opt/tomcat in commands with this your installation directory. 

Step

1 Check

1  Identify your current version of Tomcat

At the command line, enterLenter:

Code Block
tomcatHome/opt/tomcat/bin/version.sh

Step

2

Check your

Setup

Most PhixFlow installations use a standard Tomcat setup. Some common variations are:

  • SSL termination is handled in Tomcat to provide a secure connection. This means you have installed a certificate.

  • Tomcat uses a non-standard port number.

  • PhixFlow can export large files because the limit set by maxPostSize has been increased or disabled; see Configuring Large Image Upload.

The following instructions will upgrade a standard Tomcat setup, or a setup with any of the variations listed above,  if you re-apply your configuration changes to server.xml and web.xml.

Expand
titleWhat changes do I need to re-apply?
To find out what changes have been made to Tomcat configuration files, compare your

configuration (if necessary)

You can skip this step if you have notes or a checklist of your configuration.

If you cannot remember what configuration changes you have made to Tomcat, you can find out by comparing your current configuration files to those in a standard installation

, as follows

.

Using the instructions in Install Tomcat on Linux, download and install your current version of Tomcat in a temporary location, TmpCurrent.
Do not install this temporary installation to /opt/tomcat.
  1. Find your current version of Tomcat on the Tomcat download page:
  2. Download your current version to a temporary location, for example /tmp/tmpTomcat, and unpack it:

    Code Block
    cd /tmp
    mkdir tmpTomcat
    cd tmpTomcat
    curl -O https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.45/bin/apache-tomcat-8.0.45.tar.gz
    tar xvf apache-tomcat-8*tar.gz --strip-components=1


  3. Use the diff command to compare the

TmpCurrent/
  1. conf directory with

the
  1. your current installation's conf directory, for example:

    Code Block
    diff /opt/tomcat/conf 
TmpCurrent
  1. /tmp/tmpTomcat/conf


  2. Make a note of any differences between
your current installation and the test installation. You
  1. the two configurations.
    You will need to reproduce these changes
after the upgrade
  1. in the new installation in Step 5, below.
    In particular, check for changes in:
    • server.xml
    • context.xml
    • web.xml
    • tomcat-users.xml.
      PhixFlow does not recommend updates to this file but you may have enabled internal Tomcat users
.

Linux Upgrade Steps

  1. Stop Tomcat.
    • .
  2. Make a note of any extra files in your current installation's tomcat/bin  directory. For example, you may have files to integrate with a monitoring agent. Use the diff command to compare the tomcat/bin directory with your current installation's tomcat/bin directory, for example:

    Code Block
    diff /opt/tomcat/bin /tmp/tmpTomcat/bin

    You will copy these files into the new bin directory in step 5.

  3. Make a note of any extra files in your current installation's tomcat/lib directory. For example, you may have files to support connections to additional databases. Use diff to compare these directories, for example:

    Code Block
    diff /opt/tomcat/lib /tmp/tmpTomcat/lib

    You will copy these files into the new tomcat/lib directory in step 5

    Note

    For connections to databases in addition to Oracle, MySQL and MariaDB, use Database Driver to configure the additional library files required.


  4. Remove your temporary download. For example:

    Code Block
    cd /tmp
    rm -r tmpTomcat


Step 3  Back-up the current Tomcat installation

  1. Stop Tomcat.
    If you have installed Tomcat to run under systemd, enter: 

    Code Block
    sudo systemctl stop tomcat


  2. Move the current /opt/tomcat directory into a backup.

    1. If you have a tomcat-back directory from a previous upgrade, delete it:

      Code Block
      sudo 
    systemctl
    1. rm 
    stop
    1. -r 
    tomcat
    1. /opt/tomcat-back


    2. Create the backup:

      Code Block
      sudo mv /opt/tomcat/ /opt/tomcat-back


Step 4  Install the new version of Tomcat

To install the required new version of Tomcat

; see 

:

Insert excerpt
Install Tomcat on Linux
Install Tomcat on Linux

.

nopaneltrue

Step 5  Configure the new version of Tomcat

  1. Move the PhixFlow webapp from the backup into the new Tomcat webapps directory.

    Code Block
    sudo mv /opt/tomcat-back/webapps/phixflow /opt/tomcat/webapps/


  2. If you have custom folders, move them back into the new Tomcat installation, for example tomcat\/secure and tomcat\/metadata.

  3. If there were any additional files in tomcat/bin, copy these back into the new installation.
  4. If there were any additional files in tomcat/lib, copy these  back into the new installation.
  5. Apply the standard configuration settings and hardening steps; see Install Tomcat.

  6. Copy your specific configurations from the backup files into the Tomcat configuration files, for example: SSL termination, non-standard ports, etc.
    Copy only the sections that are specific to your installation.

    Tip

    You do not need to re-create the service configuration for Tomcat. For example, if you previously installed Tomcat to run under systemd, the service script will continue to work after the upgrade.

    You may need to revise your service configuration if you have:

    • also updated Java

    • not installed Tomcat in the same location as previously check.


Step 6  Restart and Test

  1. Restart Tomcat

    Code Block
    sudo systemctl start tomcat


  2. Test that Tomcat is running and the PhixFlow webapp can run:

    Code Block
    sudo systemctl status tomcat
    curl http://localhost:8080/phixflow/start.html

  3. Check that you are now running the required version of Tomcat:

    Code Block
    /opt/tomcat/bin/version.sh

Windows

Below, $tomcat refers to the Tomcat base directory.

Preparation

In PowerShell, check the version


$tomcat

On Windows

The following instructions assume that you already have Tomcat 9 installed in c:\app\tomcat9as recommended in PhixFlow’s installation instructions. If Tomcat is at a different version, and/or you have chosen to install it in a different location, remember to replace c:\app\tomcat9 in the following commands with your installation directory.

Step 1 Identify your current version of Tomcat

To run the following process you must have the following environment variables set:

  • CATALINA_HOME
  • JAVA_HOME

If you have not set these variables, you can set them in your current session. For example, in Powershell, enter:

Code Block
$env:JAVA_HOME="C:\Program Files\Java\jre1.8.0_282"
$env:CATALINA_HOME="C:\app\tomcat9"

To check the version, in PowerShell enter:

Code Block
& "C:\app\tomcat9\bin\version.bat

Most PhixFlow installations use a fairly standard setup in tomcat, but there are some possible variations. Commonly, these are:

You handle SSL termination in tomcat to provide a secure connection, i.e. you have installed a certificate

You use a non-standard port number

You have allowed large files to be exported from PhixFlow by increasing the limit allowed by maxPostSize

All of the above are already covered in the steps below, by re-applying changes to server.xml and web.xml. However, if in doubt, you could check by comparing
"

Step 2 Check your configuration

You can skip this step if you have notes or a checklist of your configuration.

If you cannot remember what configuration changes you have made to Tomcat, you can compare your configuration files to those in a standard installation. To do so, download your current version of tomcat, unpack it, but do not install it - just place it in $standardInstallCurrentVersionThen compare the following files

  1. Download a new copy of your current version of Tomcat.

  2. Find your current version of tomcat on the Tomcat download page:
  3. Download your current version and unpack it to a temporary directory, for example TempCurrent. Do not install it.
  4. Use the compare command to find the differences between the TempCurrent\conf files and those in your current installation's conf directory. For example, in PowerShell, enter:

    Code Block
    compare-object (get-content c:\app\tomcat9\conf\file.xml) (get-content TempCurrent\conf\file.xml)

    In particular, you are looking for differences in the following files:

    • server.xml
    • context.xml
    • web.xml
    • tomcat-users.xml
(
    • .
      PhixFlow does not
mandate or even
    • recommend updates to this file
;
    • but you may have enabled internal
tomcat users)

using the command compare-object (get-content $tomcat\conf\file.xml) (get-content $standardInstallCurrentVersion\conf\file.xml) in PowerShell.

Upgrade

Stop Tomcat

Backup the current tomcat folder; e.g. copy the entire $tomcat
    • Tomcat users.
  1. Make a note of any differences between your current installation and the test installation.
    You will need to reproduce these changes in the new installation in Step 7 below.
  2. There may be additional files in your current installation's tomcat\bin directory, for example to integrate with a monitoring agent. Use the compare command to compare the bin directory with your current installation's tomcat\bin directory, for example:

    Code Block
    compare-object (get-childitem 'c:\app\tomcat9\bin') (get-childitem 'TempCurrent\bin')


  3. Make a note of any extra files in current installation's bin directory - these will need copying back in step 7
  4. There may be additional files in your current installation's lib directory - usually these will be for supporting to connections to databases outside of the standard set. Use the compare command to compare these directories, for example:

    Code Block
    compare-object (get-childitem 'c:\app\tomcat9\lib') (get-childitem 'TempCurrent\lib')


    Note

    To support connections to databases outside of the standard set, there is now a better way of setting up the additional library files: Database Driver


  5. Make a note of any extra files in your current installation's lib directory - these will need copying back in step 7
  6. Remove your temporary download.

Step 3 Back up the current Tomcat installation

  1. Copy the entire tomcat9 folder to a backup location.

  2. If your log files are large and you do not want to retain them, as a minimum,

make sure
  1. you must back up the following tomcat9\ sub-folders:

$tomcat\
    • webapps

$tomcat\
    • conf

$tomcat\
    • lib

$tomcat\Make a note of
    • bin

$tomcat\metadata, if this exists

$tomcat\secure, if this exists

    • and if they exist: metadata and secure.

Step 4  Note your Java setup

  1. Open Tomcat Properties. If you need further details on how to do this, see: Tomcat start/ stop, open properties
  2. Go to the Java tab.
  3. Check and make a note of your changes to the Java setup, including those required by PhixFlow. 

    Image Added
    In particular, note:
    Path
      • the path of the Java Virtual Machine
      • Java

    options applied
      • options. Make a note of any options you have added in addition to the

    standard setup (remember that PhixFlow recommends some options, see Java Options on https://phixflow.atlassian.net/wiki/spaces/HELPTRUNKR/pages/304087050/Install+Tomcat+on+Windows )

    Memory allocation

    If tomcat
      • PhixFlow recommendations. PhixFlow recommends:

        Insert excerpt
        Install Tomcat on Windows
        Install Tomcat on Windows
        nopaneltrue

      • Memory allocation
    1. On the server, open Services → Apache Tomcat service properties:

    Image Added
    If Tomcat is running under a service account,

    take account

    make a note of the service account name

    , and make sure that

    . Ensure you have the service account password

    available. To see this, open services on the server and open the properties for the Apache Tomcat service:Uninstall Tomcat. To do this, open ‘Add or remove programs’

    Step 5 Uninstall the current version of Tomcat

    Note

    We do not recommend using Uninstall.exe in the tomcat9 base directory as we found it did not work. The following method above has proved more reliable.

    1. Open Add or remove programs.
      Image Added
    2. Locate Tomcat and click
    ‘Uninstall'. The below question will pop up. Since we backed up
    1. Uninstall
    2. Windows asks if you want to remove all files:
      Image Added

      • Recommended - Click Yes if you have taken a backup of the necessary folders in
    step 3, you can click yes (if you click no, it will
      • Step 3.
      • Alternatively - Click No if you want Windows to keep the conf, logs, null and webapps directories, as well as any other directories you have added
    )We have tried using Uninstall
      • .
    exe in $tomcat, but this did not work. The method above has proved more reliable.

    The following instructions reference several sections of the page https://phixflow.atlassian.net/wiki/spaces/HELPTRUNKR/pages/304087050/Install+Tomcat+on+Windows :

    Section Download and install Tomcat: Download and install the latest version of Tomcat

    Section Configure the service wrapper: re-apply the settings (Java options) as recommended on that page, and settings you captured above for the Java configuration (JVM path, memory settings, any Java options you applied in addition to the standard setup)

    Section Run under service account: if you identified above that tomcat was being run under a service account re-apply this configuration

    Copy the webapp back in from backup, e.g. $backup\webapps\phixflow to $tomcat\webapps\phixflow

    Copy any other custom folders back in, e.g. $tomcat\secure and $tomcat\metadata

    Apply standard configuration settings and harderning steps, as instructed in https://phixflow.atlassian.net/wiki/spaces/HELPTRUNKR/pages/97734713/Install%2BTomcat , ensuring that:

    You apply any variation from the standard setup you captured above, including settings for

    Step 6 Install the new version of Tomcat

    To install the required new version of Tomcat, follow the instructions on Install Tomcat on Windows. Remember to reapply the settings:

    Step 7 Configure the new version of Tomcat

    1. Copy the PhixFlow webapp from the backup into the new Tomcat webapps directory, for example from backup\webapps\phixflow to tomcat9\webapps\phixflow.
      This step means PhixFlow configuration files, such as phixflow-datasource.xml are updated with your configuration.

      1. If the webapp has a datalink, this will need recreating
    2. If you have custom folders, copy them back into the new Tomcat installation, for example tomcat9\secure and tomcat9\metadata.

    3. If there were any additional files in tomcat9\bin, copy these back into the new installation
    4. If there were any additional files in tomcat9\lib, copy these back into the new installation
    5. Apply the standard configuration settings and hardening steps; see Install Tomcat.

    6. Copy your specific configurations (as identified in Step 2) from the backup files into the Tomcat configuration files, for example: SSL termination, non-standard ports, etc.

    You may find it easier to copy the relevant sections from the backup files, but make sure you only copy the sections that needs updating

    Start Tomcat and check that PhixFlow is up and running

    In PowerShell, check the version

    $tomcat
    1. Copy only the sections that are specific to your installation.

    2. If you are using MS SQL Server integrated authentication, remember to replace the Java option to set the classpath for sqljdbc_auth.dll. This should be included in the Java options you noted in Step 4, above. To be certain, you can check instructions for Tomcat configuration on MS SQL Server Integrated Authentication.

    Step 8 Restart and Test

    1. Restart the Tomcat service and check that it is running.

    2. Start the PhixFlow webapp and check that it is running.

    3. Check that you are now running the required version of Tomcat.
      Assuming you have set the JAVA_HOME environment variable, in PowerShell, enter:

      Code Block
      & "C:\app\tomcat9\bin\version.bat"