Skip to content

Instantly share code, notes, and snippets.

@CodaBool
Last active March 4, 2026 21:01
Show Gist options
  • Select an option

  • Save CodaBool/8a2e620f19eb6971c345e4699a5f322a to your computer and use it in GitHub Desktop.

Select an option

Save CodaBool/8a2e620f19eb6971c345e4699a5f322a to your computer and use it in GitHub Desktop.
Foundry simple hosting

Foundry

Requirements

Steps

  1. create a tailscale key with default settings
  2. create a .env file
# enter your foundryvtt username and password
FOUNDRY_PASSWORD=
FOUNDRY_USERNAME=
# add your tailscale auth key here
TS_AUTHKEY=
  1. create a docker-compose.yml file
services:
  foundry:
    image: felddy/foundryvtt:13
    container_name: foundry
    restart: unless-stopped
    user: 1000:1000
    env_file: [.env]
    environment:
      FOUNDRY_VERSION: "13.351"
      CONTAINER_PRESERVE_CONFIG: "true"
    volumes:
      - ./foundry:/data
    ports:
      - "127.0.0.1:30000:30000"

  tailscale:
    image: tailscale/tailscale:stable
    container_name: tailscale
    restart: unless-stopped
    network_mode: "host"
    env_file: [.env]
    cap_add: [NET_ADMIN, SYS_MODULE]
    environment:
      TS_STATE_DIR: /var/lib/tailscale
      TS_USERSPACE: "false"
      TS_HOSTNAME: "foundry"
    volumes:
      - ./tailscale:/var/lib/tailscale
      - /dev/net/tun:/dev/net/tun
    command: >
      sh -lc '
        set -e
        tailscaled --state=/var/lib/tailscale/tailscaled.state &
        sleep 2

        tailscale up --authkey=${TS_AUTHKEY} --hostname=${TS_HOSTNAME} --accept-dns=true

        tailscale serve reset || true
        tailscale funnel reset || true

        tailscale funnel --bg 30000

        tailscale cert $(tailscale serve status | grep -oE "https://[^ ]+\.ts\.net" | head -n1 | sed "s#https://##")

        echo "Foundry will be reachable at:"
        tailscale serve status | grep "# "
        tail -f /dev/null
      '
  1. if on linux create the folder before starting mkdir -p foundry to prevent permission issues
  2. docker compose up -d
  3. watch logs with docker logs tailscale -f. It will tell you your public URL

Make sure to set Foundry admin and user passwords. This is open to the internet at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment