Heavybullets8 / TT-Migration

PVC Migration script for Truenas SCALE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migration Script for TrueNAS SCALE

This script is designed to migrate most applications on TrueNAS SCALE. Occasionally, breaking changes occur which make updates impossible. This script may help overcome such issues by facilitating safe and effective migration of applications. Works with PVC's, CNPG Databases, both, or neither.


Usage

bash migration.sh

Options

Option Short Form Description
--skip -s Continue with a previously started migration.
--no-update -n Do not check for script updates.
--force Force migration without performing health checks, using this voids support and most of the time results in an error later on in the script, do not use this unless instructed to.
--latest-version -l Migrate to the latest version of the software. Note: using this option means you will not be supported.
--rename -r Prompt to rename the application.

Important Notes

  • Usage of --latest-version or --force flags might impact your eligibility for support. Any use of these flags will result in you not being supported. Please use these options with caution.


Failures

Make sure to retry with the --skip option

Failed applications will be added to this list if any are confirmed.

Application


Guide

Run The Script

Run Script


Finding App Dataset

Find Dataset

App Dataset Not Found?

Make sure you have a pool selected at: TrueNAS GUI > Apps.


System Train Check

System Train

Application is on the system train?

image

Unless specifically told to, you should not migrate these applications, but you can if you use the --force flag.


Database Check

Only used to check for CNPG databases

Database Check

Database Found?

Prompt to Attempt Restore

Prompt Restore

This means a CNPG database was found, and the script can attempt to backup and restore the database, but there is no guarantee that it will work. The script has been very solid in my experience when it comes to handling databases.


Prompt to Provide Your Own Database

Provide DB

If you chose yes for the first prompt, you will then be prompted to choose to use the automatic restore or provide your own restore.


  • If you choose yes, the script will exit and ask that you copy a file to the specified directory.

    Exit Script


  • If you choose no, the script will create a new dump.

    Create Dump


Creating App Dataset

Create Dataset

This created a dataset that will be used throughout the migration for backup information.


Renaming the App's PVCs

Rename PVCs

This moves the original applications PVCs to the backup directory.


Deleting the Original App

Delete App

Failure?

Occasionally failures can happen, the script will attempt to work through them, but if the script exits here, you will need to delete the application manually prior to continuing. This includes deleting any PVs and datasets for the application that are NOT under the migration dataset.


Renaming The Application

Rename App

If you choose to, you can rename the new application differently from the original.


Creating the Application

Create App

This creates the application with all the same settings from the original install.


Destroying the New App's PVCs

Destroy PVCs

This will destroy the new applications PVCs so that they can be replaced by the original.


Renaming the Migration PVCs to the New App's PVC Names

Rename Migration PVCs

This matches the applications PVCs, then renames and moves the originals.

About

PVC Migration script for Truenas SCALE


Languages

Language:Shell 96.6%Language:Python 3.4%