Installing Gramps Web with Docker Compose and Caddy as reverse proxy

Gramps: most recent version, with Docker Compose.

In fact I’m not running Gramps yet, only starting to set it up. I’ll be hoping to use Gramps Web, running as Docker containers - I already run other web services with Docker. But I’ll need a reverse proxy to also serve Let’s Encrypt certificates, and for the last while I’ve been using Caddy.

However, I haven’t been able to find an example of a Gramps setup which uses Docker Compose and Caddy.

If there is one, or if anybody has some helpful advice, I’d love to know it!

Many thanks,
A.

I figured it out. I needed to make some changes to the docker compose file linked to in the docs “Deploy with docker”; it’s below. The addition of a new network is possibly unnecessary - docker is supposed to create a network for each new compose file - but I like to have my own, named, networks. Also, I was getting errors in the log files such as

redis.exceptions.ConnectionError: Error -2 connecting to grampsweb_redis:6379. Name or service not known.

So I thought it better to have my own, named, internal network to which all the containers belonged.

In my Caddyfile, all I needed was

grampsweb.mysite.net {
	reverse_proxy grampsweb:5000
	}

Anyway, here’s my docker compose file, with minor modifications; hope it may be helpful:

networks:
  caddy_net:
    external: true
    name: caddy_net
  grampsweb_net:
    external: false
    name: grampsweb_net

services:
  grampsweb: &grampsweb
    image: ghcr.io/gramps-project/grampsweb:latest
    container_name: grampsweb_server
    restart: always
    # ports line is not needed given the virtual port and its connection
    # to the caddy network, since caddy acts as a reverse proxy
    environment:
      GRAMPSWEB_TREE: "Gramps Web"  # will create a new tree if not exists
      VIRTUAL_PORT: "5000"
      VIRTUAL_HOST: grampsweb.mysite.net
      GRAMPSWEB_CELERY_CONFIG__broker_url: "redis://grampsweb_redis:6379/0"
      GRAMPSWEB_CELERY_CONFIG__result_backend: "redis://grampsweb_redis:6379/0"
      GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://grampsweb_redis:6379/1
    depends_on:
      - grampsweb_redis
    volumes:
      - gramps_users:/app/users  # persist user database
      - gramps_index:/app/indexdir  # persist search index
      - gramps_thumb_cache:/app/thumbnail_cache  # persist thumbnails
      - gramps_cache:/app/cache  # persist export and report caches
      - gramps_secret:/app/secret  # persist flask secret
      - gramps_db:/root/.gramps/grampsdb  # persist Gramps database
      - gramps_media:/app/media  # persist media files
      - gramps_tmp:/tmp
    networks:
      caddy_net:
      grampsweb_net:

  grampsweb_celery:
    <<: *grampsweb  # YAML merge key copying the entire grampsweb service config
    ports: []
    container_name: grampsweb_celery
    depends_on:
      - grampsweb_redis
    command: celery -A gramps_webapi.celery worker --loglevel=INFO --concurrency=2
    networks:
      grampsweb_net:

  grampsweb_redis:
    image: docker.io/library/redis:7.2.4-alpine
    container_name: grampsweb_redis
    restart: always
    networks:
      grampsweb_net:

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

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.