202504032226 Migrate Nextcloud via Kubernetes
DRAFT
Tips
- Use the helm chart – it feels a lot easier but there are limitations
- +ve -> handle the permissions for you and all the hidden
chownshenanigans - -ve no
configMapRefso it’s a bit annoying that I cannot mount an entire configMap in. I probably can but I need to dig deeper.
- +ve -> handle the permissions for you and all the hidden
- Use Longhorn NFS for the PV/PVC for the non-data folders. NFS via Truenas Share has an issue where its synchronous and painful. Using a NFS V4 share via Truenas takes 1 hour for the initialisation to occur.
Migration Steps
Follow most of the migration steps here but for brevity sake and future documentation, here is what it roughly looks like
- Startup the new nextcloud instance but don’t log in or do anything.
- Ensure ingresses are done right an your ingress controller can route the traffic for
httpsto your preferred domain name and TLS can be terminated.
- Ensure ingresses are done right an your ingress controller can route the traffic for
- Scale the replica to 0.
- Nuke the new postgres database and re-create it with the same name.
- Move the
/dataNFS share dir into a new NFS share- The reason I did this was because i wanted the old NFS share to not be overwritten. I could, theoretically use the same old share but I’d like to be safe than sorry.
- Do a db dump
- I moved from mariadb(mysql) to postgres. I used pgloader and wrote a script that looks to load it from mariadb to postgres
- After the db dump is done, I had to rename my schema from
mariadbtopublicin the new postgres db - Once the data is transferred into the NFS share intended to store the
datafor the nextcloud deployment as a NFS PV/PVC, spin up a single replica instance. - You’ll get errors namely as a consequence of the db dump. Update these fields in
config.phpfound in/configdir.- Incorrect db user name
- Incorrect db password
- Missing
overwrite.cli.urlfor trusted CLI url - Missing
overwriteprotocolfor HTTPS
- You can cp the folder from the pod locally and the cp back. The reason I did this was the lack of an editor in the
nextcloudpod.- After
cpthe newconfig.phpyou’ve edited into the pod, nextcloud app won’t be able to read it due to user permissions. Run this chown commandchown -R www-data:www-data config.phpin the pod - Rollout restart the pod
- After
- You will need to do an upgrade
- In the pod run
su -s /bin/sh www-data -c "php occ upgrade"
- In the pod run
- The upgrade should start to run
- Go to your
nextcloud.yourdomain.comaaaaand voila!