Skip to content

Instantly share code, notes, and snippets.

@pnlrogue1
Last active August 12, 2024 14:34
Show Gist options
  • Save pnlrogue1/a6ad27aec24c23837ec1ebd46191fc80 to your computer and use it in GitHub Desktop.
Save pnlrogue1/a6ad27aec24c23837ec1ebd46191fc80 to your computer and use it in GitHub Desktop.
FoundryVTT via Podman

Run Foundry VTT via Podman

❗ Work in Progress
Note that this is a work in progress. It will have rough edges
  1. Install podman
  2. Setup variables (ONLY WORKS UNTIL YOU LOGOUT - IF YOU LOGOUT AND NEED THEM AGAIN, YOU WILL NEED TO RUN THIS STEP AGAIN)
    foundry_version="11-309"
    image_version="11.309"
    
  3. Create data directory
    mkdir {{ /path/to/data }}
    
  4. Create pod
    podman create \
      --env FOUNDRY_USERNAME='{{ username }}' \
      --env FOUNDRY_PASSWORD='{{ password }}' \
      --env CONTAINER_PRESERVE_CONFIG=true \
      --publish 30000:30000/tcp \
      --volume {{ /path/to/data }}:/data \
      --name foundry$foundry_version \
      --hostname foundry$foundry_version \
      felddy/foundryvtt:$image_version
    
    TODO: Find out how to work around the license acceptance - custom container image build?
  5. Generate SystemD unit files
    podman generate systemd --new --files --restart-policy=always -t 1 --name foundry$foundry_version
    
    TODO: What does the -t flag do and should it be 1?
  6. Move the unit file in to place and rename it to something more human-readable
    mkdir foundryUnitFiles
    mv container-foundry$foundry_version.service ~/foundryUnitFiles/foundry$foundry_version.service
    
  7. Enable the service
    systemctl enable --user ~/foundryUnitFiles/foundry$foundry_version.service
    
  8. Automatic HTTPS (requires a working Caddy installation)
    1. Edit /etc/caddy/Caddyfile to add your service. You can do this with Nano, VI, etc. sudo nano /etc/caddy/Caddyfile. Example Caddyfile:
      foundry.your.domain {
          reverse_proxy localhost:30000
          encode zstd gzip
      }
      
    2. Restart Caddy
      sudo service caddy restart 
      
  9. Reboot or start the service
    sudo reboot now
    # or
    systemctl start --user foundry$foundry_version.service
    

If you want to shutdown your Foundry server for any reason:

  1. (Recreate the variables if required)
  2. Disable the service
    systemctl disable --user foundry$foundry_version.service
    
  3. Shutdown the container
    systemctl stop --user foundry$foundry_version.service
    # podman stop foundry$foundry_version
    podman rm foundry$foundry_version
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment