Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected table casing in MySQL update script

📙 You will learn

How to upgrade from Upgrade from 2.8.9 to 2.8.9.1.

Prerequisites

Audience: IT Professional and/or End User
Difficulty: Advanced
Time needed: Approximately 60 minutes
Tools required: Tomcat, MySQL or MS SQL Server

Panel
panelIconIdatlassian-cross_mark
panelIcon:cross_mark:
bgColor#FFBDAD

ALWAYS PERFORM A FULL BACKUP OF YOUR DATABASE BEFORE ATTEMPTING ANY UPGRADE!

MySQL Server: You can run the mysqldump command from the MySQL server, e.g., mysqldump -u mydbuser -p mydatabase > path/to/backup.sql (we do not recommend using MySQL Workbench to perform the backup).

MS SQL Server: Using SSMS, right-click on the database, select Tasks → Back Up…, then choose the location & name of the backup file and click OK.

If you have any questions or concerns or if you wish to upgrade from an older version of ThreadFix, please reach out to our support team here: support@threadfix.it

ThreadFix Deployment Update

Follow these steps to deploy the updated version of ThreadFix:

  1. Stop the Tomcat instance on which ThreadFix is running.

  2. Move your current ThreadFix deployment directory from your Tomcat webapps folder into a backup directory.

    1. webapps directory location: //TOMCAT_HOME/webapps

  3. Copy the updated ThreadFix folder from your new artifact into your webapps directory.

    1. webapps directory location: //TOMCAT_HOME/webapps

  4. Copy the following files from your backed up ThreadFix directory to the newly updated ThreadFix directory:
    (FROM: <previous-threadfix-deploy>/WEB-INF/classes/TO: <new-threadfix-deploy>/WEB-INF/classes/, except as noted below)

    1. custom.properties

    2. ESAPI.properties

    3. jdbc.properties

    4. jms.properties

    5. threadfix.license

    6. If you've updated any of these in your previous deployment, copy them as well:

      1. <threadfix-deploy>/WEB-INF/security.xml

      2. <threadfix-deploy>/WEB-INF/classes/security/samlKeystore.jks (and/or any other Java keystore that you've saved in this directory)

  5. Copy the velocityTemplates directory from your backed up ThreadFix directory to the newly-updated ThreadFix directory.
    (FROM: <previous-threadfix-deployTO:<new-threadfix-deploy>)

     

  6. In Linux environments, you may need to grant your tomcat user/group ownership and permissions to the newly-deployed artifact.
    Examples:

    Code Block
    sudo chown -R tomcat:tomcat /opt/tomcat
    sudo chmod -R 775 /opt/tomcat

     

  7. Cleanup - Delete the following:

    1. The contents of the <tomcat-deploy>/work directory

    2. Your web browser's cache/history

Before-Restart Database Updates

Database Updates

Warning

 Do Not Restart Tomcat If Scripts Do Not Complete

If you receive an error when running before-restart database update scripts, please report the issue to ThreadFix Support (create a ticket in Service Desk), including a screenshot of the script & error message.

You should NOT proceed to start Tomcat until the issue is resolved. If you do, Hibernate may make unrecoverable changes that will require you to restore your database from backup.

Caution/warning messages are OK; just not errors.

Expand the MySQL or MS SQL Server code block to reveal the scripts:

Expand
titleMySQL:
Code Block
languagesql
ALTER TABLE ChannelVulnerability MODIFY COLUMN name VARCHAR(255) NOT NULL;
ALTER TABLE ChannelVulnerability MODIFY COLUMN code VARCHAR(255) NOT NULL;
START TRANSACTION;
    CREATE TABLE dradtm_copy(defectReporterId int not null, applicationDefectTrackerId int not null);
    ALTER TABLE dradtm_copy ADD UNIQUE KEY (defectReporterId,applicationDefectTrackerId);
    INSERT IGNORE INTO dradtm_copy SELECT * FROM defectreporterapplicationdefecttrackermapDefectReporterApplicationDefectTrackerMap;
    TRUNCATE defectreporterapplicationdefecttrackermapDefectReporterApplicationDefectTrackerMap;
    INSERT INTO defectreporterapplicationdefecttrackermapDefectReporterApplicationDefectTrackerMap SELECT * FROM dradtm_copy;
    DROP TABLE dradtm_copy;
COMMIT;
Expand
titleMS SQL Server
Code Block
languagesql
DROP INDEX IF EXISTS idx_code_channel_vuln ON ChannelVulnerability;
DROP INDEX IF EXISTS IX_ChannelVulnerability_channelTypeId ON ChannelVulnerability;
ALTER TABLE ChannelVulnerability ALTER COLUMN name VARCHAR(255) NOT NULL;
ALTER TABLE ChannelVulnerability ALTER COLUMN code VARCHAR(255) NOT NULL;
CREATE INDEX idx_code_channel_vuln on ChannelVulnerability (channelTypeId, code);
CREATE INDEX IX_ChannelVulnerability_channelTypeId ON ChannelVulnerability (channelTypeId, code) include (name, userCreated);

WITH aux_table AS (
  SELECT *, ROW_NUMBER() OVER (PARTITION BY defectReporterId,applicationDefectTrackerId ORDER BY defectReporterId) AS row_number
  FROM DefectReporterApplicationDefectTrackerMap
)
DELETE FROM aux_table
WHERE row_number > 1;
Tip

Tip

For large scripts, it may be most efficient to save them to a .sql file and either drag & drop them into your UI-based database manager (e.g., SSMS or MySQL Workbench), or if using a CLI to access your MySQL server, you can use the following example command to execute the script:

mysql -u [username] -p [dbname] < [updatescript.sql] -v -v

Start Tomcat/ThreadFix

  1. Restart Tomcat/ThreadFix.

  2. Navigate to the login page to ensure that it loads as expected. If so, you may now log in and verify that the new version is installed; the version is included in the page footer after logging in.

Note

When launching the new deployment for the first time after deploying the update, ThreadFix may take a few minutes to make necessary schema updates, so there may be a delay in accessing the login page.

Monitor the <tomcat-deploy>/logs/threadfix.log file to determine when it has finished, look for the second instance of the following event: Finished updating Enterprise Tags.

Please do not interrupt this process by stopping Tomcat.

Table of Contents

Table of Contents
excludeTable of content