Cookie file and other default parameters (#231)
* adding a more robust system around the cookie file and add other default values for parameters * removed duplicate PulseAudio running message
This commit is contained in:
1 parent
735731b63e
commit
043e8fb1ff
4 files changed
+31
-24
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ LVA_USER_GROUP="1000"
|
|||||||
# Pipewire Server: /run/user/1000/pulse/native
|
# Pipewire Server: /run/user/1000/pulse/native
|
||||||
LVA_PULSE_SERVER="/run/user/${LVA_USER_ID}/pulse/native"
|
LVA_PULSE_SERVER="/run/user/${LVA_USER_ID}/pulse/native"
|
||||||
LVA_XDG_RUNTIME_DIR="/run/user/${LVA_USER_ID}"
|
LVA_XDG_RUNTIME_DIR="/run/user/${LVA_USER_ID}"
|
||||||
LVA_PULSE_COOKIE="/app/configuration/tmp_pulse_cookie"
|
LVA_PULSE_COOKIE="/run/user/${LVA_USER_ID}/pulse/cookie"
|
||||||
|
|
||||||
### Path to the preferences file (optional):
|
### Path to the preferences file (optional):
|
||||||
# PREFERENCES_FILE="/app/configuration/preferences.json"
|
# PREFERENCES_FILE="/app/configuration/preferences.json"
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ services:
|
|||||||
fix-permissions:
|
fix-permissions:
|
||||||
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
||||||
entrypoint: []
|
entrypoint: []
|
||||||
command: "chown -R ${LVA_USER_ID}:${LVA_USER_GROUP} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom"
|
command: "chown -R ${LVA_USER_ID:-1000}:${LVA_USER_GROUP:-1000} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom"
|
||||||
environment:
|
environment:
|
||||||
# Pulseaudio
|
# Pulseaudio
|
||||||
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
|
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR:-/run/user/1000}
|
||||||
- PULSE_SERVER=${LVA_PULSE_SERVER}
|
- PULSE_SERVER=${LVA_PULSE_SERVER:-/run/user/1000/pulse/native}
|
||||||
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
|
- PULSE_COOKIE=${LVA_PULSE_COOKIE:-/run/user/1000/pulse/cookie}
|
||||||
env_file: ${ENV_FILE:-.env}
|
env_file: ${ENV_FILE:-.env}
|
||||||
group_add:
|
group_add:
|
||||||
- audio
|
- audio
|
||||||
@@ -27,12 +27,12 @@ services:
|
|||||||
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
user: "${LVA_USER_ID}:${LVA_USER_GROUP}"
|
user: "${LVA_USER_ID:-1000}:${LVA_USER_GROUP:-1000}"
|
||||||
environment:
|
environment:
|
||||||
# Pulseaudio
|
# Pulseaudio
|
||||||
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
|
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR:-/run/user/1000}
|
||||||
- PULSE_SERVER=${LVA_PULSE_SERVER}
|
- PULSE_SERVER=${LVA_PULSE_SERVER:-/run/user/1000/pulse/native}
|
||||||
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
|
- PULSE_COOKIE=${LVA_PULSE_COOKIE:-/run/user/1000/pulse/cookie}
|
||||||
env_file: .env
|
env_file: .env
|
||||||
group_add:
|
group_add:
|
||||||
- audio
|
- audio
|
||||||
@@ -50,7 +50,7 @@ services:
|
|||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
# Pulseaudio
|
# Pulseaudio
|
||||||
# /run/user/1000:/run/user/1000
|
# /run/user/1000:/run/user/1000
|
||||||
- ${LVA_XDG_RUNTIME_DIR}:${LVA_XDG_RUNTIME_DIR}
|
- ${LVA_XDG_RUNTIME_DIR:-/run/user/1000}:${LVA_XDG_RUNTIME_DIR:-/run/user/1000}
|
||||||
# Mount source code for development
|
# Mount source code for development
|
||||||
- ./linux_voice_assistant:/app/linux_voice_assistant
|
- ./linux_voice_assistant:/app/linux_voice_assistant
|
||||||
- ./docker-entrypoint.sh:/app/docker-entrypoint.sh
|
- ./docker-entrypoint.sh:/app/docker-entrypoint.sh
|
||||||
|
|||||||
+9
-9
@@ -4,12 +4,12 @@ services:
|
|||||||
fix-permissions:
|
fix-permissions:
|
||||||
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
||||||
entrypoint: []
|
entrypoint: []
|
||||||
command: "chown -R ${LVA_USER_ID}:${LVA_USER_GROUP} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom"
|
command: "chown -R ${LVA_USER_ID:-1000}:${LVA_USER_GROUP:-1000} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom"
|
||||||
environment:
|
environment:
|
||||||
# Pulseaudio
|
# Pulseaudio
|
||||||
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
|
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR:-/run/user/1000}
|
||||||
- PULSE_SERVER=${LVA_PULSE_SERVER}
|
- PULSE_SERVER=${LVA_PULSE_SERVER:-/run/user/1000/pulse/native}
|
||||||
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
|
- PULSE_COOKIE=${LVA_PULSE_COOKIE:-/run/user/1000/pulse/cookie}
|
||||||
env_file: ${ENV_FILE:-.env}
|
env_file: ${ENV_FILE:-.env}
|
||||||
group_add:
|
group_add:
|
||||||
- audio
|
- audio
|
||||||
@@ -27,12 +27,12 @@ services:
|
|||||||
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
user: "${LVA_USER_ID}:${LVA_USER_GROUP}"
|
user: "${LVA_USER_ID:-1000}:${LVA_USER_GROUP:-1000}"
|
||||||
environment:
|
environment:
|
||||||
# Pulseaudio
|
# Pulseaudio
|
||||||
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
|
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR:-/run/user/1000}
|
||||||
- PULSE_SERVER=${LVA_PULSE_SERVER}
|
- PULSE_SERVER=${LVA_PULSE_SERVER:-/run/user/1000/pulse/native}
|
||||||
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
|
- PULSE_COOKIE=${LVA_PULSE_COOKIE:-/run/user/1000/pulse/cookie}
|
||||||
env_file: ${ENV_FILE:-.env}
|
env_file: ${ENV_FILE:-.env}
|
||||||
group_add:
|
group_add:
|
||||||
- audio
|
- audio
|
||||||
@@ -50,7 +50,7 @@ services:
|
|||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
# Pulseaudio
|
# Pulseaudio
|
||||||
# /run/user/1000:/run/user/1000
|
# /run/user/1000:/run/user/1000
|
||||||
- ${LVA_XDG_RUNTIME_DIR}:${LVA_XDG_RUNTIME_DIR}
|
- ${LVA_XDG_RUNTIME_DIR:-/run/user/1000}:${LVA_XDG_RUNTIME_DIR:-/run/user/1000}
|
||||||
depends_on:
|
depends_on:
|
||||||
- fix-permissions
|
- fix-permissions
|
||||||
# Health check for process
|
# Health check for process
|
||||||
|
|||||||
+12
-5
@@ -82,10 +82,18 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Add cookie file for pulseaudio to prevent errors
|
# Add cookie file for pulseaudio to prevent errors
|
||||||
if [ ! -f "$PULSE_COOKIE" ]; then
|
PULSE_COOKIE=${PULSE_COOKIE:-"/run/user/1000/pulse/cookie"}
|
||||||
echo "Creating PulseAudio cookie file"
|
if [[ "$PULSE_COOKIE" != "DISABLED" ]]; then
|
||||||
touch "$PULSE_COOKIE"
|
if [ ! -f "$PULSE_COOKIE" ]; then
|
||||||
chmod 600 "$PULSE_COOKIE"
|
echo "PulseAudio cookie file not found at $PULSE_COOKIE"
|
||||||
|
PULSE_COOKIE="/app/configuration/tmp_pulse_cookie"
|
||||||
|
echo "changed PULSE_COOKIE to $PULSE_COOKIE"
|
||||||
|
if [ ! -f "$PULSE_COOKIE" ]; then
|
||||||
|
echo "Creating PulseAudio cookie file at $PULSE_COOKIE"
|
||||||
|
touch "$PULSE_COOKIE"
|
||||||
|
chmod 600 "$PULSE_COOKIE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +118,6 @@ for i in $(seq 1 $CP_MAX_RETRIES); do
|
|||||||
echo "⏳ PulseAudio not running yet, retrying in $CP_RETRY_DELAY s..."
|
echo "⏳ PulseAudio not running yet, retrying in $CP_RETRY_DELAY s..."
|
||||||
sleep $CP_RETRY_DELAY
|
sleep $CP_RETRY_DELAY
|
||||||
done
|
done
|
||||||
echo "✅ PulseAudio is running"
|
|
||||||
|
|
||||||
|
|
||||||
### Start application
|
### Start application
|
||||||
|
|||||||
Reference in new issue
Block a user