standbymeintothewild
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Store
Gallery
Bug Reports
Documentation
Landing
Posts posted by standbymeintothewild
-
-
-
-
On 9/2/2022 at 8:20 AM, neepninja said:
Hello. How can I dump my database to sql format and copy the file onto my array please?
Thanks.
Yes, this is what mysqldump can do
simple example
docker exec mariadb /usr/bin/mysqldump --user=root --password=******** {{dbname}} > /mnt/user/data/mariadb_backup/dump.sql
This post over shows how to set up a backup that goes daily or whenever you decide that the script is run. I use a similar script for all my databases.
-
On 8/14/2022 at 2:10 PM, matus said:
If I remove overwrite.cli.url; overwritehost; overwriteprotocol I can access nextcloud through IP correctly. But when I try to set it up with nginx and cloudflare tunnel, I will get:
I'd appreciate if you could point me in the right direction..
I'm also using Nginx Proxy manager. I had a look at my config file.
'overwrite.cli.url' => 'https://nextcloud.MYDOMAIN.XYZ', 'overwritehost' => 'nextcloud.MYDOMAIN.XYZ', 'overwriteprotocol' => 'https',
'overwritehost', 'overwriteprotocol' is not in my config, and overwrite.cli.url is set to host ip like
'overwrite.cli.url' => 'https://192.168.9.187:444',
my Nginx Proxy manager is pointing to the "https" ip of my nextcloud container and i use the settings under SSL to force https. -
Hi, I have not seen anyone else show how to use mysqldump to generate database backups similar to
https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html
So this is the script I smashed together to make my backups (using User Scripts by Squid) that I run every day
Recap what is does- The script sets nextcloud in maintenance mode first
- Then the backup run (note that I use the utf8mb4 setting) | I compress it a bit (this could be better) and add a timestamp to the file.
- There is printed a successful or not statement to the terminal/log
- Nextcloud is taken out of maintenance
- Then I keep the 7 newest files and delete any older ones in my case keep the last 7 days. (this is due to not bloat my remote backup) It produces an error message here but it works.
The dedicated backup user have these privileges “SELECT, SHOW VIEW, TRIGGER, PROCESS, LOCK TABLES” for the db. I can’t remember where I found the overview of what was necessary. You could use the root user, just don’t, that user is too valuable.
To create a dedicated backup user
Open the mariadb terminalmysql -uroot -p
enter your root password
run the user create command under. You need to change all {{}} contentCREATE USER '{{Dedicated Backup user}}'@'%' IDENTIFIED by '{{password}}'; GRANT SELECT, PROCESS, LOCK TABLES, TRIGGER, SHOW VIEW ON *.* TO '{{Dedicated Backup user}}'@'%';
This user have access to all DBs on your mariadb instance but can't grant privilege, delete or update content
I hope this is helpful and do you have any feedback let me know.#!/bin/bash #description=Run to backup db for nextcloud #foregroundOnly=false #backgroundOnly=false #arrayStarted=true #turn on maintenacemode docker exec nextcloud occ maintenance:mode --on #Backup and compression of db docker exec MariaDB /usr/bin/mysqldump --single-transaction --default-character-set=utf8mb4 --user={{Dedicated Backup user}} --password={{password}} nextcloud | gzip > /mnt/user/{{full path to backup}}/nextcloudDB/nextcloud-sqlbkp_`date +"%Y%m%d"`.gz if [ "$?" -eq 0 ] then echo "Mysqldump executed successfully" else echo "Mysqldump encountered a problem" fi #turn off maintenacemode docker exec nextcloud occ maintenance:mode --off #Keep the 7 newest files, delete the oldest cd /mnt/user/{{full path to backup}}/nextcloudDB && ls -tp | grep -v '/$' | tail -n +8 | tr '\n' '\0' | xargs -0 rm --
---------------------------------------------------------------------
RESTORE
So my caching drive died, and I needed to recreate my db for nextcloud
This is the steps I used, together with this guide.
https://docs.nextcloud.com/server/latest/admin_manual/maintenance/restore.html
First use the same db creation commands as first time (note that I use the utf8mb4 setting), if you lost your full mariadb install like me you have lost the user accounts as well
write this is in the mariadb terminalmysql -uroot -p CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; CREATE USER 'nextcloud' IDENTIFIED by 'password'; GRANT ALL PRIVILEGES ON nextcloud.* to 'nextcloud' IDENTIFIED BY 'password';
Find your latesed db backup-file and decompressed it from main terminal
gzip -d /path/to/file/nextcloud-sqlbkp_20220601.gz
write this command to restore from dump in mariadb terminal (but not logged into MariaDb commandline, Ctrl+c to logout)
make sure that your file is reachable from your mariadb docker containermysql --user root --password nextcloud < /path/to/file/nextcloud-sqlbkp_20220601
you will get promted for a password. "nextcloud" above is the database name of target db.
It will take som time to restore, and your db is back 😄
Be aware that you need a backup of your config files and data also, I do not understand it good enough to write about it here, but I had backups.
[Plugin] CA User Scripts
in Plugin Support
Posted
Yes, had it set to false. But removing it solved my problem, thank you