The Things Stack database entries are managed between minor versions using database migrations.
User are informed of required migrations for each version via the Release Notes. It’s mandatory to run required database migrations for The Things Stack to function properly.
This page describes the steps for performing database operations on a The Things Stack Kubernetes Cluster.
General Procedure
- Delete current Jobs (if any).
$ kubectl delete jobs --all=true
- Do a dry run of a Helm update and store the evaluation to a file.
$ helm upgrade <name> oci://registry-1.docker.io/thethingsindustries/<repo> --version <version> --values <deployment>.values.yaml --dry-run --debug > dryrun.txt
You can also use a local Helm chart.
$ helm upgrade <name> <path-to-chart> --values <deployment>.values.yaml --dry-run --debug > dryrun.txt
- In the
dryrun.txt
file look for a job with the name<name>-<component>-migrate
.
For example a migration job for the Identity Server database would look like this.
apiVersion: batch/v1
kind: Job
metadata:
name: <name>-is-migrate
...
-
Copy the entire yaml content of this
Job
; until the---
lines to a new file<name>-<component>-migrate.yaml
. -
Deploy this Job manually.
kubectl apply -f <name>-<component>-migrate.yaml
-
Wait for the Job to complete.
-
Once successfully completed, this can be deleted.
kubectl delete -f <name>-<component>-migrate.yaml
Repeat the above process for all the components required. Currently only the IS and NOC components require migrations.