From 16eb5ab230b8be74e539658b7631403081a85c1d Mon Sep 17 00:00:00 2001 From: bilal Date: Thu, 18 Jun 2026 19:58:32 +0300 Subject: [PATCH] Stabilize Steam startup and persistent user data in containers. Run Steam Big Picture as dedicated steam user with persistent home-backed storage and document first-run bootstrap behavior. Co-authored-by: Cursor --- Dockerfile | 8 +++++++- README.md | 13 +++++++++++++ docker-compose.yml | 8 ++++---- players/p1_config/apps.json | 16 +++------------- players/p2_config/apps.json | 16 +++------------- players/p3_config/apps.json | 16 +++------------- players/p4_config/apps.json | 16 +++------------- 7 files changed, 36 insertions(+), 57 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3ccd49..3eca8f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN dpkg --add-architecture i386 && \ apt-get update && apt-get install -y \ xvfb fluxbox dbus-x11 xauth xfonts-base x11-xserver-utils \ - software-properties-common wget curl ca-certificates \ + software-properties-common wget curl ca-certificates locales pciutils \ libcap2-bin libgomp1 mesa-utils \ libxcb-cursor0 libxcb-xinerama0 libxcb-xfixes0 libxcb-shape0 libxcb-randr0 libxcb-xtest0 \ libxcb1 libxcb-render0 libxcb-render-util0 libxcb-util1 libxcb-keysyms1 \ @@ -23,6 +23,7 @@ RUN wget "https://github.com/LizardByte/Sunshine/releases/download/v0.21.0/sunsh RUN apt-get update && \ echo "debconf steam/question select I AGREE" | debconf-set-selections \ && apt-get install -y /tmp/sunshine.deb steam:i386 steam-devices \ + && locale-gen en_US.UTF-8 \ && rm -f /tmp/sunshine.deb \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -30,9 +31,14 @@ RUN apt-get update && \ # 4. Скрипт очищает сессию, поднимает виртуальный экран, fluxbox и запускает Sunshine RUN echo '#!/bin/bash\n\ rm -f /tmp/.X99-lock /tmp/.X11-unix/X99\n\ +id steam >/dev/null 2>&1 || useradd -m -s /bin/bash steam\n\ +mkdir -p /home/steam/.local/share/Steam /tmp/xdg-steam\n\ +chown -R steam:steam /home/steam /tmp/xdg-steam\n\ Xvfb :99 -ac -screen 0 1920x1080x24 &\n\ export DISPLAY=:99\n\ export HOME=/root\n\ +export LANG=en_US.UTF-8\n\ +export LC_ALL=en_US.UTF-8\n\ sleep 3\n\ fluxbox &\n\ sleep 2\n\ diff --git a/README.md b/README.md index f41af32..2406549 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ `sunshine.conf` не хранится в репозитории и генерируется Sunshine автоматически при первом запуске контейнера. +`Steam Big Picture` запускается от отдельного пользователя `steam` внутри контейнера. Данные Steam сохраняются в `players/pX_steam` и не теряются после перезапуска контейнеров/сервера. + ### Порты В Moonlight при ручном добавлении указывается один адрес в формате `IP:base_port`. @@ -84,6 +86,17 @@ Moonlight использует `base_port` и вычисляет остальные порты автоматически. +### Первый запуск Steam + +При первом запуске Steam скачивает и распаковывает клиент (может занять 10-20 минут, в зависимости от канала). В это время в Moonlight может отображаться пустой/черный рабочий стол. + +Проверка прогресса для `player1`: +```bash +docker exec -it game-player-1 bash -lc 'tail -f /home/steam/.steam/debian-installation/logs/bootstrap_log.txt' +``` + +После завершения первичной загрузки повторно откройте сессию Moonlight и запустите `Steam Big Picture`. + ## Отладка Для проверки состояния контейнеров используйте: diff --git a/docker-compose.yml b/docker-compose.yml index 8af5c00..b93cf60 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,7 +39,7 @@ services: - "48010:48010/udp" - "47998-48000:47998-48000/udp" volumes: - - /DATA/AppData/game-server/players/p1_steam:/root/.local/share/Steam + - /DATA/AppData/game-server/players/p1_steam:/home/steam/.local/share/Steam - /DATA/AppData/game-server/players/p1_config:/root/.config/sunshine # Добавляем логирование для отладки logging: @@ -62,7 +62,7 @@ services: - "48040:48010/udp" - "48028-48030:47998-48000/udp" volumes: - - /DATA/AppData/game-server/players/p2_steam:/root/.local/share/Steam + - /DATA/AppData/game-server/players/p2_steam:/home/steam/.local/share/Steam - /DATA/AppData/game-server/players/p2_config:/root/.config/sunshine logging: driver: "json-file" @@ -84,7 +84,7 @@ services: - "48070:48010/udp" - "48058-48060:47998-48000/udp" volumes: - - /DATA/AppData/game-server/players/p3_steam:/root/.local/share/Steam + - /DATA/AppData/game-server/players/p3_steam:/home/steam/.local/share/Steam - /DATA/AppData/game-server/players/p3_config:/root/.config/sunshine logging: driver: "json-file" @@ -106,7 +106,7 @@ services: - "48100:48010/udp" - "48088-48090:47998-48000/udp" volumes: - - /DATA/AppData/game-server/players/p4_steam:/root/.local/share/Steam + - /DATA/AppData/game-server/players/p4_steam:/home/steam/.local/share/Steam - /DATA/AppData/game-server/players/p4_config:/root/.config/sunshine logging: driver: "json-file" diff --git a/players/p1_config/apps.json b/players/p1_config/apps.json index bde2842..be0a57d 100644 --- a/players/p1_config/apps.json +++ b/players/p1_config/apps.json @@ -1,31 +1,21 @@ { "env": { - "PATH": "$(PATH):$(HOME)/.local/bin" + "PATH": "$(PATH):$(HOME)/.local/bin:/usr/games" }, "apps": [ { "name": "Desktop", "image-path": "desktop.png" }, - { - "name": "Low Res Desktop", - "image-path": "desktop.png", - "prep-cmd": [ - { - "do": "xrandr --output HDMI-1 --mode 1920x1080", - "undo": "xrandr --output HDMI-1 --mode 1920x1200" - } - ] - }, { "name": "Steam Big Picture", "detached": [ - "setsid steam steam://open/bigpicture" + "bash -lc 'id steam >/dev/null 2>&1 || useradd -m -s /bin/bash steam; mkdir -p /home/steam/.local/share/Steam /tmp/xdg-steam; chown -R steam:steam /home/steam /tmp/xdg-steam; runuser -u steam -- env DISPLAY=:99 HOME=/home/steam XDG_RUNTIME_DIR=/tmp/xdg-steam LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/games/steam -tenfoot -no-cef-sandbox -cef-disable-gpu -cef-disable-gpu-compositing'" ], "prep-cmd": [ { "do": "", - "undo": "setsid steam steam://close/bigpicture" + "undo": "bash -lc 'pkill -u steam -f \"/usr/games/steam\" || true'" } ], "image-path": "steam.png" diff --git a/players/p2_config/apps.json b/players/p2_config/apps.json index bde2842..be0a57d 100644 --- a/players/p2_config/apps.json +++ b/players/p2_config/apps.json @@ -1,31 +1,21 @@ { "env": { - "PATH": "$(PATH):$(HOME)/.local/bin" + "PATH": "$(PATH):$(HOME)/.local/bin:/usr/games" }, "apps": [ { "name": "Desktop", "image-path": "desktop.png" }, - { - "name": "Low Res Desktop", - "image-path": "desktop.png", - "prep-cmd": [ - { - "do": "xrandr --output HDMI-1 --mode 1920x1080", - "undo": "xrandr --output HDMI-1 --mode 1920x1200" - } - ] - }, { "name": "Steam Big Picture", "detached": [ - "setsid steam steam://open/bigpicture" + "bash -lc 'id steam >/dev/null 2>&1 || useradd -m -s /bin/bash steam; mkdir -p /home/steam/.local/share/Steam /tmp/xdg-steam; chown -R steam:steam /home/steam /tmp/xdg-steam; runuser -u steam -- env DISPLAY=:99 HOME=/home/steam XDG_RUNTIME_DIR=/tmp/xdg-steam LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/games/steam -tenfoot -no-cef-sandbox -cef-disable-gpu -cef-disable-gpu-compositing'" ], "prep-cmd": [ { "do": "", - "undo": "setsid steam steam://close/bigpicture" + "undo": "bash -lc 'pkill -u steam -f \"/usr/games/steam\" || true'" } ], "image-path": "steam.png" diff --git a/players/p3_config/apps.json b/players/p3_config/apps.json index bde2842..be0a57d 100644 --- a/players/p3_config/apps.json +++ b/players/p3_config/apps.json @@ -1,31 +1,21 @@ { "env": { - "PATH": "$(PATH):$(HOME)/.local/bin" + "PATH": "$(PATH):$(HOME)/.local/bin:/usr/games" }, "apps": [ { "name": "Desktop", "image-path": "desktop.png" }, - { - "name": "Low Res Desktop", - "image-path": "desktop.png", - "prep-cmd": [ - { - "do": "xrandr --output HDMI-1 --mode 1920x1080", - "undo": "xrandr --output HDMI-1 --mode 1920x1200" - } - ] - }, { "name": "Steam Big Picture", "detached": [ - "setsid steam steam://open/bigpicture" + "bash -lc 'id steam >/dev/null 2>&1 || useradd -m -s /bin/bash steam; mkdir -p /home/steam/.local/share/Steam /tmp/xdg-steam; chown -R steam:steam /home/steam /tmp/xdg-steam; runuser -u steam -- env DISPLAY=:99 HOME=/home/steam XDG_RUNTIME_DIR=/tmp/xdg-steam LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/games/steam -tenfoot -no-cef-sandbox -cef-disable-gpu -cef-disable-gpu-compositing'" ], "prep-cmd": [ { "do": "", - "undo": "setsid steam steam://close/bigpicture" + "undo": "bash -lc 'pkill -u steam -f \"/usr/games/steam\" || true'" } ], "image-path": "steam.png" diff --git a/players/p4_config/apps.json b/players/p4_config/apps.json index bde2842..be0a57d 100644 --- a/players/p4_config/apps.json +++ b/players/p4_config/apps.json @@ -1,31 +1,21 @@ { "env": { - "PATH": "$(PATH):$(HOME)/.local/bin" + "PATH": "$(PATH):$(HOME)/.local/bin:/usr/games" }, "apps": [ { "name": "Desktop", "image-path": "desktop.png" }, - { - "name": "Low Res Desktop", - "image-path": "desktop.png", - "prep-cmd": [ - { - "do": "xrandr --output HDMI-1 --mode 1920x1080", - "undo": "xrandr --output HDMI-1 --mode 1920x1200" - } - ] - }, { "name": "Steam Big Picture", "detached": [ - "setsid steam steam://open/bigpicture" + "bash -lc 'id steam >/dev/null 2>&1 || useradd -m -s /bin/bash steam; mkdir -p /home/steam/.local/share/Steam /tmp/xdg-steam; chown -R steam:steam /home/steam /tmp/xdg-steam; runuser -u steam -- env DISPLAY=:99 HOME=/home/steam XDG_RUNTIME_DIR=/tmp/xdg-steam LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/games/steam -tenfoot -no-cef-sandbox -cef-disable-gpu -cef-disable-gpu-compositing'" ], "prep-cmd": [ { "do": "", - "undo": "setsid steam steam://close/bigpicture" + "undo": "bash -lc 'pkill -u steam -f \"/usr/games/steam\" || true'" } ], "image-path": "steam.png"