feat: PXE debug boot mode for rescue/diagnostics #4
74
bastion/scripts/deploy.sh
Normal file
74
bastion/scripts/deploy.sh
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Deploy bastion + labd to k3s cluster and install labctl locally.
|
||||||
|
# Usage: ./scripts/deploy.sh [bastion|labd|labctl|all]
|
||||||
|
#
|
||||||
|
# Builds container images with existing build scripts, pushes to Gitea
|
||||||
|
# registry, restarts k3s pods, and builds/installs labctl RPM.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||||
|
|
||||||
|
cd "$PROJECT_DIR"
|
||||||
|
|
||||||
|
# Load .env if present
|
||||||
|
if [ -f .env ]; then
|
||||||
|
set -a; source .env; set +a
|
||||||
|
fi
|
||||||
|
|
||||||
|
deploy_bastion() {
|
||||||
|
echo "=== Building & pushing bastion image ==="
|
||||||
|
bash scripts/build-bastion.sh --push latest
|
||||||
|
echo ""
|
||||||
|
echo "=== Restarting bastion pod ==="
|
||||||
|
kubectl rollout restart deployment/bastion -n lab-infra
|
||||||
|
kubectl rollout status deployment/bastion -n lab-infra --timeout=180s
|
||||||
|
echo "✓ Bastion deployed"
|
||||||
|
}
|
||||||
|
|
||||||
|
deploy_labd() {
|
||||||
|
echo "=== Building & pushing labd image ==="
|
||||||
|
bash scripts/build-labd.sh --push latest
|
||||||
|
echo ""
|
||||||
|
echo "=== Restarting labd pod ==="
|
||||||
|
kubectl rollout restart deployment/labd -n lab-system
|
||||||
|
kubectl rollout status deployment/labd -n lab-system --timeout=180s
|
||||||
|
echo "✓ Labd deployed"
|
||||||
|
}
|
||||||
|
|
||||||
|
deploy_labctl() {
|
||||||
|
echo "=== Building labctl RPM ==="
|
||||||
|
bash scripts/build-rpm.sh
|
||||||
|
echo ""
|
||||||
|
echo "=== Installing labctl ==="
|
||||||
|
RPM_FILE=$(ls dist/labctl-*.x86_64.rpm 2>/dev/null | head -1)
|
||||||
|
if [ -n "$RPM_FILE" ]; then
|
||||||
|
sudo rpm -U --force "$RPM_FILE"
|
||||||
|
echo "✓ labctl installed: $(labctl --version 2>/dev/null || echo 'installed')"
|
||||||
|
else
|
||||||
|
echo "WARNING: No RPM found, falling back to direct install"
|
||||||
|
pnpm build
|
||||||
|
sudo install -m 755 <(echo '#!/bin/bash'; echo "exec node $PROJECT_DIR/src/cli/dist/index.js \"\$@\"") /usr/local/bin/labctl
|
||||||
|
echo "✓ labctl installed (dev mode)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${1:-all}" in
|
||||||
|
bastion) deploy_bastion ;;
|
||||||
|
labd) deploy_labd ;;
|
||||||
|
labctl) deploy_labctl ;;
|
||||||
|
all)
|
||||||
|
deploy_bastion
|
||||||
|
echo ""
|
||||||
|
deploy_labd
|
||||||
|
echo ""
|
||||||
|
deploy_labctl
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 [bastion|labd|labctl|all]"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Deploy complete ==="
|
||||||
@@ -18,7 +18,7 @@ function parseSyslogLine(raw: string): { program: string; message: string } {
|
|||||||
// Try to extract program and message after the timestamp + hostname
|
// Try to extract program and message after the timestamp + hostname
|
||||||
// RFC 3164: "Mon DD HH:MM:SS HOSTNAME PROGRAM[PID]: MESSAGE"
|
// RFC 3164: "Mon DD HH:MM:SS HOSTNAME PROGRAM[PID]: MESSAGE"
|
||||||
const match = noPri.match(/^\w+\s+\d+\s+[\d:]+\s+\S+\s+(\S+?)(?:\[\d+\])?:\s*(.*)/);
|
const match = noPri.match(/^\w+\s+\d+\s+[\d:]+\s+\S+\s+(\S+?)(?:\[\d+\])?:\s*(.*)/);
|
||||||
if (match) {
|
if (match?.[1] && match[2] !== undefined) {
|
||||||
return { program: match[1], message: match[2] };
|
return { program: match[1], message: match[2] };
|
||||||
}
|
}
|
||||||
// Fallback: just return the whole line
|
// Fallback: just return the whole line
|
||||||
|
|||||||
Reference in New Issue
Block a user