Tidied up backup/restore docs
This commit is contained in:
parent a299f229dd
commit e4c050c13e
1 changed files with 10 additions and 16 deletions
| @ -6,8 +6,7 @@ type = "admin-doc" | |||
+++ | ||||
| ||||
BookStack does not currently have a built-in way to backup and restore but it | ||||
can be done via the command line fairly simply. This process will be improved in | ||||
the future and will ideally be built-in at some point soon. | ||||
can be done via the command line fairly simply. | ||||
| ||||
Please note the below commands are based on using Ubuntu. If you are using a | ||||
different operating system you may have to alter these commands to suit. | ||||
| @ -24,16 +23,16 @@ The easiest way to backup the database is via `mysqldump`: | |||
| ||||
```bash | ||||
# Syntax | ||||
## Only specify the `-p` option if the user provided has a password | ||||
mysqldump -u {mysql_user} -p {database_name} > {output_file_name} | ||||
## Only specify the -p if the user provided has a password | ||||
| ||||
| ||||
# Example | ||||
mysqldump -u benny bookstack > bookstack.backup.sql | ||||
``` | ||||
| ||||
If you are using MySQL 5.7 on Ubuntu 16.04 and are using the `root` MySQL | ||||
user you will likely have to run the command above with `sudo`: | ||||
If you are using MySQL on Ubuntu, and are using the `root` MySQL | ||||
user, you will likely have to run the command above with `sudo`: | ||||
| ||||
```bash | ||||
sudo mysqldump -u root bookstack > bookstack.backup.sql | ||||
| @ -59,11 +58,7 @@ The following command will create a compressed archive of the above folders and | |||
files: | ||||
| ||||
```bash | ||||
# BookStack v0.13+: | ||||
tar -czvf bookstack-files-backup.tar.gz .env public/uploads storage/uploads | ||||
| ||||
# BookStack v0.12.* and below: | ||||
tar -czvf bookstack-files-backup.tar.gz .env public/uploads | ||||
``` | ||||
| ||||
The resulting file (`bookstack-files-backup.tar.gz`) will contain all your file | ||||
| @ -75,7 +70,7 @@ data. Copy this to a safe place, ideally on a different device. | |||
| ||||
If you are restoring from scratch follow the [installation](/docs/admin/installation) | ||||
instructions first to get a new BookStack instance set-up. | ||||
**Do not run the `php artisan migrate` installation step** when installing BookStack. | ||||
**Do not run the `php artisan migrate` installation step when installing BookStack**. | ||||
You may need to comment this command out if using an installer script. If using | ||||
a docker container, restore the database before running the BookStack container. | ||||
Once you are sure the new instance is set-up follow the instructions below. | ||||
| @ -94,17 +89,17 @@ mysql -u {mysql_user} -p {database_name} < {backup_file_name} | |||
# Example | ||||
mysql -u benny -p bookstack < bookstack.backup.sql | ||||
| ||||
# If using the root user on Ubuntu 16.04 and MySQL 5.7 you may | ||||
# If using the root user on Ubuntu you may | ||||
# have to run the above with root permissions via sudo: | ||||
sudo mysql -u root bookstack < bookstack.backup.sql | ||||
``` | ||||
| ||||
If you are restoring to a new verion of BookStack you will have to run | ||||
If you are restoring to a new version of BookStack you will have to run | ||||
`php artisan migrate` after restore to perform any required updates to the database. | ||||
| ||||
#### Files | ||||
| ||||
To restore the files you simple need to copy them from the backup archive | ||||
To restore the files you simply need to copy them from the backup archive | ||||
back to their original locations. If you created a compressed `bookstack-files-backup.tar.gz` | ||||
archive as per the backup instructions above you can simply copy that file to | ||||
your BookStack folder then run the following command: | ||||
| @ -116,7 +111,6 @@ tar -xvzf bookstack-files-backup.tar.gz | |||
If you get errors during the above command it may be due to permissions. | ||||
Change permissions so you can write to the restore locations. | ||||
| ||||
After a backup of the files you should re-set the permissions to ensure any write-required | ||||
After a backup of the files you should reset the permissions to ensure any write-required | ||||
locations are writable by the server. The locations required for this can be | ||||
found in the [installation](/docs/admin/installation) | ||||
instructions. | ||||
found in the [installation instructions](/docs/admin/installation). | ||||
| |
Loading…
Add table
Add a link
Reference in a new issue