As we reach the end of September 2024, ThreadFix version 3.x on-premises has officially reached its End-of-Life. Therefore, there is no longer support or updates for this version of the product. We have fully transitioned our product and development teams to focus ThreadFix SaaS and migrating all customers over from the on-premises versions. Our Customer Success and Support teams are here to help you in migrating to ThreadFix SaaS and maximizing the value you see from this improved offering from Coalfire. This is the next phase of ThreadFix and our team is looking forward to continuing to support you on this journey.

Backup & Restore

You will learn

How to backup internal ThreadFix databases running in Kubernetes.

Prerequisites

Audience: IT Professional, or End User
Difficulty: Intermediate
Time needed: Approximately 15 minutes
Tools required: If any

Backing Up and Restoring Database with Kubernetes

The following document details how to backup internal ThreadFix databases running in Kubernetes.

To backup external databases please follow vendor instructions for creating database backups.

Vendor Links for External Database Backup and Restore

Backing Up Internal Kubernetes Database

The following should be performed on a bash compatible terminal with kubectl access to the Kubernetes cluster.

  1. Locate the name of the ThreadFix database.

    TF_DB=$(kubectl get po -l app.kubernetes.io/component=database,app.kubernetes.io/part-of=threadfix -o jsonpath='{.items[].metadata.name}')

     

  2. Create the database backup file.

    kubectl exec $TF_DB -- bash -c 'mysqldump -u$MYSQL_USER -p$MYSQL_PASSWORD --all-databases' > tf_db_dump.sql

     

  3. Inspect the database dump to ensure the command completed successfully.

  4. (Optional) gzip the database file.

    gzip tf_db_dump.sql

     

  5. Copy the database dump to a secure location.

Restoring Internal Kubernetes Database

Warning: This process is irreversible and will destroy all data in the ThreadFix instance.

  1. Get Helm instance name.

     

  2. Get the ThreadFix repository name.

    If installing from a local helm chart, the user’s local chart file should be used as the ThreadFix chart name.

  3. Export Helm values (replace <tf_instance_name> with the name gathered from step 1).

     

  4. Create db-only.yaml file with the following contents:

     

  5. Restart ThreadFix in Database Only Mode (replace <tf_instance_name> with the values from step 1 and <tf_chart_name> with the value from step 2).

     

  6. Drop existing data.

     

  7. Locate the name of the ThreadFix database.

     

  8. Restore data from the database dump file.

     

  9. Restart ThreadFix with previous settings (replace <tf_instance_name> with the values from step 1 and <tf_repo_name> with the value from step 2).

     

  10. Follow the on screen instructions to access the application.

    • Use kubectl get po -w to watch the installation progress

Complete Database Wipe and Restore (Advanced)

In rare circumstances, it is not possible to restore a database as is, and the database must be completely wiped. The most common cause of this is InnoDB corruption or a corrupted disk. In such situations the user may need to completely destroy the database instance and start from scratch. Please only attempt this after all other options have been exhausted.

  1. Get Helm instance name.

     

  2. Get the ThreadFix repository name.

     

  3. Export Helm values (replace <tf_instance_name> with the name gathered from step 1).

     

  4. Create db-only.yaml file with the following contents:

     

  5. Find the database PersistentVolumeClaim.

     

  6. Find the database StatefulSet.

     

  7. Delete the database StatefulSet.

     

  8. Delete the database PersistentVolumeClaim.

     

  9. Restart ThreadFix in Database Only Mode (replace <tf_instance_name> with the values from step 1 and <tf_chart_name> with the value from step 2).

     

  10. Wait until the database is running (Use Ctrl-C to exit once the database status is running).

     

  11. Locate the name of the ThreadFix database.

     

  12. Restore data from the database dump file.

     

  13. Restart ThreadFix with previous settings (replace <tf_instance_name> with the values from step 1 and <tf_repo_name> with the value from step 2).

     

  14. Follow the on screen instructions to access the application.

    • Use kubectl get po -w to watch the installation progress

www.threadfix.it | www.coalfire.com
Copyright © 2024 Coalfire. All rights reserved.

This Information Security Policy is CoalFire - Public: Distribution of this material is not limited.