From 10035703b0eff26ac9a3c6a4472649b7637c72bd Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Sat, 28 Nov 2026 18:48:02 -0700 Subject: [PATCH] First Commit --- docker-compose.yml | 188 +++++++++++++++++++++++++++++++++++++++++++++ example.env | 23 ++++++ launch-node.sh | 36 +++++++++ 3 files changed, 247 insertions(+) create mode 100644 docker-compose.yml create mode 100644 example.env create mode 100755 launch-node.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..04ebfcf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,188 @@ +# ============================================================================= +# Selkies + Wine gaming nodes (LinuxServer.io winegui = Selkies streaming base) +# +# Faithfully recreating the spirit of Annihilation Gaming, found by wandering +# up the staircase in the middle of Boardwalk Arcade on the hill in Boulder +# in the mid-1990s. +# +# LAN on for eternity brothers! +# Dedicated to the memories of Gutshot and Mystic +# +# ============================================================================= +# - Each node streams a Linux desktop with Wine/WineGUI to the browser. +# Node 1: https://:3101 (accept the self-signed cert) +# - ALL Wine state (~/.wine prefix, installed games, saves) lives in the +# per-node /config bind mount on your HD; containers are disposable. +# +# ADDING A NODE LATER — copy any existing service block and change exactly 5 +# things (all marked "NODE-SPECIFIC" below): +# 1. service name + container_name (wine3, selkies-wine3) +# 2. hostname -> becomes the Windows computer name +# (Wine uppercases it; keep <=15 +# chars, letters/digits, no - or _) +# 3. WINE3_PORT in .env + ports mapping (one HTTPS port per node) +# 4. config volume path (.../nodes/wine3/config) +# 5. ipv4_address (pattern: 172.30.99.1N for wineN) +# Everything else comes from the x-wine-env / x-wine-node anchors below. +# To ADD or OVERRIDE env vars on one node, give that service an +# `environment:` block starting with `<<: *wine-env` plus only the extras +# (YAML merges maps, not lists — see the commented wine-retro example). +# Docs: https://docs.linuxserver.io/selkies/ +# ============================================================================= + +x-wine-env: &wine-env + PUID: "${PUID:-1000}" + PGID: "${PGID:-1000}" + TZ: "${TZ:-America/Denver}" + # Basic auth for the web UI (LAN-grade only, do not expose to WAN as-is): + CUSTOM_USER: "${CUSTOM_USER:-abc}" + PASSWORD: "${PASSWORD:?Set PASSWORD in .env}" + # Browser file-transfer upload/download root -> lands on your HD: + FILE_MANAGER_PATH: /games + # Full-frame streaming mode (better for games/video; turn off if the plain + # desktop feels worse than the damage-tracking default): + SELKIES_VIDEO_STREAMING_MODE: "true" + +x-wine-node: &wine-node + image: lscr.io/linuxserver/winegui:latest + shm_size: 2gb # shared memory for the display/stream buffers + restart: unless-stopped + environment: *wine-env + devices: + - /dev/dri:/dev/dri # Intel/AMD GPU passthrough (Iris Xe here). + # AUTO-detects render+encode (zero copy). + # Remove this line to run pure CPU. + # --- Optional knobs (add on a service via an environment override) --------- + # TITLE=Wine Node browser tab name per node + # LC_ALL=en_US.UTF-8 session language + # DRINODE=/dev/dri/renderD128 multi-GPU: pin renderer... + # DRI_NODE=/dev/dri/renderD128 ...and encoder (same device = zero copy) + # AUTO_GPU=false disable auto GPU detection + # --- NVIDIA host instead of Intel/AMD: drop the /dev/dri device line above + # and use this on the service (needs driver 580+ and nvidia container + # toolkit on the host): + # runtime: nvidia + # deploy: + # resources: + # reservations: + # devices: + # - driver: nvidia + # count: all + # capabilities: [gpu] + +services: + wine1: + <<: *wine-node + container_name: selkies-wine1 # NODE-SPECIFIC + hostname: wine1 # NODE-SPECIFIC — also the Windows computer + # name Wine reports (verified inside this + # container: `hostname` prints WINE1) + ports: + - "${WINE1_PORT:-3101}:3001" # NODE-SPECIFIC — HTTPS web UI + stream + # - "3100:3000" # plain HTTP only if you front it with + # your os-caddy reverse proxy later + # --- game ports (only needed when PHYSICAL PCs on the LAN join a game + # hosted by this node; container-to-container needs none of this). + # Repeat per game port, add /udp where the game uses UDP: + # - "3074:3074/tcp" + # - "3074:3074/udp" + volumes: + # Whole $HOME incl. the default Wine prefix (~/.wine): every installed + # game, bottle, and save file persists here on the HD. + - ${HD_DIR:?Set HD_DIR in .env}/nodes/wine1/config:/config # NODE-SPECIFIC + # Game installs / uploads / shared assets across nodes: + - ${GAMES_DIR:?Set GAMES_DIR in .env}:/games + networks: + gamelan: + ipv4_address: 172.30.99.11 # NODE-SPECIFIC — stable address for + # host/join fields; wineN -> 172.30.99.1N + # aliases: [game-host] # extra DNS name on this network + + # --------------------------------------------------------------------------- + # wine2 — ready to uncomment when you add the second node. Isolated prefix, + # shared /games, and every other node can reach it as wine2, selkies-wine2, + # or 172.30.99.12 (all resolve inside the gamelan network). + # --------------------------------------------------------------------------- + # wine2: + # <<: *wine-node + # container_name: selkies-wine2 + # hostname: wine2 # Windows computer name: WINE2 + # ports: + # - "${WINE2_PORT:-3102}:3001" + # volumes: + # - ${HD_DIR}/nodes/wine2/config:/config + # - ${GAMES_DIR}:/games + # networks: + # gamelan: + # ipv4_address: 172.30.99.12 + + # --------------------------------------------------------------------------- + # wine-retro — dedicated node for old games capped at 1024x768 (or any fixed + # size). Pins the whole Linux session to that resolution so the game + # truescreens natively at its max res and Selkies stretches the video stream + # to fill your browser window (browser fullscreen; 4:3 content on a 16:9 + # monitor gets letterboxed). Verified against this image: server logs report + # "fixed 1024x768" with these vars. Change W/H to 800x600 / 640x480 per era. + # Keep modern games on wine1/2 where the desktop follows browser size. + # --------------------------------------------------------------------------- + # wine-retro: + # <<: *wine-node + # container_name: selkies-wine-retro + # hostname: wineretro # <=15 chars, no hyphens (NetBIOS) + # environment: + # <<: *wine-env # inherit shared vars, then override/add: + # TITLE: Retro Games + # SELKIES_ENABLE_RESIZE: "false" # stop following browser size... + # SELKIES_MANUAL_RESOLUTION: "true" # ...and pin this instead: + # SELKIES_MANUAL_WIDTH: "1024" + # SELKIES_MANUAL_HEIGHT: "768" + # ports: + # - "${WINERETRO_PORT:-3109}:3001" + # volumes: + # - ${HD_DIR}/nodes/wine-retro/config:/config + # - ${GAMES_DIR}:/games + # networks: + # gamelan: + # ipv4_address: 172.30.99.40 + + # --------------------------------------------------------------------------- + # True LAN presence (optional upgrade): if a game ONLY does broadcast/ + # multicast LAN discovery, or you want physical machines to reach the nodes + # without port mapping, replace `gamelan` on the services with `physlan` + # below. Give each node a real IP from a range outside OPNsense's DHCP + # pool. Caveats: macvlan containers can't talk to their own host, and the + # parent interface must be wired (check `ip -br link`). + # --------------------------------------------------------------------------- + # networks: # merges with the bottom block; keep + # gamelan: # gamelan for node-to-node if desired + # name: selkies-wine-gamelan + # physlan: + # name: selkies-wine-physlan + # driver: macvlan + # driver_opts: + # parent: enp0s31f6 # <-- your wired interface + # ipam: + # config: + # - subnet: 192.168.1.0/24 + # gateway: 192.168.1.1 # OPNsense + # ip_range: 192.168.1.200/29 + # + # then per service: + # networks: + # gamelan: {} # optional, node-to-node DNS keeps working + # physlan: + # ipv4_address: 192.168.1.201 + +# --- the shared game network --------------------------------------------------- +# All nodes in this file attach here by default: embedded DNS resolves every +# node by service name (wine1, wine2...) and container name (selkies-wine1...), +# and the fixed IPs below never change across rebuilds. Point-to-point host/join +# works on any port with zero extra config; broadcast discovery does not. +networks: + gamelan: + name: selkies-wine-gamelan + driver: bridge + ipam: + config: + - subnet: 172.30.99.0/24 + gateway: 172.30.99.1 diff --git a/example.env b/example.env new file mode 100644 index 0000000..3ca9352 --- /dev/null +++ b/example.env @@ -0,0 +1,23 @@ +# --- identity / locale -------------------------------------------------------- +PUID=1000 +PGID=1000 +TZ=America/Denver + +# --- web UI login (keep LAN-only) --------------------------------------------- +CUSTOM_USER=USERNAME +PASSWORD=CHANGEME + +# --- storage on your HD --------------------------------------------------------- +# HD_DIR is the root for everything persistent (Wine prefixes + saves live in +# nodes//config). NOTE: this machine currently has NO separate drive +# mounted — / is ~20G free. Once the HD is mounted, point HD_DIR at it, e.g.: +# HD_DIR=/mnt/johnathan/selkies-wine + +HD_DIR=./selkies-wine-data + +# Big game installs + browser uploads (mounted at /games in every node): +GAMES_DIR=${HD_DIR}/games + +# --- host ports per node (container always serves HTTPS on 3001) --------------- +WINE1_PORT=3101 +# WINE2_PORT=3102 diff --git a/launch-node.sh b/launch-node.sh new file mode 100755 index 0000000..71b70b8 --- /dev/null +++ b/launch-node.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Start a Selkies Wine node (idempotent) and open its stream in the browser. +# Usage: launch-node.sh [wine1|wine2|wine-retro] [--check] +# --check start + wait for the web UI but don't open a browser window +set -euo pipefail + +NODE="${1:-wine1}" +CDIR="$HOME/selkies-wine" +cd "$CDIR" + +# Port: read WINE*_PORT from .env, falling back to the compose defaults. +case "$NODE" in + wine1) DEF_PORT=3101 ;; + wine2) DEF_PORT=3102 ;; + wine-retro) DEF_PORT=3109 ;; + *) DEF_PORT=3101 ;; +esac +PORT_VAR="$(echo "$NODE" | tr '[:lower:]-' '[:upper:]_')_PORT" +PORT="$(grep -m1 "^${PORT_VAR}=" .env 2>/dev/null | cut -d= -f2-)" +PORT="${PORT:-$DEF_PORT}" + +docker compose up -d "$NODE" >/dev/null + +# Wait for the web UI to answer (cold starts take ~10s; auth returns 401, +# which still means "ready"). +for _ in $(seq 1 60); do + if curl -sk -o /dev/null --max-time 2 "https://localhost:${PORT}/"; then + break + fi + sleep 0.5 +done + +if [[ "${2:-}" != "--check" ]]; then + firefox "https://localhost:${PORT}/" +fi +echo "node=$NODE port=$PORT ready"