## Upgrading Glasswall OVA

Please follow the steps below to upgrade your Glasswall OVA:

1. Backup MongoDB data and create a *mongodump*.

```sh
kubectl port-forward svc/mongo-svc 27017
```

2. Open another terminal on the VM:

```sh
username=$(kubectl get secret mongodb-cdrplatform-cdrp-user -o json | jq -r '.data.username' | base64 -d)
password=$(kubectl get secret mongodb-cdrplatform-cdrp-user -o json | jq -r '.data.password' | base64 -d)
mongodump -h localhost -p 27017 --db cdrplatform --out halo_backup -u "${username:?}" -p "${password:?}"
zip -r halo_backup.zip halo_backup
```

3. Copy the backup zip file from the VM to a local machine.

```sh
scp glasswall@<ip-of-the-old-vm>:~/halo_backup.zip halo_backup.zip
```

4. Follow the steps in the deployment page based on [VMWare](/halo/vmware-deployment) or [Hyper-V](/halo/HyperV-deployment) to create a new VM using the new OVA/VHD.

5. Copy the `halo_backup.zip` from the local machine to the vVM.

```sh
scp halo_backup.zip glasswall@<ip-of-the-new-vm>:~/
```

6. Restore the data in the new VM.

```sh
kubectl port-forward svc/mongo-svc 27017
```

7. Open another terminal on the VM:

```sh
unzip halo_backup.zip
username=$(kubectl get secret mongodb-cdrplatform-cdrp-user -o json | jq -r '.data.username' | base64 -d)
password=$(kubectl get secret mongodb-cdrplatform-cdrp-user -o json | jq -r '.data.password' | base64 -d)
mongorestore --host localhost --port 27017 -u "${username:?}" -p "${password:?}" --authenticationMechanism=SCRAM-SHA-256 --authenticationDatabase=cdrplatform halo_backup
```

8. Clean up the backup files after the restore:

```sh
rm -rf halo_backup halo_backup.zip
```