Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instructions how to setup foundry docker in conjunction with livekitav docker #430

Open
dinotheextinct opened this issue Sep 2, 2022 · 2 comments

Comments

@dinotheextinct
Copy link

🚀 Feature Proposal

A clearcut way how to achieve running this docker container alongside this livekitav docker: https://github.com/livekit/livekit

Motivation

Livekit is the only AV module for foundry which works reliably and is also provided in a docker container, so getting this working together out of the box, would be perfect solution for most foundryvtt setups.

Example

https://github.com/bekriebel/fvtt-module-avclient-livekit this is the module for foundry which incoperates livekitav

Pitch

If I cant get foundry docker to run alongside the livekit docker, there is no use for me of foundry in docker. Because I could run foundry wthout the container. Also if you use foundry you probably are going to need some form of AV to communicate with our playinggroup. Jitsi has terrible performance and using Discord alongside for communication is very clunky. The livekit module makes it really smooth and useful.

@kinland
Copy link

kinland commented May 1, 2023

I recently got this working myself. It took a fair bit of trial and error. You may make use of this if you want, but I offer no warranties. In particular, the port configuration is probably doing more than it needs to - I just got this working and haven't verified everything I did was necessary.

It's also worth noting that Livekit's instructions say they want you to use host networking (for performance reasons). My host is Windows, so that wasn't an option. I got it working inside a container but haven't done a real-world video/audio test yet.

Also, I had to modify the init_script.sh from LiveKit.

I was using https://github.com/bekriebel/fvtt-module-avclient-livekit/wiki/Installing-LiveKit-on-an-Existing-Self-Hosted-Foundry-Server as a basis, but for the above-mentioned reasons, I had to deviate and not use host networking.

version: "3.8"

secrets:
  config_json:
    file: secrets.json

services:
  foundry_lock_cleanup:
    image: alpine
    entrypoint: ["/bin/sh", "./shutdown_handler.sh"]
    volumes:
      - ./shutdown_handler.sh:/shutdown_handler.sh:ro
      - /home/username/fvtt/foundrydata:/foundrydata

  foundry:
    image: felddy/foundryvtt:preinstall
    depends_on:
      foundry_lock_cleanup:
        condition: service_started
      swag:
        condition: service_healthy
    container_name: foundry
    hostname: foundry
    init: true
    environment:
      - FOUNDRY_HOSTNAME=foundry-vtt.mydomain.com
      - FOUNDRY_MINIFY_STATIC_FILES=true
      - FOUNDRY_PROXY_SSL=true
      - FOUNDRY_PROXY_PORT=443
      - FOUNDRY_UPNP=true
    volumes:
      - /home/username/fvtt/foundrydata:/data
    restart: unless-stopped
    ports:
      - target: 30000
        published: 30000
        protocol: tcp
    # expose:
      # - 30000
    secrets:
      - source: config_json
        target: config.json
    networks:
      - frontend
      - backend
  

  swag:
    image: ghcr.io/linuxserver/swag
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=US/Pacific # Change to your timezone
      - URL=mydomain.com   # replace with your domain name
      - SUBDOMAINS=wildcard
      - CERTPROVIDER=zerossl
      - DNSPLUGIN=google-domains
      - VALIDATION=dns
      - EMAIL=accounts@horkin.com # your email address here (optional)
    volumes:
      - ./swag/config:/config  # replace with the correct path to your swag config dir
      - ./livekit.mydomain.com/livekit:/var/log/nginx/livekit
      - ./livekit.mydomain.com/livekit-turn:/var/log/nginx/livekit-turn
    ports:
      - 80:80
      - 443:443
      - 22:22
      - 444:444
      - 5349:5349
    healthcheck:
      test: ["CMD-SHELL", "wget -O /dev/null https://foundry-vtt.mydomain.com/health-check || exit 1"]
      interval: "60s"
      timeout: "3s"
      start_period: "5s"
      retries: 3
    restart: unless-stopped
    networks:
      - frontend
      - backend


  livekit:
    image: livekit/livekit-server:latest
    entrypoint: /bin/sh
    command: -c './init_script.sh && ./livekit-server --config /etc/livekit.yaml --bind 0.0.0.0'
    restart: unless-stopped
    # network_mode: "host"
    volumes:
      - ./livekit.mydomain.com/livekit.yaml:/etc/livekit.yaml
      - ./livekit.mydomain.com/init_script.sh:/init_script.sh
      - ./livekit.mydomain.com/livekit:/var/log/nginx/livekit
      - ./livekit.mydomain.com/livekit-turn:/var/log/nginx/livekit-turn
    ports:
      - 7880:7880
      - 7881:7881
      - 7882:7882
    depends_on:
      swag:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - backend

  redis:
    image: redis:6-alpine
    command: redis-server /etc/redis.conf
    # network_mode: "host"
    depends_on:
      swag:
        condition: service_healthy
    ports:
      - 6379:6379
    volumes:
      - ./livekit.mydomain.com/redis.conf:/etc/redis.conf
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
    networks:
      - backend

networks:
  frontend:
  backend:

@felddy
Copy link
Owner

felddy commented May 1, 2023

Thank you for posting it. I was just revisiting this yesterday and was getting a bit overwhelmed and distracted by all the flashy bits. I do want to put together a cookbook for things like this and this will be a good first step.

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

No branches or pull requests

3 participants