mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-05 00:29:48 +03:00
Backup and Restore functionality #1969
Open
opened 2026-02-05 02:21:16 +03:00 by OVERLORD
·
13 comments
No Branch/Tag Specified
development
l10n_development
further_theme_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#1969
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @partoneoftwo on GitHub (Dec 11, 2020).
User story
As the owner of a bookstack wiki that contains a lot of information that I have spent huge amounts of time in curating. In addition this information is very important to me. Bookstack is so great and I use it for business and private purposes.
Because of this heavy reliance, I want to be able to know that I can ensure that I have a way to back up the entire bookstack instance. I also need to be able to restore this backup regardless of the runtime version of the Bookstack version.
Security description
This is important to strengthen the NIST dimension of RECOVER.
For operational security perspective, this feature will strengthen the CIA aspect; Whenever Confidentiality, Integrity and or Availability has been impaired/breached, then this recovery functionality is a critical thing to have.
Describe the feature you'd like
A backup feature where I can back up all the information and images and structure that I have entered as an end user of Bookstack.
A restore feature where I can restore all the information and images and structure that I have entered as an end user of Bookstack, which my backup container contains. It is of course critical that restore is possible without failing, regardless if a backup package was done on an older version than what is currently installed. But this is of course hard to achieve.
Describe the benefits this feature would bring to BookStack users
Benefits for a user:
The backup and restore feature will make it very easy to secure information which I as a user really care about.
As a user I am able to quickly be able to restore Bookstack instances, and I can do it without interacting without touching the infrastructure / container layer*
Benefits for the product/project: Bookstack will be perceived as more reliable and a secure viable solution, for use in different scenarios where information criticality is high.
Additional context
This is needed to make the product more mature.
It is a highly usable feature which will make the product more attractive.
I am aware of a feature request which has been closed #43, regarding backup of Bookstack data. However it focused on backing up singular pages. This feature request is regarding the entire bookstack instance covering the following data objects:
Data
Configuration
Did I mention I'm a massive fan of this software?
@ssddanbrown commented on GitHub (Dec 12, 2020):
Hi @partoneoftwo, Thanks!
You could make the maturity statement about pretty much any addition to be honest, and I'm not looking to chase maturity itself; Same with "attractiveness", These are not primary goals of the project, I'd rather focus on improving the experience for existing users which, as you've explained, this would also benefit.
To be honest, I'm aware this is an area that we're lacking in, at least in manner that's intuitive.
My main concern has always been something you requested in this line:
Bringing backup mechanisms into the application layer brings a lot of risk and instability, the application layer relies on the web-server and infrastructure layers it's sat upon. We could quickly get into trouble with things like timeouts, file permissions and request/response size limits. We'd then likely end up needed a lot of configuration options to suit the different requirements and environments that BookStack may run in. I'm not saying it's not possible at all, Just that it would require some ongoing effort while increasing accessibility to backups while decreasing reliability. This is why I've guided people so far in the direction of doing backup at the infrastructure layer.
How about we instead spend some time increasing accessibility of backups at an infrastructure layer? We could start adding some example scripts to the devops bookstack repo then link to these in the docs with some guidance, to the point where someone with a common setup could just download the script, add it to cron for scheduling, then be done with it. We could then include these to be used in the install scripts and container publishes could build these in.
@ssddanbrown commented on GitHub (Dec 12, 2020):
Related to #723
@modem7 commented on GitHub (Jan 11, 2021):
Just to add another point of view: for those on Docker, the infrastructure layer is somewhat different, and far more controllable, so this functionality, especially if it's able to be done on a cron job would definitely be useful.
@numen31337 commented on GitHub (Sep 1, 2021):
Hey guys, while this feature is still being developed, I can share a script I use for continuous backup performed by a server once a week/month. It uses the API and a separate read-only user to perform a full backup. The parsing part is so weird because I need it to work on macOS without non-greedy Perl-style grep.
Perhaps it will come in handy for someone looking for an automated solution.
Here's the full script with a bit more bells and whistles, which I personally use for basic backup, which is enough for my needs. Tested on macOS and Synology NAS Linux.
@modem7 commented on GitHub (Sep 1, 2021):
Good shout!
I'd recommend changing your token (assuming it's your real one) though just in case.
@aslmx commented on GitHub (Dec 7, 2021):
@numen31337 thanks a lot for your comments here. Not sure if it was existing already somewhere else, but i added a little jq trickery around the json and now have the bookname in the filename.
https://gist.github.com/aslmx/a0fded5c4b180b45a6bb54963a3643bf
@mhjor70 commented on GitHub (Dec 12, 2021):
So once you have the backup how do you restore it ? Here is why i ask. I am setting up bookstack at several sites to store configuration docs for clients. Some of the "framework" of the shelves->books->pages will be the same. So rather than repeat the creation on multiple sites i would like to import the base "framework" from a master site when i start a new instance.
@patbcc commented on GitHub (Feb 10, 2023):
I'd like to add my few cents to this issue.
We have a production system running v22.07.3. This runs in a VM. We generally rely on VM snapshots as backups. However, as with the OP we have a lot of content that would be lost should the snapshots not work when a restoral was needed. So I was testing the backup and restore method referenced in the docs (https://www.bookstackapp.com/docs/admin/backup-restore/). In doing so I ran into an issue caused by version differences. The test environment has the latest release; 23.01.1. Although importing was successful, the site fails to load due to two missing columns in the entity_permissions table (entity_type and view). I'm guessing these were added at some point after 22.07.3.
So it would appear that this type of issue is another hurdle for adding backup and restore functionality. Either the functionality would need to be able to determine the differences between versions and correct them or older releases would need to be made available so that the BookStack server could be rebuilt to the same version as the backup that was made prior to restoring then updated to the latest version (if so desired).
As a side note, the documentation should be updated to point out the issues caused by differences in the version where the backup was made and the version where the restore is occurring.
@AuthorShin commented on GitHub (Aug 2, 2023):
@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.
@AuthorShin commented on GitHub (Sep 16, 2023):
Any thoughts on this one?https://github.com/BookStackApp/BookStack/issues/2405#issuecomment-1661419213 @ssddanbrown
@ssddanbrown commented on GitHub (Sep 16, 2023):
@AuthorShin That would be more of an export/import format, rather than backup/restore format, since it's quite minimal in terms of the overall related content unless you go to a lot of extra effort. If I was going to do an import/export format of some kind, it'd more likely be that following our API content structure, but that's out of scope for this issue.
If you wanted something like that defined, then a couple of our API scripts come close, may be able to get what you want with a little extra tweaking.
@ssddanbrown commented on GitHub (Sep 16, 2023):
As a general related update to this, earlier this year BookStack started including a System CLI, which can help automate tasks like backup and restore. It is in an alpha state.
@dw5 commented on GitHub (Sep 23, 2024):
IMO A good example is what Snipe-it does. Backups content and database into a zip file, from which it can be imported back 1:1