Self-Hosted Gramps Web - Simple Docker Setup Guide

I am using a standard Debian 11 container(CT) for this, but any type of distribution of Linux should work fine. I am not using a LAMP/LAPP template, I am not installing Apache/Nginx onto the CT, this is just a straight vanilla Debian install. I am doing SSL-Offloading via my firewall, pfSense, so we will not be going over SSL certificates in this guide.

Part 1: Initial Setup of the host

I am assuming only the root user is available:

Command(s):

  • apt update -y # Updates the repositories to see if any new updates are available
  • apt upgrade -y # Installs the new updates
  • apt install sudo -y # Allows non-root users to elevate commands once added to the sudo group
  • apt install vim -y # Installs the text-editor vim(or whatever you'd prefer)
  • adduser gramps # Adds a new user, I am using "gramps" to keep it simple
  • usermod -aG sudo gramps # Give the gramps user sudo abilities
  • su - gramps # Switch your current user(root) to the gramps user

The standard Debian image I am using lacks my personal text editor, vim, and also does not have the sudo package installed by default, so we need that sudo package if we add a new user and give it sudo abilities, which we are doing so the docker host won't be running under root directly.

Part 2: Setup Docker

Docker can get complicated pretty quickly and I do not have much experience with it, however using it for Gramps Web is pretty simple once you understand which options do what. For the most part, you can follow the Docker install URL that is linked at the top of this guide and that should get you 99% of the way.

I will be using the "Install Docker Engine on Debian" guide from Docker and everything will be executed by my gramps user.

sudo apt-get update

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

If you did all the above correctly then the last command, sudo docker run hello-world, will have a message that prints "Hello from Docker!" in the terminal. If you receieved this message then you should be good to proceed to the next step.

Part 3: Setup Gramps Web

To setup Gramps Web I will be semi-utilizing the "Deployment" page via https://gramps-project.github.io, which goes over setting up the Docker configuration for Gramps Web. Gramps Web provides a pre-configured docker-compose.yml file to test with port 80/http, however since I already have SSL Offloading setup, then I do not need to use port 80 or do any SSL configuration. This makes the setup relatively easy.

Command(s):

  • curl -fsSL https://raw.githubusercontent.com/gramps-project/web/main/examples/docker-compose-base/docker-compose.yml > docker-compose.yml # This will download the docker-compose.yml file and save it to your current directory(put it in your $HOME directory)
  • vim docker-compose.yml # Edit the file, again use whatever text editor you prefer
  • Change "80:5000" to "443:5000" (Example below)
  • sudo docker compose up -d # Gramps Web says to use "docker-compose"(with a dash!), however this is no longer supported on newer Docker versions! Compose is now a plugin, so no dash going forward!
Example of my docker-compose.yml
version: "3.7"

services:
  grampsweb:
    image: ghcr.io/gramps-project/grampsweb:latest
    restart: always
    ports:
      - "443:5000"  # host:docker
    environment:
      TREE: "Gramps Web"  # will create a new tree if not exists
    volumes:
      - gramps_users:/app/users  # persist user database
      - gramps_index:/app/indexdir  # persist search index
      - gramps_thumb_cache:/app/thumbnail_cache  # persist thumbnails
      - gramps_secret:/app/secret  # persist flask secret
      - gramps_db:/root/.gramps/grampsdb  # persist Gramps database
      - gramps_media:/app/media  # persist media files
    networks:
      - default

volumes:
  gramps_users:
  gramps_index:
  gramps_thumb_cache:
  gramps_secret:
  gramps_db:
  gramps_media:

After executing "docker compose up -d" you should start downloading the latest version of Gramps Web and the Docker Container should start up and your webpage should be available.