Mobile-first Quasar PWA for field technicians at erp.gigafibre.ca/field/: - Multi-barcode scanner (photo + live + manual) with device lookup - Tasks page: today's Dispatch Jobs + assigned tickets - Diagnostic: speed test, HTTP resolve, batch service check - Device detail with customer linking - Offline support: IndexedDB queue, API cache, auto-sync - Standalone nginx container with Traefik StripPrefix + Authentik SSO Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
49 lines
1.8 KiB
Bash
Executable File
49 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
# deploy.sh — Build Targo Field PWA and deploy to field-frontend nginx container
|
|
#
|
|
# Served at erp.gigafibre.ca/field/ via Traefik StripPrefix + Authentik SSO.
|
|
# Static files go to /opt/field-app/ on the host, mounted into nginx container.
|
|
#
|
|
# Usage:
|
|
# ./deploy.sh # deploy to remote server (production)
|
|
# ./deploy.sh local # deploy locally
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
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/field-app"
|
|
|
|
echo "==> Installing dependencies..."
|
|
npm ci --silent
|
|
|
|
echo "==> Building PWA (base=/field/)..."
|
|
VITE_ERP_TOKEN="b273a666c86d2d0:06120709db5e414" DEPLOY_BASE=/field/ npx quasar build -m pwa
|
|
|
|
if [ "$1" = "local" ]; then
|
|
echo "==> Deploying to local $DEST..."
|
|
rm -rf "$DEST"/*
|
|
cp -r dist/pwa/* "$DEST/"
|
|
echo ""
|
|
echo "Done! Targo Field: http://localhost/field/"
|
|
else
|
|
echo "==> Packaging..."
|
|
tar czf /tmp/field-pwa.tar.gz -C dist/pwa .
|
|
|
|
echo "==> Deploying to $SERVER..."
|
|
cat /tmp/field-pwa.tar.gz | ssh -i "$SSH_KEY" "$SERVER" \
|
|
"cat > /tmp/field.tar.gz && \
|
|
rm -rf $DEST/*.js $DEST/*.html $DEST/*.json $DEST/assets $DEST/icons && \
|
|
cd $DEST && tar xzf /tmp/field.tar.gz && \
|
|
rm -f /tmp/field.tar.gz"
|
|
|
|
rm -f /tmp/field-pwa.tar.gz
|
|
|
|
echo ""
|
|
echo "Done! Targo Field: https://erp.gigafibre.ca/field/"
|
|
fi
|