Nextcloud Maintenance
Backups
To backup a nextcloud instance you have to save the following directories:
- Webroot (usually under
/var/www
) - Data dir (defined in nextcloud’s config)
- DB Dump -> either using mysqldump or pgdump
To do a mysql dump you can use the following command:
sudo mysqldump -u root -p ncdb -R -e --triggers --single-transaction > ncdb.sql
- ncdb is the name of you database
- root is the user that is allowed to connect to mysql using unix socket authentication
And for pgdump:
pg_dump -U www-data -w $DB_NAME -F p
- www-data is the linux system user that is allowed to connect to this DB
Upgrades
Do upgrades in the following order:
- create a backup (or Server snapshot)
- Update the nextcloud using the Web Updater
- Finish the update using the CLI
- Do a system update
- Reboot the server
- Disable maintenace mode
Some cli commands that are usefull:
sudo -u www-data php /var/www/technat.cloud/occ maintenace:mode --on
sudo -u www-data php /var/www/technat.cloud/occ upgrade
sudo -u www-data php occ db:add-missing-indices
sudo -u www-data php /var/www/technat.cloud/occ maintenace:mode --off