From 145d5600a6eb60b61302287188a40195afc4c3d7 Mon Sep 17 00:00:00 2001 From: "Josh.5" Date: Sun, 2 Oct 2022 11:48:55 +0000 Subject: [PATCH] Add docs for setting up Steam Headless on Intel GPU with docker-compose --- docs/compose-files/.env | 41 ++++++++++++++++ docs/compose-files/docker-compose.intel.yml | 38 +++++++++++++++ docs/docker-compose.md | 48 +++++++++++++++++++ docs/ubuntu-server.md | 20 ++++++++ docs/unraid.md | 4 ++ .../cont-init.d/60-configure_gpu_driver.sh | 30 ++++++------ 6 files changed, 167 insertions(+), 14 deletions(-) create mode 100644 docs/compose-files/.env create mode 100644 docs/compose-files/docker-compose.intel.yml create mode 100644 docs/docker-compose.md create mode 100644 docs/ubuntu-server.md diff --git a/docs/compose-files/.env b/docs/compose-files/.env new file mode 100644 index 0000000..7ed0e04 --- /dev/null +++ b/docs/compose-files/.env @@ -0,0 +1,41 @@ +# Docker config +## DOCKER_RUNTIME: +## Options: ['runc', 'nvidia'] +## Description: The name of an implementation of OCI Runtime Spec +## Available runtimes are listed when you run `docker info`. +## Your system may have other options available. As a simple rule, if you are +## using an NVIDIA GPU, set this to 'nvidia' for anything else, set this to 'runc'. +DOCKER_RUNTIME='runc' + +# Container mode config +## MODE: +## Options: ['primary', 'secondary'] +## Description: Steam Headless containers can run in a secondary mode that will only start +## a Steam process that will then use the X server of either the host or another +## Steam Headless container running in 'primary' mode. +MODE='primary' +## WEB_UI_MODE: +## Options: ['vnc', 'neko', 'none'] +## Description: Configures the WebUI to use for accessing the virtual desktop. +WEB_UI_MODE='vnc' +## ENABLE_VNC_AUDIO: +## Options: ['true', 'false'] +## Description: Enables audio over for the VNC Web UI if 'WEB_UI_MODE' is set to 'vnc'. +ENABLE_VNC_AUDIO='true' + +# Default user config +PUID='1000' +PGID='1000' +UMASK='000' +USER_PASSWORD='password' + +# System config +HOSTNAME='SteamHeadless' +TZ='Pacific/Auckland' +USER_LOCALES='en_US.UTF-8 UTF-8' +DISPLAY=':55' +SHM_SIZE='2G' + +# Nvidia specific config (not required for non Nvidia GPUs) +NVIDIA_DRIVER_CAPABILITIES='all' +NVIDIA_VISIBLE_DEVICES='all' diff --git a/docs/compose-files/docker-compose.intel.yml b/docs/compose-files/docker-compose.intel.yml new file mode 100644 index 0000000..d1128b7 --- /dev/null +++ b/docs/compose-files/docker-compose.intel.yml @@ -0,0 +1,38 @@ +--- +services: + steam-headless: + image: josh5/steam-headless:latest + restart: unless-stopped + runtime: ${DOCKER_RUNTIME} + ## NOTE: Requires privileged access to host to be able to access the required devices + privileged: true + shm_size: ${SHM_SIZE} + ipc: host # Could also be set to 'shareable' + ulimits: + nofile: + soft: 1024 + hard: 524288 + + # NETWORK: + ## NOTE: Steam headless always required the use of the host network + network_mode: host + hostname: ${HOSTNAME} + extra_hosts: + - "${HOSTNAME}:127.0.0.1" + + # ENVIRONMENT: + ## Read all config variables from the .env file + env_file: .env + + # VOLUMES: + volumes: + # The location of your home directory. + - /opt/container-data/steam-headless/home/:/home/default/:rw + # The location where all games should be installed. + - /mnt/Games/:/mnt/games/:rw + # Input devices used for mouse and joypad support inside the container. + - /dev/input/:/dev/input/:ro + # The Xorg socket. This will be shared with other containers so they can access the X server. + - /opt/container-data/steam-headless/.X11-unix/:/tmp/.X11-unix/:rw + # Pulse audio socket. This will be shared with other containers so they can access the audio sink. + - /opt/container-data/steam-headless/pulse/:/tmp/pulse/:rw diff --git a/docs/docker-compose.md b/docs/docker-compose.md new file mode 100644 index 0000000..e8c3216 --- /dev/null +++ b/docs/docker-compose.md @@ -0,0 +1,48 @@ +# Unraid + +Follow these instructions to configure a docker-compose.yml for your system. + +> __Note__ +> +> These instructions assume that you have docker and docker-compose installed for your system. +> Depending on how you have installed this, the commands to execute docker compose may vary. + + +## PREPARE DIRECTORY: + +> __Note__ +> +> These commands are ment to be run as your user. Do not run them as root. If you do you should manually fix the permissions and ownership after. + +Create a directory for your service: +``` +sudo mkdir -p /opt/container-services/steam-headless +sudo chown -R $(id -u):$(id -g) /opt/container-services/steam-headless +``` + +Create a directory for your service config data: +``` +sudo mkdir -p /opt/container-data/steam-headless/{home,.X11-unix,pulse} +sudo chown -R $(id -u):$(id -g) /opt/container-data/steam-headless +``` + +Create a Steam Headless docker-compose.yml file: +``` +touch /opt/container-services/steam-headless/docker-compose.yml +``` + +Select from the [COMPOSE FILES](#compose-files) list below the link that best describes your hardware. + +Copy the contents of this file to `/opt/container-services/steam-headless/docker-compose.yml` + + +## CONFIGURE ENV: + +Create a Steam Headless `/opt/container-services/steam-headless/.env` file with the contents found in this example [Env File](./compose-files/.env). + +Edit these variables as requied. + + +## COMPOSE FILES: + +- [Intel CPU only](../docker-compose.intel.yml) diff --git a/docs/ubuntu-server.md b/docs/ubuntu-server.md new file mode 100644 index 0000000..430d12f --- /dev/null +++ b/docs/ubuntu-server.md @@ -0,0 +1,20 @@ +# Unraid + +Follow these instructions to install Steam Headless on Ubuntu Server. + +> __Note__ +> +> This assumes that your Ubuntu Server has not be configured to run any desktop environment! + + +## INSTALL DOCKER: + +Install docker-ce to your Ubuntu server following the [official instrctions](https://docs.docker.com/engine/install/ubuntu/). + +Ensure you install the `docker-compose-plugin` mentioned within these instructions + + +## CONFIGURE DOCKER COMPOSE: + +Once you have installed docker, follow the [Compose Files](./docker-compose.md) section and select the right configuration file for your hardware. + diff --git a/docs/unraid.md b/docs/unraid.md index cd26fb8..63cc040 100644 --- a/docs/unraid.md +++ b/docs/unraid.md @@ -1,3 +1,7 @@ +# Unraid + +Follow these instructions to install Steam Headless on Unraid + ## CONTAINER TEMPLATE: 1. Navigate to "**APPS**" tab. diff --git a/overlay/etc/cont-init.d/60-configure_gpu_driver.sh b/overlay/etc/cont-init.d/60-configure_gpu_driver.sh index 631e9fd..b119044 100644 --- a/overlay/etc/cont-init.d/60-configure_gpu_driver.sh +++ b/overlay/etc/cont-init.d/60-configure_gpu_driver.sh @@ -82,13 +82,14 @@ function install_amd_gpu_driver { lib32-vulkan-radeon \ vulkan-icd-loader \ vulkan-radeon - elif command -v apt-get &> /dev/null; then - [[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && export APT_UPDATED=true - apt-get install -y \ - libvulkan1 \ - libvulkan1:i386 \ - mesa-vulkan-drivers \ - mesa-vulkan-drivers:i386 + # There is currently nothing to install inside the debian container. This already comes with the vulken drives that are required + # elif command -v apt-get &> /dev/null; then + # [[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && export APT_UPDATED=true + # apt-get install -y \ + # libvulkan1 \ + # libvulkan1:i386 \ + # mesa-vulkan-drivers \ + # mesa-vulkan-drivers:i386 fi } @@ -101,13 +102,14 @@ function install_intel_gpu_driver { lib32-vulkan-intel \ vulkan-icd-loader \ vulkan-intel - elif command -v apt-get &> /dev/null; then - [[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && export APT_UPDATED=true - apt-get install -y \ - libvulkan1 \ - libvulkan1:i386 \ - mesa-vulkan-drivers \ - mesa-vulkan-drivers:i386 + # There is currently nothing to install inside the debian container. This already comes with the vulken drives that are required + # elif command -v apt-get &> /dev/null; then + # [[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && export APT_UPDATED=true + # apt-get install -y \ + # libvulkan1 \ + # libvulkan1:i386 \ + # mesa-vulkan-drivers \ + # mesa-vulkan-drivers:i386 fi }