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.
mkdir -p ~/services/grimmory/sudo mkdir -p /opt/grimmory/{mariadb/config,bookdrop,data,books}sudo chown -R 1000:1000 /opt/grimmoryWe 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.
| Path | Purpose |
|---|---|
/opt/grimmory/mariadb/config | Database storage |
/opt/grimmory/bookdrop | Auto Import Folder (see Bookdrop) |
/opt/grimmory/books | Your book library |
Setting up environment variables
cd ~/services/grimmoryCreate a .env file with the following variables.
# Grimmory Application SettingsAPP_USER_ID=1000APP_GROUP_ID=1000TZ=Etc/UTCBOOKLORE_PORT=6060
# Database Connection (Grimmory)DATABASE_URL=jdbc:mariadb://mariadb:3306/grimmoryDB_USER=grimmoryDB_PASSWORD=password
# MariaDB Container SettingsDB_USER_ID=1000DB_GROUP_ID=1000MYSQL_ROOT_PASSWORD=rootpasswordMYSQL_DATABASE=grimmorySet TZ to your timezone.
Change the DB_PASSWORD and MYSQL_ROOT_PASSWORD. You can generate them using openssl.
openssl rand -hex 32DB_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.
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: 10You may use the GHCR mirror if you cannot or do not want to use Docker Hub.
ghcr.io/grimmory-tools/grimmory:latestIt’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:
docker compose up -dGrimmory should now be available at localhost:6060
http://localhost:6060I recommend looking at Grimmory’s official documentation here to continue with the process of setting up the application.
Thanks for reading. Goodbye.