Skip to content

Commit 68af0f5

Browse files
authored
homelable: preserve MCP server config across updates (#14996)
* homelable: preserve MCP server config across updates The update path runs CLEAN_INSTALL=1 fetch_and_deploy_gh_release, which wipes /opt/homelable before redeploying. The backup/restore only covers backend/.env and data/, so an optionally-installed MCP server (set up via Pouzor/homelable's own scripts/lxc-mcp-install.sh, which targets exactly this LXC and lives in /opt/homelable/mcp) loses its .env and .venv on every update. The homelable-mcp service then keeps running on deleted inodes and dies at the next restart. Back up mcp/.env when present, and after the deploy restore it, rebuild the venv (same uv pattern as the backend), restore ownership and restart the service. Fully conditional: installs without the MCP are unaffected. * homelable: remove comments per maintainer review
1 parent 0a21262 commit 68af0f5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

ct/homelable.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ function update_script() {
3838
msg_info "Backing up Configuration and Data"
3939
cp /opt/homelable/backend/.env /opt/homelable.env.bak
4040
cp -r /opt/homelable/data /opt/homelable_data_bak
41+
if [[ -f /opt/homelable/mcp/.env ]]; then
42+
cp -a /opt/homelable/mcp/.env /opt/homelable-mcp.env.bak
43+
fi
4144
msg_ok "Backed up Configuration and Data"
4245

4346
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "homelable" "Pouzor/homelable" "tarball" "latest" "/opt/homelable"
@@ -61,6 +64,19 @@ function update_script() {
6164
rm -rf /opt/homelable_data_bak
6265
msg_ok "Restored Configuration and Data"
6366

67+
if [[ -f /opt/homelable-mcp.env.bak ]]; then
68+
msg_info "Restoring MCP Server"
69+
cp -a /opt/homelable-mcp.env.bak /opt/homelable/mcp/.env
70+
rm -f /opt/homelable-mcp.env.bak
71+
MCP_OWNER=$(stat -c '%U' /opt/homelable/mcp/.env)
72+
cd /opt/homelable/mcp
73+
$STD uv venv --clear /opt/homelable/mcp/.venv
74+
$STD uv pip install --python /opt/homelable/mcp/.venv/bin/python -r requirements.txt
75+
chown -R "$MCP_OWNER":"$MCP_OWNER" /opt/homelable/mcp
76+
systemctl restart homelable-mcp
77+
msg_ok "Restored MCP Server"
78+
fi
79+
6480
msg_info "Starting Service"
6581
systemctl start homelable
6682
msg_ok "Started Service"

0 commit comments

Comments
 (0)