Skip to content
Abdul Kareem's Blog
Go back

A guide to installing Grimmory: Your self hosted digital library

DigitalOcean Referral Badge

Introduction

Grimmory is a self hosted book server that allows you to organize, access and self-host your digital library.

History

Grimmory is an independent community fork of Booklore. It was an open-source project licensed under the AGPLv3 license but was shut down by the developer. Grimmory exists as the most actively developed fork of Booklore.

See the project here: Website | GitHub

Self Hosting Grimmory

You can self host Grimmory on either your own hardware or you can use a VPS provider like DigitalOcean and host it in the cloud. In this blog, I’ll be hosting my instance on DigitalOcean.

Creating the directory structure

First up, we create the directory structure for the application.

Terminal window
mkdir -p ~/services/grimmory/
sudo mkdir -p /opt/grimmory/{mariadb/config,bookdrop,data,books}
sudo chown -R 1000:1000 /opt/grimmory

We do a chown with the user id and group id 1000 to ensure no permission issues occur as the grimmory container itself will be running with user and group id 1000. If you wish to run it as another user, substitute the user id with the appropriate user id in the .env file (here)[hyprlink]

The following defines which folders will be used for what purpose.

PathPurpose
/opt/grimmory/mariadb/configDatabase storage
/opt/grimmory/bookdropAuto Import Folder (see Bookdrop)
/opt/grimmory/booksYour book library

Setting up environment variables

Terminal window
cd ~/services/grimmory

Create a .env file with the following variables.

Terminal window
# Grimmory Application Settings
APP_USER_ID=1000
APP_GROUP_ID=1000
TZ=Etc/UTC
BOOKLORE_PORT=6060
# Database Connection (Grimmory)
DATABASE_URL=jdbc:mariadb://mariadb:3306/grimmory
DB_USER=grimmory
DB_PASSWORD=password
# MariaDB Container Settings
DB_USER_ID=1000
DB_GROUP_ID=1000
MYSQL_ROOT_PASSWORD=rootpassword
MYSQL_DATABASE=grimmory

Set TZ to your timezone. Change the DB_PASSWORD and MYSQL_ROOT_PASSWORD. You can generate them using openssl.

Terminal window
openssl rand -hex 32

DB_PASSWORD and MYSQL_ROOT_PASSWORD should ideally be different.

You can also download the file here.

Creating the compose file

Now for the compose file, we require two containers. The grimmory application itself and mariadb.

compose.yaml
services:
grimmory:
image: grimmory/grimmory:latest
container_name: grimmory
environment:
- USER_ID=${APP_USER_ID}
- GROUP_ID=${APP_GROUP_ID}
- TZ=${TZ}
- DATABASE_URL=${DATABASE_URL}
- DATABASE_USERNAME=${DB_USER}
- DATABASE_PASSWORD=${DB_PASSWORD}
- BOOKLORE_PORT=${BOOKLORE_PORT}
depends_on:
mariadb:
condition: service_healthy
ports:
- "${BOOKLORE_PORT}:${BOOKLORE_PORT}"
volumes:
- /opt/grimmory/data:/app/data
- /opt/grimmory/books/:/books
- /opt/grimmory/bookdrop:/bookdrop
restart: unless-stopped
mariadb:
image: lscr.io/linuxserver/mariadb:11.4.5
container_name: mariadb
environment:
- PUID=${DB_USER_ID}
- PGID=${DB_GROUP_ID}
- TZ=${TZ}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASSWORD}
volumes:
- /opt/grimmory/mariadb/config:/config
restart: unless-stopped
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
interval: 5s
timeout: 5s
retries: 10

You may use the GHCR mirror if you cannot or do not want to use Docker Hub.

Terminal window
ghcr.io/grimmory-tools/grimmory:latest

It’s recommended to pin the container to a tagged version when running in production. Check releases to find the tags.

You can also find the file here.

Starting the container

You’re now ready to run the application. Pull the container image and start it with:

Terminal window
docker compose up -d

Grimmory should now be available at localhost:6060

Terminal window
http://localhost:6060

I recommend looking at Grimmory’s official documentation here to continue with the process of setting up the application.

Thanks for reading. Goodbye.


Share this post:

Previous Post
Remapping Caps Lock to Escape on Linux
Next Post
How to install Arch Linux