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
- a Tomcat setup with some configuration changes to
server.xml
andweb.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; see Configuring Large Image Upload.
The instructions assume you install the target version of Tomcat as a new install, then move resources and configuration changes from the previous install. 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 it easier and more reliable to treat even minor upgrades as new installations.
On Linux
The following instructions assume that Tomcat is installed in /opt/tomcat
, as recommended in PhixFlow’s installation instructions. If you have installed Tomcat somewhere else, remember to replace /opt/tomcat
in commands with your installation directory.
Step 1 Identify your current version of Tomcat
At the command line, enter:
tomcatHome/bin/version.sh
Step 2 Check your configuration
To find out what changes have been made to Tomcat configuration files, compare your 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
.Use the
diff
command to compare theTmpCurrent/conf
directory with the your current installation'sconf
directory, for example:diff /opt/tomcat/conf TmpCurrent/conf
- 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. see 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.
Step 3 Back-up the current Tomcat installation
Stop Tomcat.
Move the current
/opt/tomcat
directory into a backup.sudo systemctl stop tomcat sudo mv /opt/tomcat/ /opt/tomcat-back
Step 4 Install the new version of Tomcat
To install the required new version of Tomcat, follow the instructions on Install Tomcat on Linux.
Step 5 Configure the new version of Tomcat
Move the PhixFlow webapp from the backup into the new Tomcat
webapps
directory.sudo mv /opt/tomcat-back/webapps/phixflow /opt/tomcat/webapps/
If you have custom folders, move them back into the new Tomcat installation, for example
tomcat\secure
andtomcat\metadata
.Apply the standard configuration settings and hardening steps; see Install Tomcat.
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.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 continue to work after the upgrade.
You may need to revise your service configuration if you have:
also updated Java
installed Tomcat in the same location as previously check
Step 6 Restart and Test
Restart Tomcat
sudo systemctl start tomcat
Test that Tomcat is running and the PhixFlow webapp can run:
sudo systemctl status tomcat curl http://localhost:8080/phixflow/start.html
Check that you are now running the required version of Tomcat:
/opt/tomcat/bin/version.sh
On Windows
The following instructions assume that Tomcat is installed in the tomcat
base directory, as recommended in PhixFlow’s installation instructions.
Step 1 Identify your current version of Tomcat
In PowerShell, check the version
$tomcat\bin\version.bat
Step 2 Check your configuration
To find out what changes have been made to Tomcat configuration files, compare your configuration files to those in a standard installation, as follows.
Download a new copy of your current version of Tomcat
Unpack it to a temporary directory, for example
TempCurrent
. Do not install it.Use the
compare
command to find the differences between theTmpCurrent/conf
files and those in your current installation'sconf
directory. For example, in PowerShell, enter:compare-object (get-content $tomcat\conf\file.xml) (get-content $standardInstallCurrentVersion\conf\file.xml)
Compare the following files in
TmpCurrent/conf
directory with those in your current installation'sconf
directory, for example: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.
- 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. see below.
Step 3 Back-up the current Tomcat installation
Copy the entire
tomcat
folder to a backup location.If your log files are large and you do not want to retain them, as a minimum, you must back up the following
tomcat/
sub-folders:webapps
conf
lib
bin
- and if they exist
metadata
andsecure
Step 4 Note your Java setup
- Check and make a note of your system's Java setup.
In particular, note:- the path of the Java Virtual Machine
Java options. PhixFlow recommends:
-Djava.awt.headless=true -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:C:\tomcat\logs\gc-%t.log
- Memory allocation
- On the server, open Services → Apache Tomcat service properties:
If tomcat is running under a service account, make a note of the service account name. Ensure you have the service account password available.
Step 4 Uninstall the current version of Tomcat
We do not recommend using Uninstall.exe in the tomcat
base directory as we found it did not work. The following method above has proved more reliable.
- Open Add or remove programs.
- Locate Tomcat and click Uninstall.
- Windows asks if you want to remove all files:
- Click Yes if you have taken a backup of the necessary folders in Step 3.
- Click No if you want Windows to keep the
conf
,logs
,null
andwebapps
directories, as well as any other directories you have added.
Step 4 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:
recommended for PhixFlow; see Configure the service wrapper
you noted in Step 4, such as:
JVM path
memory settings
service account; see Run under service account.
Step 5 Configure the new version of Tomcat
Copy the PhixFlow webapp from the backup into the new Tomcat
webapps
directory, for example frombackup\webapps\phixflow
totomcat\webapps\phixflow
If you have custom folders, copy them back into the new Tomcat installation, for example
tomcat\secure
andtomcat\metadata
.Apply the standard configuration settings and hardening steps; see Install Tomcat.
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.
Copy only the sections that are specific to your installation.
Step 6 Restart and Test
Restart Tomcat
sudo systemctl start tomcat
Test that Tomcat is running and the PhixFlow webapp can run:
sudo systemctl status tomcat curl http://localhost:8080/phixflow/start.html
Check that you are now running the required version of Tomcat. In PowerShell, enter:
tomcat\bin\version.bat