Contents

Bookstack

Contents

Bookstack is one of the best selfhosted ‘wiki’ sites and it is dead easy to setup. Bookstack uses a mysql container to store the data and a webcontainer to have the site on. I like to keep my sql containers seperate and se we change the default port from `3306` to `3311`. This is just random, but i normally start my sql containers at `3310` and then work my way up.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
version: "3"

services:
  bookstack_app:
    container_name: bookstack_app
    image: solidnerd/bookstack:latest
    environment:
      - DB_HOST=bookstack_db:3306
      - DB_DATABASE=bookstack
      - DB_USERNAME=bookstack
      - DB_PASSWORD=<dbpassword>
    volumes:
      - ${PWD}/uploads:/var/www/bookstack/public/uploads
      - ${PWD}/storage-uploads:/var/www/bookstack/public/storage
    depends_on:
      - bookstack_db
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=Host:bookstack.domain.com"
  bookstack_db:
    container_name: bookstack_db
    image: mysql:latest
    ports:
      - 3311:3306
    environment:
      - MYSQL_ROOT_PASSWORD=<rootpassword>
      - MYSQL_DATABASE=bookstack
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=<dbpassword>
    volumes:
      - ${PWD}/mysql:/var/lib/mysql
    labels:
      - "traefik.enable=false"

networks:
  default:
      external:
	name: webproxy

Bookstack just has the sql database and an upload and a storage folder. To back them up, i use a modified script from my Portainer post.

1
2
3
4
5
6
7
#!/bin/bash
NOW=$(date +"%Y%m%d-%H%M")
CURPATH='/home/<username>/Backup/bookstack'
echo $(/bin/mkdir -p "$CURPATH/$NOW")
echo $(/usr/bin/rsync -av --delete /home/<username>/Docker/bookstack/mysql/ "$CURPATH/$NOW")
echo $(/usr/bin/rsync -av --delete /home/<username>/Docker/bookstack/uploads/ "$CURPATH/$NOW")
echo $(/usr/bin/rsync -av --delete /home/<username>/Docker/bookstack/storage-uploads/ "$CURPATH/$NOW")