Files
dictia-public/deployment/config/tailscale/setup-serve.sh

53 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# DictIA — Tailscale Serve/Funnel setup
#
# Exposes DictIA and ASR Proxy dashboard via Tailscale HTTPS.
# Based on the VPS production configuration.
#
# Usage:
# bash setup-serve.sh [serve|funnel]
# serve — accessible only within your tailnet (default)
# funnel — accessible from the public internet
set -euo pipefail
MODE="${1:-serve}"
echo "=== DictIA Tailscale Setup ==="
echo "Mode: $MODE"
echo
# Verify Tailscale is connected
if ! tailscale status >/dev/null 2>&1; then
echo "ERROR: Tailscale is not running or not connected."
echo " Install: curl -fsSL https://tailscale.com/install.sh | sh"
echo " Connect: sudo tailscale up"
exit 1
fi
HOSTNAME=$(tailscale status --json | python3 -c "import sys,json; print(json.load(sys.stdin)['Self']['DNSName'].rstrip('.'))" 2>/dev/null || echo "unknown")
echo "Tailscale hostname: $HOSTNAME"
echo
# DictIA app on :443 → localhost:8899
echo "[1/2] Setting up DictIA app (port 443 → 8899)..."
if [ "$MODE" = "funnel" ]; then
tailscale funnel --bg --https=443 http://localhost:8899
else
tailscale serve --bg --https=443 http://localhost:8899
fi
# ASR Proxy dashboard on :9443 → localhost:9090
echo "[2/2] Setting up ASR Proxy dashboard (port 9443 → 9090)..."
if [ "$MODE" = "funnel" ]; then
tailscale funnel --bg --https=9443 http://localhost:9090
else
tailscale serve --bg --https=9443 http://localhost:9090
fi
echo
echo "=== Setup complete ==="
echo "DictIA: https://$HOSTNAME/"
echo "ASR Dashboard: https://$HOSTNAME:9443/"
echo
echo "Verify with: tailscale serve status"