deploy.sh: always restart kiosk-dev; production is optional best-effort
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Deploy latest kiosk code to the production kiosk
|
# Deploy latest kiosk code.
|
||||||
|
# Always commits to Gitea and restarts kiosk-dev (dev/test machine).
|
||||||
|
# If the production kiosk is reachable, deploys there too.
|
||||||
# Usage: ./deploy.sh ["commit message"]
|
# Usage: ./deploy.sh ["commit message"]
|
||||||
set -e
|
|
||||||
|
|
||||||
KIOSK_LOCAL="jgitta@192.168.88.44"
|
KIOSK_LOCAL="jgitta@192.168.88.44"
|
||||||
KIOSK_REMOTE="jgitta@100.64.0.1"
|
KIOSK_REMOTE="jgitta@100.64.0.1"
|
||||||
@@ -13,23 +14,28 @@ git -C "$REPO_DIR" add -A
|
|||||||
git -C "$REPO_DIR" commit -m "$COMMIT_MSG" 2>/dev/null || echo " (nothing new to commit)"
|
git -C "$REPO_DIR" commit -m "$COMMIT_MSG" 2>/dev/null || echo " (nothing new to commit)"
|
||||||
git -C "$REPO_DIR" push origin master || echo " (nothing new to push)"
|
git -C "$REPO_DIR" push origin master || echo " (nothing new to push)"
|
||||||
|
|
||||||
echo "==> Deploying to production kiosk..."
|
echo "==> Restarting kiosk-dev..."
|
||||||
|
/usr/local/bin/kiosk-restart
|
||||||
|
|
||||||
|
echo "==> Trying production kiosk..."
|
||||||
KIOSK=""
|
KIOSK=""
|
||||||
if ssh -o ConnectTimeout=5 -o BatchMode=yes $KIOSK_LOCAL "echo ok" &>/dev/null; then
|
if ssh -o ConnectTimeout=5 -o BatchMode=yes $KIOSK_LOCAL "echo ok" &>/dev/null; then
|
||||||
KIOSK="$KIOSK_LOCAL"
|
KIOSK="$KIOSK_LOCAL"
|
||||||
echo " Reaching kiosk via local network"
|
echo " Reaching production via local network"
|
||||||
elif ssh -o ConnectTimeout=8 -o BatchMode=yes $KIOSK_REMOTE "echo ok" &>/dev/null; then
|
elif ssh -o ConnectTimeout=8 -o BatchMode=yes $KIOSK_REMOTE "echo ok" &>/dev/null; then
|
||||||
KIOSK="$KIOSK_REMOTE"
|
KIOSK="$KIOSK_REMOTE"
|
||||||
echo " Reaching kiosk via Tailscale"
|
echo " Reaching production via Tailscale"
|
||||||
else
|
else
|
||||||
echo "ERROR: Cannot reach kiosk on local or Tailscale"
|
echo " Production kiosk unreachable — skipping (will deploy when online)"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh "$KIOSK" "
|
if [ -n "$KIOSK" ]; then
|
||||||
|
ssh "$KIOSK" "
|
||||||
cd /home/jgitta/kiosk-browser
|
cd /home/jgitta/kiosk-browser
|
||||||
git pull
|
git pull
|
||||||
/usr/local/bin/kiosk-restart
|
/usr/local/bin/kiosk-restart
|
||||||
"
|
"
|
||||||
|
echo " Production updated."
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Deploy complete!"
|
echo "==> Deploy complete!"
|
||||||
|
|||||||
Reference in New Issue
Block a user