Skip to content

Multiple Instances

PanSalut edited this page Jan 16, 2026 · 3 revisions

Running Multiple Instances

Need separate shopping lists for different households? You can run multiple Koffan instances, each with its own database and password. Since Koffan uses only ~2.5 MB RAM per instance, running 10+ instances is totally fine.

Use Cases

  • Multiple households - Separate lists for parents, siblings, in-laws
  • Different purposes - Work supplies vs home groceries
  • Roommates - Each person gets their own instance

Setup with Traefik

Here's a complete example using Traefik as a reverse proxy:

services:
  traefik:
    image: traefik:v3.0
    command:
      - "--providers.docker=true"
      - "--entrypoints.web.address=:80"
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  koffan-mom:
    image: ghcr.io/pansalut/koffan:latest
    expose:
      - "80"
    volumes:
      - ./data/mom:/data
    environment:
      - APP_PASSWORD=mom-secret-password
      - DEFAULT_LANG=en
    labels:
      - "traefik.http.routers.mom.rule=Host(`mom.koffan.example.com`)"
      - "traefik.http.services.mom.loadbalancer.server.port=80"

  koffan-dad:
    image: ghcr.io/pansalut/koffan:latest
    expose:
      - "80"
    volumes:
      - ./data/dad:/data
    environment:
      - APP_PASSWORD=dad-secret-password
      - DEFAULT_LANG=en
    labels:
      - "traefik.http.routers.dad.rule=Host(`dad.koffan.example.com`)"
      - "traefik.http.services.dad.loadbalancer.server.port=80"

  koffan-kids:
    image: ghcr.io/pansalut/koffan:latest
    expose:
      - "80"
    volumes:
      - ./data/kids:/data
    environment:
      - APP_PASSWORD=kids-password
      - DEFAULT_LANG=en
    labels:
      - "traefik.http.routers.kids.rule=Host(`kids.koffan.example.com`)"
      - "traefik.http.services.kids.loadbalancer.server.port=80"

Each instance gets:

  • Separate subdomain - Easy to remember URLs
  • Its own SQLite database - Completely isolated data
  • Custom environment variables - Different password, language, etc.

Setup with Nginx

If you prefer Nginx, here's a similar setup:

docker-compose.yaml

services:
  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - koffan-family1
      - koffan-family2

  koffan-family1:
    image: ghcr.io/pansalut/koffan:latest
    expose:
      - "80"
    volumes:
      - ./data/family1:/data
    environment:
      - APP_PASSWORD=family1-password
      - DEFAULT_LANG=en

  koffan-family2:
    image: ghcr.io/pansalut/koffan:latest
    expose:
      - "80"
    volumes:
      - ./data/family2:/data
    environment:
      - APP_PASSWORD=family2-password
      - DEFAULT_LANG=pl

nginx.conf

events {
    worker_connections 1024;
}

http {
    upstream family1 {
        server koffan-family1:80;
    }

    upstream family2 {
        server koffan-family2:80;
    }

    server {
        listen 80;
        server_name family1.koffan.example.com;

        location / {
            proxy_pass http://family1;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }

    server {
        listen 80;
        server_name family2.koffan.example.com;

        location / {
            proxy_pass http://family2;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
}

Adding Authentication with Cloudflare Access

If you're already using Cloudflare, you can add Cloudflare Access (free for up to 50 users) to protect each subdomain with email-based login - no code changes needed.

This gives you:

  • Email-based authentication per subdomain
  • No additional passwords to remember
  • Easy user management through Cloudflare dashboard

Need Help?

If something doesn't work or this setup feels too complicated for your use case, please open an issue and let me know! I'm considering adding better multi-instance support directly in the app if there's enough interest.

Clone this wiki locally