Add missing env variables

These are required for the internal docker containers
This commit is contained in:
Josh.5
2022-10-09 12:29:23 +13:00
committed by Josh Sunnex
parent 03beff3ff3
commit 72f2543b02
4 changed files with 15 additions and 7 deletions

View File

@@ -525,6 +525,9 @@ VOLUME /var/lib/docker
# Configure default user and set env
ENV \
PUID=99 \
PGID=100 \
UMASK=000 \
USER="default" \
USER_PASSWORD="password" \
USER_HOME="/home/default" \
@@ -555,8 +558,14 @@ ENV \
DISPLAY=":55" \
NVIDIA_DRIVER_CAPABILITIES="all" \
NVIDIA_VISIBLE_DEVICES="all" \
XORG_SOCKET_DIR="/tmp/.X11-unix" \
XDG_RUNTIME_DIR="/tmp/.X11-unix/run"
# Set pulseaudio environment variables
ENV \
PULSE_SOCKET_DIR="/tmp/pulse" \
PULSE_SERVER="unix:/tmp/pulse/pulse-socket"
# Set container configuration environment variables
ENV \
MODE="primary" \

View File

@@ -9,13 +9,12 @@ if [ "${MODE}" == "s" ] | [ "${MODE}" == "secondary" ]; then
sed -i 's|^; flat-volumes.*$|flat-volumes = yes|' /etc/pulse/daemon.conf
else
echo "Configure pulseaudio to pipe audio to a socket"
mkdir -p /tmp/pulse
chmod -R a+rw /tmp/pulse
mkdir -p ${PULSE_SOCKET_DIR}
chmod -R a+rw ${PULSE_SOCKET_DIR}
# Configure the palse audio socket
export PULSE_SERVER=${PULSE_SERVER:-unix:/tmp/pulse/pulse-socket}
sed -i "s|^; default-server.*$|default-server = ${PULSE_SERVER}|" /etc/pulse/client.conf
sed -i 's|^load-module module-native-protocol-unix.*$|load-module module-native-protocol-unix socket=/tmp/pulse/pulse-socket auth-anonymous=1|' \
sed -i 's|^load-module module-native-protocol-unix.*$|load-module module-native-protocol-unix socket=${PULSE_SOCKET_DIR}/pulse-socket auth-anonymous=1|' \
/etc/pulse/default.pa
# Disable pulseaudio from respawning (https://unix.stackexchange.com/questions/204522/how-does-pulseaudio-start)

View File

@@ -50,10 +50,10 @@ function configure_x_server {
rm -f /etc/X11/xorg.conf
# Ensure the X socket path exists
mkdir -p /tmp/.X11-unix
mkdir -p ${XORG_SOCKET_DIR}
# Clear out old lock files
display_file=/tmp/.X11-unix/X${DISPLAY#:}
display_file=${XORG_SOCKET_DIR}/X${DISPLAY#:}
if [ -S ${display_file} ]; then
echo "Removing ${display_file} before starting"
rm -f /tmp/.X${DISPLAY#:}-lock

View File

@@ -4,7 +4,7 @@ priority=30
autostart=false
autorestart=true
user=%(ENV_USER)s
command=tcpserver 127.0.0.1 %(ENV_PORT_AUDIO_STREAM)s gst-launch-1.0 -q pulsesrc server=/tmp/pulse/pulse-socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1
command=tcpserver 127.0.0.1 %(ENV_PORT_AUDIO_STREAM)s gst-launch-1.0 -q pulsesrc server=%(ENV_PULSE_SOCKET_DIR)s/pulse-socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1
stopsignal=INT
stdout_logfile=/home/%(ENV_USER)s/.cache/log/audiostream.log
stdout_logfile_maxbytes=10MB