Update version to 0.5.40, enhance Dockerfile with additional tools, and improve run.sh for nginx process management

This commit is contained in:
techartdev
2026-02-11 10:06:28 +02:00
parent aa95d6289f
commit 1fc2c97509
4 changed files with 53 additions and 2 deletions
+22
View File
@@ -24,6 +24,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
vim \
nano \
fd-find \
ripgrep \
bat \
less \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
@@ -99,6 +103,24 @@ USER root
RUN npm config set fund false && npm config set audit false \
&& npm install -g openclaw@2026.2.9
# Shell aliases and color options for interactive use
RUN tee -a /etc/bash.bashrc <<'EOF'
# Aliases
alias bat="batcat"
alias fd="fdfind"
# Enable colors
alias ls="ls --color=auto"
alias grep="grep --color=auto"
alias egrep="grep -E --color=auto"
alias fgrep="grep -F --color=auto"
alias diff="diff --color=auto"
alias ip="ip --color=auto"
if [ -z "${LS_COLORS+x}" ]; then
export LS_COLORS="di=1;34:ln=1;36:so=1;pi=33:ex=1;32:bd=1;33:cd=1;33:su=1;31:sg=1;31:tw=1;34:ow=1;34"
fi
EOF
COPY run.sh /run.sh
COPY oc_config_helper.py /oc_config_helper.py
COPY nginx.conf.tpl /etc/nginx/nginx.conf.tpl
+1 -1
View File
@@ -1,5 +1,5 @@
name: OpenClaw Assistant
version: "0.5.39"
version: "0.5.40"
slug: openclaw_assistant
description: Run OpenClaw Assistant (OpenClaw-compatible) as a Home Assistant add-on.
url: https://github.com/techartdev/OpenClawHomeAssistant
+29
View File
@@ -281,6 +281,28 @@ fi
# Start ingress reverse proxy (nginx). This provides the add-on UI inside HA.
# Token is injected server-side; never put it in the browser URL.
NGINX_PID_FILE="/var/run/openclaw-nginx.pid"
# Clean up stale nginx process from previous run (e.g., after crash/unclean restart)
if [ -f "$NGINX_PID_FILE" ]; then
OLD_NGINX_PID=$(cat "$NGINX_PID_FILE" 2>/dev/null || echo "")
if [ -n "$OLD_NGINX_PID" ] && kill -0 "$OLD_NGINX_PID" 2>/dev/null; then
echo "Stopping previous nginx process (PID $OLD_NGINX_PID)..."
kill "$OLD_NGINX_PID" 2>/dev/null || true
sleep 1
kill -9 "$OLD_NGINX_PID" 2>/dev/null || true
fi
rm -f "$NGINX_PID_FILE"
fi
# Also kill any orphaned nginx workers that might hold port 8099
if command -v pkill >/dev/null 2>&1; then
pkill -f "nginx.*-c /etc/nginx/nginx.conf" 2>/dev/null || true
sleep 1
fi
# Verify port 8099 is actually free before proceeding
if command -v ss >/dev/null 2>&1 && ss -tlnp 2>/dev/null | grep -q ':8099 '; then
echo "WARN: Port 8099 still in use after cleanup; nginx may fail to start"
fi
# Render nginx config from template.
# The gateway token is NOT managed by the add-on; OpenClaw will generate/store it.
@@ -324,6 +346,13 @@ PY
echo "Starting ingress proxy (nginx) on :8099 ..."
nginx -g 'daemon off;' &
NGINX_PID=$!
sleep 1
if kill -0 "$NGINX_PID" 2>/dev/null; then
echo "$NGINX_PID" > "$NGINX_PID_FILE"
echo "nginx started with PID $NGINX_PID"
else
echo "WARN: nginx failed to start (PID $NGINX_PID exited); ingress UI may be unavailable"
fi
# Wait for gateway; if it exits, shut down others.
wait "${GW_PID}"