Improvements toward working with a shared host X server
This commit is contained in:
49
Dockerfile
49
Dockerfile
@@ -14,7 +14,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install and configure locals ****" \
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
locales \
|
||||
procps \
|
||||
&& echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen \
|
||||
@@ -40,7 +40,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install certificates ****" \
|
||||
&& apt-get -y install --reinstall \
|
||||
&& apt-get install -y --reinstall \
|
||||
ca-certificates \
|
||||
&& \
|
||||
echo "**** Section cleanup ****" \
|
||||
@@ -59,7 +59,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install tools ****" \
|
||||
&& apt-get -y install \
|
||||
&& apt-get install -y \
|
||||
bash \
|
||||
bash-completion \
|
||||
gcc \
|
||||
@@ -68,9 +68,12 @@ RUN \
|
||||
less \
|
||||
make \
|
||||
nano \
|
||||
rsync \
|
||||
sudo \
|
||||
unzip \
|
||||
vim \
|
||||
wget \
|
||||
xz-utils \
|
||||
&& \
|
||||
echo "**** Section cleanup ****" \
|
||||
&& apt-get clean autoclean -y \
|
||||
@@ -87,8 +90,9 @@ RUN \
|
||||
echo "**** Update apt database ****" \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install desktop requirements ****" \
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
echo "**** Install X Server requirements ****" \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
avahi-utils \
|
||||
dbus-x11 \
|
||||
libxcomposite-dev \
|
||||
libxcursor1 \
|
||||
@@ -100,11 +104,14 @@ RUN \
|
||||
python3 \
|
||||
python3-numpy \
|
||||
python3-setuptools \
|
||||
rsync \
|
||||
x11vnc \
|
||||
xauth \
|
||||
xfonts-base \
|
||||
xorg \
|
||||
xserver-xorg-core \
|
||||
xserver-xorg-input-libinput \
|
||||
xserver-xorg-legacy \
|
||||
xserver-xorg-video-all \
|
||||
xvfb \
|
||||
&& \
|
||||
echo "**** Section cleanup ****" \
|
||||
@@ -123,7 +130,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install supervisor ****" \
|
||||
&& apt-get -y install \
|
||||
&& apt-get install -y \
|
||||
supervisor \
|
||||
&& \
|
||||
echo "**** Section cleanup ****" \
|
||||
@@ -142,7 +149,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install openssh server ****" \
|
||||
&& apt-get -y install \
|
||||
&& apt-get install -y \
|
||||
openssh-server \
|
||||
&& echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config \
|
||||
&& \
|
||||
@@ -217,7 +224,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install desktop environment ****" \
|
||||
&& apt-get -y install \
|
||||
&& apt-get install -y \
|
||||
xfce4 \
|
||||
xfce4-terminal \
|
||||
msttcorefonts \
|
||||
@@ -240,7 +247,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install firefox ****" \
|
||||
&& apt-get -y install \
|
||||
&& apt-get install -y \
|
||||
firefox-esr \
|
||||
&& \
|
||||
echo "**** Section cleanup ****" \
|
||||
@@ -260,15 +267,18 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& echo steam steam/question select "I AGREE" | debconf-set-selections \
|
||||
&& echo steam steam/license note '' | debconf-set-selections \
|
||||
&& apt-get -y install \
|
||||
steam \
|
||||
steam-devices \
|
||||
vulkan-tools \
|
||||
&& apt-get install -y \
|
||||
libgl1-mesa-dri \
|
||||
libgl1-mesa-dri:i386 \
|
||||
libgl1-mesa-glx \
|
||||
libglx-mesa0:i386 \
|
||||
mesa-utils \
|
||||
mesa-vulkan-drivers \
|
||||
libglx-mesa0:i386 \
|
||||
mesa-vulkan-drivers:i386 \
|
||||
libgl1-mesa-dri:i386 \
|
||||
vulkan-tools \
|
||||
&& apt-get install -y \
|
||||
steam \
|
||||
steam-devices \
|
||||
&& \
|
||||
echo "**** Section cleanup ****" \
|
||||
&& apt-get clean autoclean -y \
|
||||
@@ -286,7 +296,7 @@ RUN \
|
||||
&& apt-get update \
|
||||
&& \
|
||||
echo "**** Install audio streaming deps ****" \
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
bzip2 \
|
||||
gstreamer1.0-alsa \
|
||||
gstreamer1.0-gl \
|
||||
@@ -350,9 +360,10 @@ ENV \
|
||||
DISPLAY_SIZEH="900" \
|
||||
DISPLAY_SIZEW="1600" \
|
||||
DISPLAY_VIDEO_PORT="DFP" \
|
||||
DISPLAY=":0" \
|
||||
DISPLAY=":55" \
|
||||
NVIDIA_DRIVER_CAPABILITIES="all" \
|
||||
NVIDIA_VISIBLE_DEVICES="all"
|
||||
NVIDIA_VISIBLE_DEVICES="all" \
|
||||
MODE="primary"
|
||||
|
||||
# Be sure that the noVNC port is exposed
|
||||
EXPOSE 8083
|
||||
|
||||
13
README.md
13
README.md
@@ -8,6 +8,7 @@ Play your games in the browser with audio. Connect another device and use it wit
|
||||
- Root access
|
||||
- SSH server for remote terminal access
|
||||
|
||||
|
||||
---
|
||||
## Notes:
|
||||
|
||||
@@ -27,6 +28,18 @@ In this container, Steam is configured to automatically start. If you wish to ad
|
||||
### NETWORK MODE:
|
||||
If you want to use the container as a Steam Remote Play (previously "In Home Streaming") host device you should create a custom network and assign this container it's own IP, if you don't do this the traffic will be routed through the internet since Steam thinks you are on a different network.
|
||||
|
||||
### USING HOST X SERVER:
|
||||
If your host is already running X, you can just use that. To do this, be sure to configure:
|
||||
- DISPLAY=:0
|
||||
**(Variable)** - *Configures the sceen to use the primary display. Set this to whatever your host is using*
|
||||
- MODE=secondary
|
||||
**(Variable)** - *Configures the container to not start an X server of its own*
|
||||
- HOST_DBUS=true
|
||||
**(Variable)** - *Optional - Configures the container to use the host dbus process*
|
||||
- /run/dbus:/run/dbus:ro
|
||||
**(Mount)** - *Optional - Configures the container to use the host dbus process*
|
||||
|
||||
|
||||
---
|
||||
## Running:
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# File Created: Saturday, 8th January 2022 2:34:23 pm
|
||||
# Author: Josh.5 (jsunnex@gmail.com)
|
||||
# -----
|
||||
# Last Modified: Monday, 10th January 2022 11:04:51 pm
|
||||
# Last Modified: Tuesday, 11th January 2022 9:43:50 pm
|
||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||
###
|
||||
|
||||
@@ -13,37 +13,100 @@ script_path=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
|
||||
project_base_path=$(realpath ${script_path}/..);
|
||||
|
||||
|
||||
if [[ ${1} == "stop" ]]; then
|
||||
docker stop steam-headless
|
||||
docker rm steam-headless
|
||||
# Parse params
|
||||
additional_docker_params=""
|
||||
container_name="steam"
|
||||
for ARG in ${@}; do
|
||||
case ${ARG} in
|
||||
*primary)
|
||||
primary="true";
|
||||
;;
|
||||
*nvidia)
|
||||
nvidia="true";
|
||||
;;
|
||||
*hostx)
|
||||
hostx="true";
|
||||
;;
|
||||
*fb)
|
||||
framebuffer="true";
|
||||
;;
|
||||
stop)
|
||||
script_mode="stop"
|
||||
;;
|
||||
tail)
|
||||
script_mode="tail"
|
||||
;;
|
||||
user)
|
||||
script_mode="user"
|
||||
;;
|
||||
root)
|
||||
script_mode="root"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [[ "${primary}" == "true" ]]; then
|
||||
container_name="${container_name}-p"
|
||||
additional_docker_params="${additional_docker_params} -e MODE='primary'"
|
||||
hostx="false"
|
||||
else
|
||||
container_name="${container_name}-s"
|
||||
additional_docker_params="${additional_docker_params} -e MODE='secondary'"
|
||||
framebuffer="false"
|
||||
fi
|
||||
if [[ "${hostx}" == "true" ]]; then
|
||||
container_name="${container_name}-hx"
|
||||
additional_docker_params="${additional_docker_params} -v /tmp/.X11-unix:/tmp/.X11-unix"
|
||||
additional_docker_params="${additional_docker_params} -e MODE='secondary'"
|
||||
nvidia="false"
|
||||
framebuffer="false"
|
||||
else
|
||||
additional_docker_params="${additional_docker_params} -v /tmp/headless/.X11-unix:/tmp/.X11-unix"
|
||||
fi
|
||||
if [[ "${nvidia}" == "true" ]]; then
|
||||
container_name="${container_name}-hw"
|
||||
additional_docker_params="${additional_docker_params} --runtime=nvidia"
|
||||
framebuffer="false"
|
||||
fi
|
||||
if [[ "${framebuffer}" == "true" ]]; then
|
||||
# TODO: Enable xvfb
|
||||
container_name="${container_name}-fb"
|
||||
fi
|
||||
|
||||
|
||||
# If a mode was given, run that instead
|
||||
if [[ "${script_mode}" == "stop" ]]; then
|
||||
docker stop ${container_name}
|
||||
docker rm ${container_name}
|
||||
exit $?
|
||||
elif [[ ${1} == "tail" ]]; then
|
||||
docker logs -f steam-headless
|
||||
elif [[ "${script_mode}" == "tail" ]]; then
|
||||
docker logs -f ${container_name}
|
||||
exit $?
|
||||
elif [[ ${1} == "user" ]]; then
|
||||
docker exec -ti --user default steam-headless bash
|
||||
elif [[ "${script_mode}" == "user" ]]; then
|
||||
docker exec -ti --user default ${container_name} bash
|
||||
exit $?
|
||||
elif [[ ${1} == "root" ]]; then
|
||||
docker exec -ti --user 0 steam-headless bash
|
||||
elif [[ "${script_mode}" == "root" ]]; then
|
||||
docker exec -ti --user 0 ${container_name} bash
|
||||
exit $?
|
||||
fi
|
||||
|
||||
|
||||
docker stop steam-headless
|
||||
docker rm steam-headless
|
||||
# Stop previous instance
|
||||
docker stop ${container_name}
|
||||
docker rm ${container_name}
|
||||
sleep 1
|
||||
|
||||
|
||||
docker run -d --name='steam-headless' \
|
||||
--privileged=true \
|
||||
--net='br0' --ip='192.168.1.208' \
|
||||
--cpuset-cpus='3,9,4,10,5,11' \
|
||||
# Run
|
||||
docker run -d --name="${container_name}" \
|
||||
--privileged=true \
|
||||
--ipc="host" \
|
||||
-e PUID="99" \
|
||||
-e PGID="100" \
|
||||
-e UMASK='000' \
|
||||
-e UMASK="000" \
|
||||
-e USER_PASSWORD="password" \
|
||||
-e USER="default" \
|
||||
-e HOME="/home/test" \
|
||||
-e USER_HOME="/home/default" \
|
||||
-e TZ="Pacific/Auckland" \
|
||||
-e USER_LOCALES="en_US.UTF-8 UTF-8" \
|
||||
@@ -53,14 +116,17 @@ docker run -d --name='steam-headless' \
|
||||
-e DISPLAY_SIZEH="720" \
|
||||
-e DISPLAY_SIZEW="1280" \
|
||||
-e DISPLAY_VIDEO_PORT="DFP" \
|
||||
-e DISPLAY=":0" \
|
||||
-e DISPLAY=":55" \
|
||||
-e NVIDIA_DRIVER_CAPABILITIES="all" \
|
||||
-e NVIDIA_VISIBLE_DEVICES="all" \
|
||||
-v "${project_base_path}/config/home/default":'/home/default':'rw' \
|
||||
--hostname='steam-headless' \
|
||||
-p 8083:8083 \
|
||||
-p 32123:32123 \
|
||||
-v "${project_base_path}/config/home/default-${container_name}":"/home/default":"rw" \
|
||||
-v "/tmp/":"/tmp/":"rw" \
|
||||
--hostname="${container_name}" \
|
||||
--shm-size=2G \
|
||||
--runtime=nvidia \
|
||||
josh5/steam-headless:latest
|
||||
${additional_docker_params} \
|
||||
josh5/steam-headless:develop
|
||||
|
||||
|
||||
docker logs -f steam-headless
|
||||
docker logs -f ${container_name}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# File Created: Saturday, 8th January 2022 7:08:46 pm
|
||||
# Author: Josh.5 (jsunnex@gmail.com)
|
||||
# -----
|
||||
# Last Modified: Tuesday, 11th January 2022 1:02:16 am
|
||||
# Last Modified: Tuesday, 11th January 2022 8:44:17 pm
|
||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||
###
|
||||
|
||||
@@ -44,4 +44,6 @@ for user_init_script in ${USER_HOME}/init.d/*.sh ; do
|
||||
done
|
||||
|
||||
echo "**** Starting supervisord ****";
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf --nodaemon
|
||||
mkdir -p /var/log/supervisor
|
||||
chmod a+rw /var/log/supervisor
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf --nodaemon --user root
|
||||
|
||||
32
overlay/etc/supervisor/conf.d/audio.conf
Normal file
32
overlay/etc/supervisor/conf.d/audio.conf
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
[program:pulseaudio]
|
||||
autostart=true
|
||||
priority=10
|
||||
directory=/
|
||||
command=/usr/bin/pulseaudio -vvvv --disallow-module-loading --disallow-exit --exit-idle-time=-1
|
||||
user=%(ENV_USER)s
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/pulseaudio.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/pulseaudio.err
|
||||
|
||||
[program:audiostream]
|
||||
autostart=true
|
||||
priority=10
|
||||
command=tcpserver localhost 5901 gst-launch-1.0 -q pulsesrc server=/tmp/pulseaudio.socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1
|
||||
user=%(ENV_USER)s
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/audiostream.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/audiostream.err
|
||||
|
||||
[program:audiowebsock]
|
||||
autostart=true
|
||||
priority=10
|
||||
command=/usr/local/bin/websockify 32123 localhost:5901
|
||||
user=%(ENV_USER)s
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/audiowebsock.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/audiowebsock.err
|
||||
10
overlay/etc/supervisor/conf.d/dbus.conf
Normal file
10
overlay/etc/supervisor/conf.d/dbus.conf
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
[program:dbus]
|
||||
autostart=true
|
||||
priority=10
|
||||
directory=/
|
||||
command=dbus-daemon --config-file=/usr/share/dbus-1/system.conf --nofork --nopidfile
|
||||
user=%(ENV_USER)s
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
@@ -1,130 +0,0 @@
|
||||
[supervisord]
|
||||
user=root
|
||||
nodaemon=true
|
||||
|
||||
[program:ssh]
|
||||
autostart=true
|
||||
priority=10
|
||||
directory=/
|
||||
command=/usr/sbin/sshd -D
|
||||
user=root
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
|
||||
[program:dbus]
|
||||
autostart=true
|
||||
priority=10
|
||||
directory=/
|
||||
command=dbus-daemon --config-file=/usr/share/dbus-1/system.conf --nofork --nopidfile
|
||||
user=%(ENV_USER)s
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
|
||||
[program:pulseaudio]
|
||||
autostart=true
|
||||
priority=10
|
||||
directory=/
|
||||
command=/usr/bin/pulseaudio -vvvv --disallow-module-loading --disallow-exit --exit-idle-time=-1
|
||||
user=%(ENV_USER)s
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/pulseaudio.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/pulseaudio.err
|
||||
|
||||
[program:audiostream]
|
||||
autostart=true
|
||||
priority=10
|
||||
command=tcpserver localhost 5901 gst-launch-1.0 -q pulsesrc server=/tmp/pulseaudio.socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/audiostream.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/audiostream.err
|
||||
|
||||
[program:audiowebsock]
|
||||
autostart=true
|
||||
priority=10
|
||||
command=/usr/local/bin/websockify 32123 localhost:5901
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/audiowebsock.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/audiowebsock.err
|
||||
|
||||
[program:xorg]
|
||||
autostart=true
|
||||
priority=20
|
||||
directory=/
|
||||
command=/usr/bin/Xorg vt7 -novtswitch -sharevts -dpi "%(ENV_DISPLAY_DPI)s" +extension "MIT-SHM" %(ENV_DISPLAY)s
|
||||
#command=/usr/bin/Xorg -novtswitch -sharevts -dpi "%(ENV_DISPLAY_DPI)s" +extension "MIT-SHM" "%(ENV_DISPLAY)s"
|
||||
user=%(ENV_USER)s
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s",XDG_RUNTIME_DIR="/tmp/xdg",RUNLEVEL="3"
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/xorg.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/xorg.err
|
||||
|
||||
# Dont use xvfb as it does not work with nvidia X11 configuration
|
||||
# [program:xvfb]
|
||||
# autostart=false
|
||||
# priority=20
|
||||
# directory=/
|
||||
# command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen 0 1920x1080x24
|
||||
# user=%(ENV_USER)s
|
||||
# environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||
# autorestart=true
|
||||
# stopsignal=QUIT
|
||||
# stdout_logfile=/home/%(ENV_USER)s/.cache/log/xvfb.log
|
||||
# stderr_logfile=/home/%(ENV_USER)s/.cache/log/xvfb.err
|
||||
|
||||
[program:x11vnc]
|
||||
autostart=true
|
||||
priority=30
|
||||
directory=/
|
||||
#command=/usr/bin/x11vnc -display %(ENV_DISPLAY)s -xkb
|
||||
command=/usr/bin/x11vnc -display %(ENV_DISPLAY)s -rfbport 5900 -shared -forever
|
||||
user=%(ENV_USER)s
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/x11vnc.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/x11vnc.err
|
||||
|
||||
[program:de]
|
||||
autostart=true
|
||||
priority=50
|
||||
directory=/home/%(ENV_USER)s
|
||||
command=/usr/bin/startxfce4
|
||||
#command=/usr/bin/mate-session
|
||||
#command=/usr/bin/startlxqt
|
||||
#command=/usr/bin/dbus-launch startxfce4
|
||||
#command=/usr/bin/dbus-launch xfce4-session
|
||||
#command=/usr/bin/dbus-launch startplasma-x11
|
||||
user=%(ENV_USER)s
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/de.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/de.err
|
||||
|
||||
## Experimental launch directly to steam big picture... (this is cool, but not ideal for headless)
|
||||
# [program:steam]
|
||||
# autostart=true
|
||||
# priority=50
|
||||
# directory=/home/%(ENV_USER)s
|
||||
# command=/usr/bin/steam -bigpicture
|
||||
# user=%(ENV_USER)s
|
||||
# autorestart=true
|
||||
# stopsignal=QUIT
|
||||
# environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
|
||||
# stdout_logfile=/home/%(ENV_USER)s/.cache/log/steam.log
|
||||
# stderr_logfile=/home/%(ENV_USER)s/.cache/log/steam.err
|
||||
|
||||
[program:novnc]
|
||||
autostart=true
|
||||
priority=100
|
||||
command=/opt/noVNC/utils/launch.sh --vnc localhost:5900 --listen 8083
|
||||
#command=/usr/share/novnc/utils/launch.sh --vnc localhost:5900 --listen 8083
|
||||
#command=/usr/local/bin/websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/novnc.pem 8083 localhost:5900
|
||||
user=%(ENV_USER)s
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||
autorestart=true
|
||||
9
overlay/etc/supervisor/conf.d/sshd.conf
Normal file
9
overlay/etc/supervisor/conf.d/sshd.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
[program:ssh]
|
||||
autostart=true
|
||||
priority=10
|
||||
directory=/
|
||||
command=/usr/sbin/sshd -D
|
||||
user=root
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
13
overlay/etc/supervisor/conf.d/steam.conf
Normal file
13
overlay/etc/supervisor/conf.d/steam.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
# Optionally launch directly to steam big picture (disabled by default)
|
||||
[program:steam]
|
||||
autostart=false
|
||||
priority=50
|
||||
directory=/home/%(ENV_USER)s
|
||||
command=/usr/game/steam -bigpicture
|
||||
user=%(ENV_USER)s
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/steam.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/steam.err
|
||||
19
overlay/etc/supervisor/conf.d/vnc.conf
Normal file
19
overlay/etc/supervisor/conf.d/vnc.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
[program:x11vnc]
|
||||
autostart=true
|
||||
priority=30
|
||||
directory=/
|
||||
command=/usr/bin/x11vnc -display %(ENV_DISPLAY)s -rfbport 5900 -shared -forever
|
||||
user=%(ENV_USER)s
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/x11vnc.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/x11vnc.err
|
||||
|
||||
[program:novnc]
|
||||
autostart=true
|
||||
priority=30
|
||||
command=/opt/noVNC/utils/launch.sh --vnc localhost:5900 --listen 8083
|
||||
user=%(ENV_USER)s
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||
autorestart=true
|
||||
12
overlay/etc/supervisor/conf.d/xfce4.conf
Normal file
12
overlay/etc/supervisor/conf.d/xfce4.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
[program:xfce4]
|
||||
autostart=true
|
||||
priority=50
|
||||
directory=/home/%(ENV_USER)s
|
||||
command=/usr/bin/startxfce4
|
||||
user=%(ENV_USER)s
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
|
||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/de.log
|
||||
stderr_logfile=/home/%(ENV_USER)s/.cache/log/de.err
|
||||
12
overlay/etc/supervisor/conf.d/xorg.conf
Normal file
12
overlay/etc/supervisor/conf.d/xorg.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
[program:xorg]
|
||||
autostart=false
|
||||
priority=20
|
||||
directory=/
|
||||
command=/usr/bin/start-xorg.sh
|
||||
user=root
|
||||
environment=DISPLAY="%(ENV_DISPLAY)s",DISPLAY_DPI="%(ENV_DISPLAY_DPI)s",XDG_RUNTIME_DIR="/tmp/.X11-unix"
|
||||
autorestart=true
|
||||
stopsignal=QUIT
|
||||
stdout_logfile=/var/log/supervisor/xorg.log
|
||||
stderr_logfile=/var/log/supervisor/xorg.err
|
||||
26
overlay/scripts/30-configure_dbus.sh
Normal file
26
overlay/scripts/30-configure_dbus.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
# Configure dbus
|
||||
echo "**** Configure container dbus ****";
|
||||
if [[ "${HOST_DBUS}" == "true" ]]; then
|
||||
echo "Container configured to use the host dbus";
|
||||
# Disable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/dbus.conf
|
||||
else
|
||||
echo "Container configured to run its own dbus";
|
||||
# Enable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor/conf.d/dbus.conf
|
||||
# Configure dbus to run as USER
|
||||
sed -i "/ <user>/c\ <user>${USER}</user>" /usr/share/dbus-1/system.conf
|
||||
# Remove old dbus session
|
||||
rm -rf ${USER_HOME}/.dbus/session-bus/* 2> /dev/null
|
||||
# Remove old dbus pids
|
||||
mkdir -p /var/run/dbus
|
||||
chown -R ${PUID}:${PGID} /var/run/dbus/
|
||||
chmod -R 770 /var/run/dbus/
|
||||
# Generate a dbus machine ID
|
||||
dbus-uuidgen > /var/lib/dbus/machine-id
|
||||
# Remove old lockfiles
|
||||
find /var/run/dbus -name "pid" -exec rm -f {} \;
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
@@ -1,32 +0,0 @@
|
||||
# Configure system paths
|
||||
echo "**** Configure system paths ****";
|
||||
sed -i "/ <user>/c\ <user>${USER}</user>" /usr/share/dbus-1/system.conf
|
||||
if [ ! -d /tmp/xdg ]; then
|
||||
mkdir -p /tmp/xdg
|
||||
fi
|
||||
|
||||
echo "Configure dbus";
|
||||
# Remove old dbus session
|
||||
rm -rf ${USER_HOME}/.dbus/session-bus/* 2> /dev/null
|
||||
# Remove old dbus pids
|
||||
mkdir -p /var/run/dbus
|
||||
chown -R ${PUID}:${PGID} /var/run/dbus/
|
||||
chmod -R 770 /var/run/dbus/
|
||||
# Generate a dbus machine ID
|
||||
dbus-uuidgen > /var/lib/dbus/machine-id
|
||||
|
||||
echo "Configure X Windows context"
|
||||
chown -R ${PUID}:${PGID} /tmp/xdg
|
||||
chmod -R 0700 /tmp/xdg
|
||||
|
||||
echo "Configure X Windows session"
|
||||
rm -rfv /tmp/.ICE-unix*
|
||||
mkdir -p /tmp/.ICE-unix
|
||||
chown root:root /tmp/.ICE-unix/
|
||||
chmod 1777 /tmp/.ICE-unix/
|
||||
|
||||
echo "Remove old lockfiles"
|
||||
find /var/run/dbus -name "pid" -exec rm -f {} \;
|
||||
find /tmp -name ".X99*" -exec rm -f {} \;
|
||||
|
||||
echo "DONE"
|
||||
@@ -19,7 +19,7 @@ function download_driver {
|
||||
mkdir -p ${USER_HOME}/.cache/nvidia
|
||||
|
||||
if [[ ! -f "${USER_HOME}/.cache/nvidia/NVIDIA_${nvidia_host_driver_version}.run" ]]; then
|
||||
echo "Downloading driver"
|
||||
echo "Downloading driver v${nvidia_host_driver_version}"
|
||||
wget -q --show-progress --progress=bar:force:noscroll \
|
||||
-O /tmp/NVIDIA.run \
|
||||
http://download.nvidia.com/XFree86/Linux-x86_64/${nvidia_host_driver_version}/NVIDIA-Linux-x86_64-${nvidia_host_driver_version}.run
|
||||
@@ -32,12 +32,12 @@ function download_driver {
|
||||
function install_driver {
|
||||
# Check here if the currently installed version matches using nvidia-settings
|
||||
nvidia_settings_version=$(nvidia-settings --version 2> /dev/null | grep version | cut -d ' ' -f 4)
|
||||
[[ "${nvidia_settings_version}x" == "${nvidia_host_driver_version}x" ]] && return 0
|
||||
[[ "${nvidia_settings_version}x" == "${nvidia_host_driver_version}x" ]] && return 0;
|
||||
|
||||
# Download the driver (if it does not yet exist locally)
|
||||
download_driver
|
||||
|
||||
echo "Installing driver"
|
||||
echo "Installing driver v${nvidia_host_driver_version} to match what is running on the host"
|
||||
chmod +x ${USER_HOME}/.cache/nvidia/NVIDIA_${nvidia_host_driver_version}.run
|
||||
${USER_HOME}/.cache/nvidia/NVIDIA_${nvidia_host_driver_version}.run \
|
||||
--silent \
|
||||
|
||||
@@ -25,13 +25,6 @@ fi
|
||||
|
||||
# Configure a NVIDIA X11 config
|
||||
function configure_nvidia_x_server {
|
||||
# Configure x to be run by anyone
|
||||
if grep -Fxq "allowed_users=console" /etc/X11/Xwrapper.config; then
|
||||
echo "Configure Xwrapper.config"
|
||||
sed -i "s/allowed_users=console/allowed_users=anybody/" /etc/X11/Xwrapper.config
|
||||
fi
|
||||
|
||||
# Configure xorg for NVIDIA
|
||||
echo "Configuring X11 with GPU ID: '${gpu_select}'"
|
||||
nvidia_gpu_hex_id=$(nvidia-smi --format=csv --query-gpu=pci.bus_id --id="${gpu_select}" 2> /dev/null | sed -n 2p)
|
||||
IFS=":." ARR_ID=(${nvidia_gpu_hex_id})
|
||||
@@ -45,12 +38,44 @@ function configure_nvidia_x_server {
|
||||
sed -i '/Section\s\+"Monitor"/a\ '"${MODELINE}" /etc/X11/xorg.conf
|
||||
}
|
||||
|
||||
# Allow anybody for running x server
|
||||
function configure_x_server {
|
||||
# Configure x to be run by anyone
|
||||
if grep -Fxq "allowed_users=console" /etc/X11/Xwrapper.config; then
|
||||
echo "Configure Xwrapper.config"
|
||||
sed -i "s/allowed_users=console/allowed_users=anybody/" /etc/X11/Xwrapper.config
|
||||
fi
|
||||
|
||||
# Ensure the X socket path exists
|
||||
if [ ! -d /tmp/.X11-unix ]; then
|
||||
mkdir -p /tmp/.X11-unix
|
||||
fi
|
||||
|
||||
# Check if this container is being run as a secondary instance
|
||||
if [ "${MODE}" == "p" ] | [ "${MODE}" == "primary" ]; then
|
||||
echo "Configure container as primary the X server"
|
||||
# Enable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor/conf.d/xorg.conf
|
||||
elif [ "${MODE}" == "fb" ] | [ "${MODE}" == "framebuffer" ]; then
|
||||
echo "Configure container to use a virtual framebuffer as the X server"
|
||||
# Disable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/xorg.conf
|
||||
else
|
||||
echo "Configure container as secondary and do not run an X server"
|
||||
# Disable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/xorg.conf
|
||||
fi
|
||||
# Make startup script executable
|
||||
chmod +x /usr/bin/start-xorg.sh
|
||||
}
|
||||
|
||||
|
||||
if [[ -z ${nvidia_gpu_hex_id} ]]; then
|
||||
echo "**** Generate default xorg.conf ****";
|
||||
# TODO: Configure xorg.conf with no NVIDIA GPU
|
||||
configure_x_server
|
||||
else
|
||||
echo "**** Generate NVIDIA xorg.conf ****";
|
||||
configure_x_server
|
||||
configure_nvidia_x_server
|
||||
fi
|
||||
|
||||
|
||||
30
overlay/usr/bin/start-xorg.sh
Normal file
30
overlay/usr/bin/start-xorg.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
###
|
||||
# File: start-xorg.sh
|
||||
# Project: bin
|
||||
# File Created: Tuesday, 11th January 2022 8:28:52 pm
|
||||
# Author: Josh.5 (jsunnex@gmail.com)
|
||||
# -----
|
||||
# Last Modified: Tuesday, 11th January 2022 9:38:51 pm
|
||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||
###
|
||||
|
||||
DISPLAY=${DISPLAY:-:55}
|
||||
DISPLAY_DPI=${DPI:-:96}
|
||||
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/.X11-unix}
|
||||
|
||||
|
||||
# Clear out old lock files
|
||||
display_file=/tmp/.X11-unix/X${DISPLAY#:}
|
||||
if [ -S ${display_file} ]; then
|
||||
LOG "Removing ${display_file} before starting"
|
||||
rm -f /tmp/.X${DISPLAY#:}-lock
|
||||
rm ${display_file}
|
||||
fi
|
||||
|
||||
|
||||
/usr/bin/Xorg -ac -noreset -novtswitch -sharevts -dpi "${DISPLAY_DPI}" +extension "GLX" +extension "RANDR" +extension "RENDER" vt7 "${DISPLAY}"
|
||||
# /usr/bin/Xorg -ac -noreset -novtswitch -sharevts -dpi "${DISPLAY_DPI}" +extension "GLX" +extension "RANDR" +extension "RENDER" +extension "MIT-SHM" vt7 "${DISPLAY}"
|
||||
# /usr/bin/Xorg -novtswitch -sharevts -dpi "${DISPLAY_DPI}" +extension "MIT-SHM" vt7 ${DISPLAY}
|
||||
# /usr/bin/Xorg -novtswitch -sharevts -dpi "${DISPLAY_DPI}" +extension "MIT-SHM" "${DISPLAY}"
|
||||
# /usr/bin/Xorg -ac -noreset +extension GLX +extension RANDR +extension RENDER vt7 "${DISPLAY}"
|
||||
Reference in New Issue
Block a user