Files
quasar-app/deploy.sh
2026-10-06 23:43:23 -07:00

39 lines
1.4 KiB
Bash

#!/bin/bash
# Deploy Supernova to CT767 (10.30.20.203)
set -e
export SSHPASS='Czapiewski1!'
SSH="/opt/homebrew/bin/sshpass -e ssh -o StrictHostKeyChecking=accept-new -o ConnectTimeout=20 root@10.30.20.85"
SCP="/opt/homebrew/bin/sshpass -e scp -O -o StrictHostKeyChecking=accept-new"
CT="pct exec 767 --"
cd /Users/drjones/quasar-app
echo "=== packaging app ==="
tar czf /tmp/supernova-app.tar.gz app.py panel_client.py templates static
echo "=== pushing to CT767 ==="
$SCP /tmp/supernova-app.tar.gz root@10.30.20.85:/tmp/supernova-app.tar.gz
$SCP .env supernova.service supernova.nginx root@10.30.20.85:/tmp/
echo "=== installing on CT ==="
$SSH "
$CT bash -c '
mkdir -p /opt/supernova
tar xzf /tmp/supernova-app.tar.gz -C /opt/supernova
cp /tmp/.env /opt/supernova/.env
cp /tmp/supernova.service /etc/systemd/system/supernova.service
cp /tmp/supernova.nginx /etc/nginx/sites-available/supernova
ln -sf /etc/nginx/sites-available/supernova /etc/nginx/sites-enabled/supernova
rm -f /etc/nginx/sites-enabled/default
systemctl daemon-reload
systemctl enable supernova
systemctl restart supernova
nginx -t && systemctl reload nginx
'
"
echo "=== verifying ==="
sleep 3
$SSH "$CT bash -c 'systemctl is-active supernova; curl -s -m 5 http://127.0.0.1:5000/ -o /dev/null -w \"app :5000 -> %{http_code}\n\"; curl -s -m 5 http://127.0.0.1:80/ -o /dev/null -w \"nginx :80 -> %{http_code}\n\"'"
echo "=== DONE ==="