Nextcloud MaintenanceJul 31, 2022BackupsTo 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 pgdumpTo 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 databaseroot is the user that is allowed to connect to mysql using unix socket authenticationAnd 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 DBUpgradesDo upgrades in the following order:create a backup (or Server snapshot)Update the nextcloud using the Web UpdaterFinish the update using the CLIDo a system updateReboot the serverDisable maintenace modeSome 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