Skip to main content

Bookstack

Bookstack

Docker Container

 

Watchtower läuft  
Allerdings wird Bookstack selbst nicht upgedated. 

###

Installieren

Installieren

> Bookstack ist ein leistungsstarkes OpenSource Wiki und kann leicht in einem Docker Container betrieben werden. 

###

Installieren von BookStack

[Installation · BookStack (bookstackapp.com)](https://www.bookstackapp.com/docs/admin/installation/)

```bash

# Ensure you have read the above information about what this script does before executing these commands.

# Download the script
wget https://raw.githubusercontent.com/BookStackApp/devops/main/scripts/installation-ubuntu-22.04.sh

# Make it executable
chmod a+x installation-ubuntu-22.04.sh

# Run the script with admin permissions
sudo ./installation-ubuntu-22.04.sh
```

##

Backup

BookStack does not currently have a built-in way to backup and restore but it 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.

---

##


Backup

There are two types of content you need to backup: Files and database records.

####

Database

The easiest way to backup the database is via `mysqldump`mysqldump:

<div

class="highlight"
id="bkmrk--0"><div
class="chroma">

</div></div><div
class="highlight"
id="bkmrk--1"><div
class="highlight"><div
class="chroma">


</div></div></div>```bash
# Syntax
## Only specify the `-p` option if the user provided has a password
mysqldump -u {mysql_user} -p {database_name} > {output_file_name}


# Example
mysqldump -u benny bookstack > bookstack.backup.sql

```

If you are using MySQL on Ubuntu, and are using the `root`root MySQL user, you will likely have to run the command above with `sudo`sudo:

<div

class="highlight"
id="bkmrk--2"><div
class="chroma">

</div></div><div
class="chroma"
id="bkmrk--3"></div>```bash
sudo mysqldump -u root bookstack > bookstack.backup.sql

```

The resulting file (`bookstack.backup.sql`sql in the examples above) will contain all the data from the database you specified. Copy this file to somewhere safe, ideally on a different device.

####

Files

Below is a list of files and folders containing data you should back up. The paths are shown relative to the root BookStack folder.

-

`
  • .env`env - File, Contains important configuration information.
    -
  • `
  • public/uploads`uploads - Folder, Contains any uploaded images (If not using amazon s3).
    -
  • `
  • storage/uploads`uploads - Folder, Contains uploaded page attachments (Only exists as of BookStack v0.13).

Alternatively you could backup up your whole BookStack folder but only the above are non-restorable.

The following command will create a compressed archive of the above folders and files:

```bash

tar -czvf bookstack-files-backup.tar.gz .env public/uploads storage/uploads



```

<div class="highlight" id="bkmrk--4"><div class="chroma">  
</div></div><div class="highlight" id="bkmrk--5"><div class="chroma">  
</div></div>The resulting file (`bookstack-files-backup.tar.gz`gz) will contain all your file data. Copy this to a safe place, ideally on a different device.

---

##


Restore

If you are restoring from scratch follow the [installation](https://www.bookstackapp.com/docs/admin/installation)installation instructions first to get a new BookStack instance set-up. **Do not run the `php artisan migrate`migrate installation step when installing BookStack**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.

####

Database

To restore the database you simply need to execute the sql in the output file from the `mysqldump`mysqldump you performed above. To do this copy your database SQL backup file onto the BookStack or database host machine and run the following:

<div

class="highlight"
id="bkmrk--7"><div
class="chroma">

</div></div><div
class="chroma"
id="bkmrk--8"></div>```bash
# Syntax
mysql -u {mysql_user} -p {database_name} < {backup_file_name}
## Only specify the -p if the user provided has a password

# Example
mysql -u benny -p bookstack < bookstack.backup.sql

# 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 version of BookStack you will have to run `php artisan migrate`migrate after restore to perform any required updates to the database.

####

Files

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`gz archive as per the backup instructions above you can simply copy that file to your BookStack folder then run the following command:

```bash

tar -xvzf bookstack-files-backup.tar.gz



```

<div class="highlight" id="bkmrk--10"><div class="chroma">  
</div></div><div class="highlight" id="bkmrk--11"><div class="chroma">  
</div></div>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 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 instructions](https://www.bookstackapp.com/docs/admin/installation)instructions.



 Version #7
 Erstellt: 19 October 2022 08:34:25 von hermann
 Zuletzt aktualisiert: 20 March 2023 11:43:13 von hermann