Table of Contents

BookStack

Note: since i don't use this service anymore, this page might be not updated.

BookStack is a very cool kind of Wiki / knowledge / publishing tool. It's Open Source, very polished and also very simple to use.

I don't use Bookstack because i don't really need it, Silverbullet is just enough for my needs, even if it's a different stuff.

Installation

Installing BookStack can be done on bare-metal with your existing PHP / MariaDB stack or use a pre-built container. I choose to go with the container because i find it easier than properly segregate yet another PHP installation.

BookStack do not provide container images themselves, but they rely on external providers and i choose the Linux Server guys because they have a great reputation and maintain lots of well polished images.

Of course i will show you how to install it via Podman on Gentoo instead of Docker, to go fully rootless and secure.

As usual, you need to create a dedicated user and create the data folder:

useradd -d /data/daemons/bookstack -m bookstack
mkdir /data/bookstack
chown bookstack:bookstack /data/bookstack

As user bookstack create the compose yaml file:

---
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
#      - PUID=1050
#      - PGID=1050
      - TZ=Europe/Rome
      - APP_URL=https://mydomain.com/bookstack
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=<your password>
      - DB_DATABASE=bookstackapp
    volumes:
      - /deposito/bookstack:/config
    ports:
      - 6875:80
    depends_on:
      - bookstack_db
    networks:
      - bookstack-net
 
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
#      - PUID=1050
#      - PGID=1050
      - TZ=Europe/London
      - MYSQL_ROOT_PASSWORD=<random root password>
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=<your password>
    volumes:
      - /data/bookstack:/config
    networks:
      - bookstack-net
 
networks:
  bookstack-net: {}

A few notes: you could use PUID / PGID but it's not really working, so i commented them out. They work for docker anyway, but podman is rootless by default, so there is no real reason to use them.

Of course choose proper available port (6875) and set the correct URL under APP_URL as well.

Reverse Proxy

As usual, you should access the service only via Reverse Proxy (see The Reverse Proxy concept), the following NGINX configuration file will be enough:

bookstack.conf
location = /bookstack { 
        return 301 https://$host/bookstack/;
}

location /bookstack/ {
    proxy_pass         http://127.0.0.1:6875/;
    proxy_redirect     off;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;
}

Autostart

If you follow my Custom User Services guide, just create, as root, the following links:

cd /etc/local.d
ln -s _servicer.sh 62-bookstack--podman.start
ln -s _servicer.sh 62-bookstack--podman.stop

First Access

Login to https://mydomain.com/bookstack/ as user admin@admin.org with password as password.