For any industry, IT or non-IT, Information or data is the key. There are various ways by which the information can be stored. Financial or structured data usually takes a table form and resides in a database. In the case of the non-structured generic data such as project documentation, knowledge base or personal documentation can be maintained well using a documentation platform rather than keeping it in files.
By keeping these informations in a platform, it is very easy to manage, edit, search the content as compared to the handling of files.
Introduction
There are many such platforms out in the market which we can use. Confluence by Atlassian is one such feature-rich platform. It also does provide a free edition with 2GB storage. If you like to keep all your data with you, self hosting will be best option.
Of all the products, BookStack is the one which I like the most. Bookstack is free and open source and the page editor has a simple WYSIWYG interface. BookStack has a very simple interface and all content can be broken down into Shelf, Books, Chapters, and Pages. It has built-in diagrams.net for easy creation of diagrams and many more.
In this article, we will discuss how to self-host BookStack in docker.
Prerequisites
Linux Server
The prerequisite is to have a Linux OS either in a public cloud or in your home server. Here I am using Ubuntu 20.04.
Docker Engine Installation
The latest stable version of the docker can be installed by executing just 2 lines of code in your Linux shell. Detailed documentation is available at https://docs.docker.com/engine/install/ubuntu/
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Add the current user (user ubuntu in my case) to the docker group
sudo usermod -aG docker ubuntu
Close the session and re-login for the user to update the permission
Bookstack Installation
Bookstack uses a SQL database to store the data. We use MariaDB as our database. Both the BookStack and MariaDB docker container images are from https://www.linuxserver.io/
Docker Network configuration
Let’s create a network the containers
sudo docker network create --subnet 10.10.10.0/24 data_default
Database Installation
Execute the below docker command to install the DB container.
docker run -d \
--name=bookstackdb \
-e PUID=1001 \
-e PGID=1001 \
-e MYSQL_ROOT_PASSWORD=pass123456 \
-e MYSQL_DATABASE=bookstackapp \
-e MYSQL_USER=bookstackuser \
-e MYSQL_PASSWORD=pass123456997 \
-v /opt/data/bookstack/db:/config \
--restart unless-stopped \
--network=data_default \
linuxserver/mariadb
Running the above command will download the MariaDB image and create a container from the repository and run it with the specified configuration as mentioned in the environment variables. The container will be attached to the data_default network with the name bookstackdb.
The data folder will be created “/opt/data/bookstack/db” if not already exist.
BookStack Installation
Execute the below docker command to install the BookStack container
docker run -d \
--name=bookstack \
-e PUID=1001 \
-e PGID=1001 \
-e DB_HOST=bookstackdb \
-e DB_USER=bookstackuser \
-e DB_PASS=pass123456997 \
-e DB_DATABASE=bookstackapp \
-e APP_URL=http://wiki.yourdomain.com:5865 \
-p 5865:80 \
-v /opt/data/bookstack/config:/config \
--restart unless-stopped \
--network=data_default \
linuxserver/bookstack
Make sure to properly configure the environment variables such as – database user and password, URL, port, etc.
To check the container status, run “docker ps” and it should show the below result. Book stack is listening at port 5865.
ubuntu@webserver:/opt/data/bookstack$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
33effffbf170 linuxserver/bookstack "/init" 3 minutes ago Up 2 minutes 443/tcp, 0.0.0.0:5865->80/tcp, :::5865->80/tcp bookstack
b7540622f83b linuxserver/mariadb "/init" 25 minutes ago Up 25 minutes 3306/tcp bookstackdb
Make necessary DNS entry to point the domain wiki.domain.com to the virtual machine IP and all set. BookStack is ready for use.
Final Steps
Open any web browser and type in the URL http://wiki.yourdomain.com:5865 to access your wiki site.
This should take us to the BookStack login
The default admin login of BookStack is [email protected] with the password password
Ensure to change the login email and the password after you login. Refer to the BookStack documentation https://www.bookstackapp.com/docs/admin/security/ for further configuration
Hope you liked this article and thank you for reading
Thank You!