gigafibre-fsm/apps/ops/deploy.sh
louispaulb 7d7b4fdb06 feat: nested tasks, project wizard, n8n webhooks, inline task editing
Major dispatch/task system overhaul:
- Project templates with 3-step wizard (choose template → edit steps → publish)
- 4 built-in templates: phone service, fiber install, move, repair
- Nested task tree with recursive TaskNode component (parent_job hierarchy)
- n8n webhook integration (on_open_webhook, on_close_webhook per task)
- Inline task editing: status, priority, type, tech assignment, tags, delete
- Tech assignment + tags from ticket modal → jobs appear on dispatch timeline
- ERPNext custom fields: parent_job, on_open_webhook, on_close_webhook, step_order
- Refactored ClientDetailPage, ChatterPanel, DetailModal, dispatch store
- CSS consolidation, dead code cleanup, composable extraction
- Dashboard KPIs with dispatch integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 13:01:20 -04:00

68 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# ─────────────────────────────────────────────────────────────────────────────
# deploy.sh — Build Targo Ops PWA and deploy to ops-frontend nginx container
#
# The ops app is served by a standalone nginx container (ops-frontend) at
# erp.gigafibre.ca/ops/. Traefik strips /ops prefix before proxying to nginx.
# Authentik protection is handled via Traefik forwardAuth middleware.
#
# Static files go to /opt/ops-app/ on the host, mounted into the container.
#
# Usage:
# ./deploy.sh # deploy to remote server (SPA mode, no service worker cache)
# ./deploy.sh local # deploy to local Docker (development)
# ./deploy.sh pwa # deploy to remote server (PWA mode, for production)
#
# Prerequisites (remote):
# - SSH key ~/.ssh/proxmox_vm for root@96.125.196.67
# - ops-frontend container running (see infra/docker-compose.yaml)
# ─────────────────────────────────────────────────────────────────────────────
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
SERVER="root@96.125.196.67"
SSH_KEY="$HOME/.ssh/proxmox_vm"
DEST="/opt/ops-app"
# Default to SPA mode (no service worker = no cache headaches during dev)
BUILD_MODE="spa"
DIST_DIR="dist/spa"
if [ "$1" = "pwa" ]; then
BUILD_MODE="pwa"
DIST_DIR="dist/pwa"
shift
fi
echo "==> Installing dependencies..."
npm ci --silent
echo "==> Building $BUILD_MODE (base=/ops/)..."
DEPLOY_BASE=/ops/ npx quasar build -m "$BUILD_MODE"
if [ "$1" = "local" ]; then
# ── Local deploy ──
echo "==> Deploying to local $DEST..."
rm -rf "$DEST"/*
cp -r "$DIST_DIR"/* "$DEST/"
echo ""
echo "Done! Targo Ops: http://localhost/ops/"
else
# ── Remote deploy ──
echo "==> Packaging..."
tar czf /tmp/ops-build.tar.gz -C "$DIST_DIR" .
echo "==> Deploying to $SERVER..."
cat /tmp/ops-build.tar.gz | ssh -i "$SSH_KEY" "$SERVER" \
"cat > /tmp/ops.tar.gz && \
rm -rf $DEST/*.js $DEST/*.html $DEST/*.json $DEST/assets $DEST/icons $DEST/sw.js $DEST/workbox-*.js && \
cd $DEST && tar xzf /tmp/ops.tar.gz && \
rm -f /tmp/ops.tar.gz"
rm -f /tmp/ops-build.tar.gz
echo ""
echo "Done! Targo Ops ($BUILD_MODE): https://erp.gigafibre.ca/ops/"
fi