BookStack
BookStack copied to clipboard
Feature Request: Backup/Restore from settings page
For Feature Requests
Desired Feature: Backup/Restore from Settings Page
It would be a nice feature to, without configuring nightly backups, be able to take an ad hoc backup of bookstack from the interface to download, and be able to upload and restore a backup.
Backups would include SQL data and images, etc.
I think this is somewhat covered in an old thread here - https://github.com/BookStackApp/BookStack/issues/185
Somewhat-- though the integration is nice, I was looking for a more ad-hoc interface way to pull a backup. Similar to what you would do with a firewall device. We've got automated backups but I'd like for admin level users to be able to pull one at will if they are going to test somethings out that need to be reverted. For bookstack users -not- in the IT industry it gives them a chance to run their own backups as well.
@ssddanbrown
Deffo need a backup option from the user interface. As constraint, I am having to write less on bookstack and more on MS Word and duplicate onto bookstack simply because I have no backup of the content. Another reason is the pdfs exported are not so configurable or presentable for a proper written manual.
I'd be happy to write in bookstack only, if I knew i had a copy of the content which i could easily import into MS Word or even back into bookstack should anything go wrong.
This is sorely needed if you want users to have confidence in using bookstack.
I pour 5 hours of documenting stuff and I ask others to contribute to the documentation, and we cant easily, simply, quickly back it up and feel confident that the work we done is easily transferable if shit happens?
Just reading back up and restore instructions make me angry because just some script installed bookstack, I have no fucking clue about database users and what are the passwords and other stuff from there.
Please, really move the convenient backup restore process to high priority feature needed.
@ssddanbrown any thoughts on this?
This would be really helpful, at the moment we are copying the VM as an easy way to "backup" our BookStack
This would really be extremely helpful. Especially if it is more complicated to get direct console access to the machine that is hosting Bookstack (in my case a Docker container hosted in an AKS/Kubernetes cluster) a simple backup functionality that is accessible over a Web UI would be awesome and save a lot of time.
~~https://github.com/spatie/laravel-backup is useful for dumping a database and files to a zip, would have to investigate a restore method separately though.~~
Would consider this a duplicate of #185
2018...
Is this feature going to be added soon? I'm not backend/CLI savvy at all and I was just looking for a wiki that wasn't complicated like MediaWiki. Export and import are basic features for any wiki application. I'd like to try re-doing my build, but I've added so any notes now I'm afraid I'll lose everything. I can't even print the books because everything is in Japanese and that isn't supported very well with the current PDF converter -_-
Just another vote for this feature. A backup/restore functionality in Settings > Maintenance would be awesome.
Breaking this feature request down into multiple releases:
Release 1 - Export
The backup file created as part of this export, would included the things listed in the backup documentation
A button under maintenance would allow users to start the export.
The export would be performed in the background and a link would then appear in the UI near the export button.
Release 2 - Import
A zip file will be taken as an import. The system will check if all the files that should be present in a backup are accessible. It would then start processing the file and restore the system from it.
The system would wipe whatever data is currently present and overwrite it with the contents of the import file.
Future enhancements
- Update the system to keep track of last X exports.
- Update the system to restore an exported backup rather than just a zip file.
Thoughts?
Hi @Abijeet! Good to hear from you!
Backup/Restore in general is something I would like to add and think about often, but I have trouble deciding on a specific methods since there are trade-offs regarding different approaches. It'll be good to get some input on these to help my make a choice.
Before I delve into those, I just want to touch on terminology to prevent any mix-up of expectations. I think it's important to call this backup/restore since that enforces exactly what this would achieve (Whole system instance backup and restore). Import/Export can be interpreted as many things, people may expect to import from other systems or import into an existing system (Merge) or be able to perform partial content imports/exports. Those kind of actions would have a whole different scope of effort and challenge, while being focused on different results.
Here are the two backup options i jump between:
Standalone PHP Backup Script
This would be a PHP script that does not use any of the application system logic. My thinking is that this would potentially be more robust since it could work even if the application logic/files/environment is broken to some degree. This would be primarily be used from command line, with recommend use via a cron-job to automate backups (General good practice).
We could technically still call this from the application if desired, but I'm concerned we'd face some stability challenges due to different default handling of web-server PHP processes. In particular execution timeouts, memory limits. Of course we could ask users to change these values (Where allowed/possible/feasible) but that's not great practice to increase them just for this use, since limits are usually there for a reason.
In your above proposal you mentioned "The export would be performed in the background". While we did add background task support as of introducing the webhook functionality, this would be a significant hurdle to support users through in terms of system setup/configuration and would have an have a support cost ongoing to the future. We could maybe implement other hacky workarounds the standard request model but it's not ideal and would add complexity.
If this option was chosen, I'd focus on getting the command-line script mature for a few releases before rolling out to the UI.
In-App PHP Backup
So this is much like the above but with the logic in-app (Laravel-based). This would potentially be more fragile (Tied to more requirements and logic) but would be easer to develop for (Especially if we used the Spatie package, would have to assess their support pattern though to decide if that viably fits with BookStack). A big benefit is the ability to easily backup to s3-like cloud storage, although I guess the more advanced users who would desire that might find it easy to script that from regular file-based backups anyway.
Like the above, could provide both command-line and in-app backup options. Again, would probably look to implement the command-line component first then work on UI once battle-tested. Would have the same UI-usage issues as listed above though in regards to support and hitting limits.
Let me know your thoughts, especially in regards to what option sounds preferable.
In regards to restore, I'm tempted to say that we don't support it at all and keep logic out of core. Would could improve documentation in this area (With video support aswell) and maybe put together some assistance scripts in our devops repo. I say this because restore becomes a mess depending on scenario, BookStack versions, database state and the chosen method to run BookStack. Additionally, restore operations should be relatively rare in comparison to backup, should only really be needed in emergency and maybe some migration scenarios. I don't think it'd be worth maintaining such logic in the core project, at least until we gain more feedback and perspective on requirement.
In-App PHP Backup seems like the most user friendly thing to do. Just my thoughts.
@ssddanbrown Each page on BookStack got this HTML code that you can copy and paste somewhere else and have the exact same page/document (except the images), so why not do this?
Backup function can can turn shelves and books to the folders and sub-folders (since there are only one level of them it's very easy and straightforward to do so) and then there would be a .txt file that contain the HTML code of the page which later can be used for restore via GUI or manual one and automate this would be fairly easy I guess.
So let's say we got a book called "Black and White" with 12 chapters which is under "Dark" shelves the folder structure would be :
Dark (S) > Black and White (B) > chapter1 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter2 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter3 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter4 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter5 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter6 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter7 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter8 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter9 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter10 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter11 (C) > pageswiththeirtitle.txt Dark (S) > Black and White (B) > chapter12 (C) > pageswiththeirtitle.txt
And have all of these folders and files into a zip file which we can encrypt with a password as well.
Is there any Update on the Backup and Restore Process i would really like to see one, to have much more confidence in using Bookstack.
Tank you for your work!