- Add Next.js app structure with base configs, linting, and formatting - Implement LiveKit Meet page, types, and utility functions - Add Docker, Compose, and deployment scripts for backend and token server - Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers - Include CSS modules and global styles for UI - Add postMessage and studio integration utilities - Update package.json with dependencies and scripts for development and testing
37 lines
1.3 KiB
Bash
Executable File
37 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
# Start backend-api: build and run dist/index.js with DATABASE_URL env
|
|
# Usage: ./scripts/start-backend.sh [background]
|
|
set -euo pipefail
|
|
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
|
cd "$ROOT_DIR/packages/backend-api"
|
|
|
|
# Ensure .env.local exists
|
|
if [ ! -f .env.local ]; then
|
|
echo "DATABASE_URL='postgres://postgres:72ff3d8d80c352f89d99@192.168.1.20:5433/avanzacast?sslmode=disable'" > .env.local
|
|
echo "Created .env.local with DATABASE_URL (edit if necessary)"
|
|
fi
|
|
|
|
echo "Installing dependencies (skip if already installed)..."
|
|
npm install --no-audit --no-fund
|
|
|
|
echo "Running prisma generate (safe to run multiple times)..."
|
|
npx prisma generate || true
|
|
|
|
echo "Building backend (tsc)..."
|
|
npm run build
|
|
|
|
LOGFILE="$ROOT_DIR/packages/backend-api/logs/backend-$(date +%s).log"
|
|
mkdir -p "$(dirname "$LOGFILE")"
|
|
|
|
if [ "$1" = "background" ]; then
|
|
echo "Starting backend in background, writing logs to $LOGFILE"
|
|
DATABASE_URL="$(grep -E '^DATABASE_URL' .env.local || true | sed -E 's/DATABASE_URL=//')" \
|
|
node dist/index.js > "$LOGFILE" 2>&1 &
|
|
echo "Backend started (background). Tail logs with: tail -f $LOGFILE"
|
|
else
|
|
echo "Starting backend in foreground (logs printed to stdout)"
|
|
DATABASE_URL="$(grep -E '^DATABASE_URL' .env.local || true | sed -E 's/DATABASE_URL=//')" \
|
|
node dist/index.js
|
|
fi
|
|
|