Files
truecharts/charts/stable/nextcloud/docs/migration-guide.md
Stavros Kois a51d429028 chore(preccomit): run precocmit (#13387)
**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
2023-10-08 02:01:20 +03:00

4.4 KiB

Nextcloud Migration Guide

This guide will walk you through the migration process for Nextcloud. This guide utilize HostPath or NFS for UserData.

:::danger SMB EXTERNAL STORAGE

If you are using SMB authenticated external storage on your Nextcloud remove it before starting this guide. The migration process will fail if it is not removed.

:::

:::danger TWO FACTOR AUTHENTICATION

If you are using two factor authentication on your Nextcloud accounts disable it before starting this guide. While it can be done via the CLI later it is much easier to disable it before hand.

:::

Backup Nextcloud Database

If you have not already done so install PGAdmin and the tcdbinfo.sh script

  1. Run the tcdbinfo.sh script and take note of the connection info
bash tcdbinfo.sh

tcdbinfo-output

  1. Add Nextcloud to PGAdmin using the connection info from previous step.

pgadmin-connection1 pgadmin-connection2

  1. Backup Nextcloud database.

pgadmin-backup

Delete Nextcloud

:::danger Userdata Location

Do not remove your Nextcloud installation until you have confirmed you use HostPath/NFS for user data or have copied UserData using utilizing Heavyscript

:::

If you are using HostPath of NFS for UserData then remove your current Nextcloud installation. If you are using PVC for UserData then you will first need to mount your Nextcloud PVC and copy your UserData to a new dataset.

Remove Old Nextcloud AppData

This step is not required but to have a clean installation remove all UserData folder and files that are not user folders.

ls -la

userdata-old

:::warning

Next steps are destructive without a way to undo. Make sure you have proper backups to avoid data loss.

You have been warned

rm -rf <folder>
rm .ocdata .htaccess index.html nextcloud.log

userdata-clean

:::

Change UserData Permissions

The new version of Nextcloud uses apps instead of www-data for file ownership. Apply permissions as shown below to your UserData dataset.

userdata-perms

Install Nextcloud

Install with a temporary user that you do not currently use for Nextcloud (ie. temp)

Setup Nextcloud UserData storage with your previous UserData dataset or the dataset you copied your UserData to.

userdata-setting

Restore Nextcloud Database

:::caution Nextcloud Installation

Wait for Nextcloud to fully deploy before proceeding.

:::

  1. Stop the main pod of Nextcloud.
k3s kubectl scale deploy nextcloud -n ix-nextcloud --replicas=0
  1. Add Nextcloud to PGAdmin as guided in steps 1 and 2 here.

  2. In PGAdmin right click on the database and select restore as shown below.

pgadmin-restore1

  1. Select the database backup you created previously.

pgadmin-restore2

  1. Configure Data/Objects as shown below.

pgadmin-restore3

  1. Configure Options as shown below and click restore.

pgadmin-restore4

:::caution PGAdmin Error

PGAdmin may display an error during the restore process. This is known to occur and may be ignored.

:::

  1. Start the main pod of Nextcloud.
k3s kubectl scale deploy nextcloud -n ix-nextcloud --replicas=1

Nextcloud OCC Commands

:::caution Nextcloud Deploy

Wait for Nextcloud to fully deploy before proceeding.

:::

  1. Open a shell for the Nextcloud main pod as shown below. Ensure your are selecting the correct pod it should just say nextcloud for both Pods (followed by random characters only) and Containers as shown below.

nextcloud-cli

  1. Run the following commands in the Nextcloud shell.
occ upgrade
occ maintenance:mode --on
occ maintenance:repair
occ maintenance:mode --off
occ db:add-missing-indices
occ files:scan --all

Delete Temporary User Data Folder

You may now remove the folder created during install for the temporary user that was configured.