Files
tensors/scripts/deploy.sh
T
Adam Ladachowski 0ce7744324 💬 Commit message: Update 2026-02-15 17:50:28, 6 files, 110 lines
📁 Files changed: 6
📝 Lines changed: 110

  • deploy.md
  • Dockerfile
  • Dockerfile.rocm
  • README.md
  • deploy.sh
  • cli.py
2026-02-15 17:50:28 +01:00

50 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Deploy tensors to junkpile
# Usage: ./scripts/deploy.sh
set -e
REMOTE="chi@junkpile"
REMOTE_DIR="/opt/tensors/app"
LOCAL_DIR="$(cd "$(dirname "$0")/.." && pwd)"
echo "==> Syncing Python code to junkpile..."
rsync -av --delete \
--exclude='.git' \
--exclude='__pycache__' \
--exclude='.venv' \
--exclude='node_modules' \
--exclude='.ruff_cache' \
--exclude='.mypy_cache' \
--exclude='.pytest_cache' \
--exclude='*.egg-info' \
--rsync-path="sudo rsync" \
"$LOCAL_DIR/tensors/" "$REMOTE:$REMOTE_DIR/tensors/"
echo ""
echo "==> Fixing permissions..."
ssh "$REMOTE" "sudo chown -R tensors:tensors $REMOTE_DIR && sudo chmod -R g+w $REMOTE_DIR"
echo ""
echo "==> Restarting tensors service..."
ssh "$REMOTE" "sudo systemctl restart tensors"
echo ""
echo "==> Waiting for tensors to start..."
sleep 2
echo ""
echo "==> Verifying tensors service..."
SERVICE_STATUS=$(ssh "$REMOTE" "systemctl is-active tensors" 2>/dev/null)
if [ "$SERVICE_STATUS" = "active" ]; then
echo "✓ tensors service running"
else
echo "✗ tensors service not running"
ssh "$REMOTE" "journalctl -u tensors -n 10 --no-pager"
exit 1
fi
echo ""
echo "==> Deploy complete!"
echo " API: http://junkpile:51200"