Files
Void-Homelab/deploy/push-workers.sh
root 6cba2e82da fix(deploy): exclude venv/ from push-workers rsync
The prod venv at /opt/void-workers/venv was being deleted on every
push because rsync --delete saw no matching dir in the source (which
has .venv/, not venv/). Now both names are excluded.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 11:04:21 +10:00

36 lines
860 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Push Python void-workers source to CT 311 and restart the service.
# Run from /project/src/void-v2.
TARGET=${TARGET:-root@192.168.1.13}
REMOTE_DIR=${REMOTE_DIR:-/opt/void-workers}
rsync -avz --delete \
--exclude .venv \
--exclude venv \
--exclude __pycache__ \
--exclude '*.egg-info' \
--exclude tests \
--exclude .env \
--exclude .gitignore \
--exclude .pytest_cache \
workers/ "$TARGET:$REMOTE_DIR/"
ssh "$TARGET" "
# rsync runs as root → files land root-owned. Workers run as voidworkers.
chown -R voidworkers: $REMOTE_DIR
su voidworkers -c '
cd $REMOTE_DIR
if [ ! -d venv ]; then
python3 -m venv venv
fi
. venv/bin/activate
pip install --quiet --upgrade pip
pip install --quiet -e \".[all]\"
'
systemctl restart void-workers
"
echo "Workers deployed."