Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No instructions on how to do backups of Nextcloud VM #2583

Open
celeroncool opened this issue Nov 4, 2023 · 10 comments
Open

No instructions on how to do backups of Nextcloud VM #2583

celeroncool opened this issue Nov 4, 2023 · 10 comments

Comments

@celeroncool
Copy link

How to use GitHub

  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Is your feature request related to a problem? Please describe.
This is a feature request and a problem, as data intergrity and backup are very important in todays IT landscape.

Describe the solution you'd like
I would like to have clear instructions, what files do you need to backup, what commands have to be ran so that DB is backed up correctly and lastly, what commands you have to run and in what order to restore from that backup.

Describe alternatives you've considered
I am currently trying to implement restic backups of my nextcloud instance.
The NCDATA and NCBACKUP folders are self explanatory, and those are easy to integrate to a cron script.
But currently there are no docs or guides on how you backup and restore rest of nextcloud VM.

Additional context
This guide uses https://github.com/dombyte/Restic-Nextcloud/blob/main/ncbackup.sh mysql dump, but nextcloud VM use PGSQL, which doesnt work with that.
It is unclear if you have to set the server to maintenneance mode before you make a SQL snapshot.

@enoch85
Copy link
Member

enoch85 commented Nov 4, 2023

Just use one of the built in backup methods.

You can reach them by running the menu script.

@celeroncool
Copy link
Author

Okay, is there any way to automate taking these backups?
For example, I back up my data from NCDATA folder via restic snapshots to a offsite location.

In the menu, is the correct location "Daily Backup Wizard" under "Server Configuration"?

I checked through the script https://github.com/nextcloud/vm/blob/master/not-supported/daily-backup-wizard.sh and seems that you have to have a separate mount to send backups to.
My nextcloud is running inside VM, and all data is mounted via NFS to /mnt/ncdata -> script cannot create daily backups.

Is it in development pipeline to add support for these configurations to the backup script?

@enoch85
Copy link
Member

enoch85 commented Nov 6, 2023

Okay, is there any way to automate taking these backups?

As you already noticed, this is what we have: Run the script and follow the instructions: sudo bash /var/scripts/menu.sh --> Server Configuration --> Daily backup

You are free to configure the script as you please.

We don't have any plans on supporting more than we already have.

You also have some scripts here.

@github-tomster
Copy link

as this is a vm one could consider backups at hypervisor level 🤷🏻

@celeroncool
Copy link
Author

How would we make sure the database is not locked etc while taking the backup?
I think what would work for everyone is to have a script which would dump the DB and configs to x folder (defined in maybe a menu script as a user submitted destination?) in a controlled manner.
This way any backup software can save the dump and config safely, and restoration would be as simple as just importing the DB and config file.

@enoch85
Copy link
Member

enoch85 commented Jul 18, 2024

as this is a vm one could consider backups at hypervisor level 🤷🏻

This.

Depending on system, you will get a full intact clone of your server. Veeam for example works with vMotion. Proxmox with [....] (don't remember the name). Anyway, at VM level is best if you ask me, then you don't need to take any guest system stuff in considerations. Sure, guest level backup are good if you want backups on file level.

@celeroncool
Copy link
Author

Taking VM snapshots from hypervisor is not guaranteed to take the DB backup intact!
For example, what happens when we take a snapshot of the VM while there are writes to the database? When we then try to restore the VM, the writes could be halfway done or maybe it was in middle of DB row update/delete, the DB will not be OK after restore.

I'll try to create some kind of a bare script which would do the following:

  1. Create backup of all important configs.
  2. Create file based backup of database using database native tools. -> This way restores are guaranteed as they are bundled with the app config taken same time.
  3. Export both in one file date stamped.
  4. Set up cron to automate taking this backup.

@enoch85
Copy link
Member

enoch85 commented Oct 21, 2024

@celeroncool You and @szaimen maybe could figure something out? :) I'll be reviewing your PR once it's sent here. 👍

@github-tomster
Copy link

shut down the vm for backup 💡
'problem' solved ✔

@enoch85
Copy link
Member

enoch85 commented Oct 21, 2024

shut down the vm for backup 💡 'problem' solved ✔

Haha that's also a way to do it. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants