Files
tabatago/scripts/deploy-functions.sh
Millian Lamiaux edcd857c70
Some checks failed
CI / TypeScript (push) Failing after 48s
CI / ESLint (push) Failing after 20s
CI / Tests (push) Failing after 33s
CI / Build Check (push) Has been skipped
CI / Admin Web Tests (push) Failing after 18s
CI / Deploy Edge Functions (push) Has been skipped
feat(admin-web, functions): overhaul music library and add AI genre classification
- admin-web: Added an "All Music" library view with search, genre, and status filters.
- admin-web: Converted Jobs view to use expandable cards instead of a split pane.
- admin-web: Added ability to delete individual tracks from a job.
- functions: Added new `youtube-classify` edge function to automatically categorize tracks using Gemini LLM.
- functions: Integrated AI genre classification during initial playlist import if no manual genre is provided.
- worker: Added `/classify` endpoint for the worker to securely interface with Gemini.
- scripts: Updated deployment script to include `GEMINI_API_KEY`.
2026-03-29 12:52:02 +02:00

57 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# ── Configuration ──────────────────────────────────────────────
DEPLOY_HOST="${DEPLOY_HOST:-1000co.fr}"
DEPLOY_USER="${DEPLOY_USER:-millian}"
DEPLOY_PATH="${DEPLOY_PATH:-/opt/supabase/volumes/functions}"
WORKER_PATH="${WORKER_PATH:-/opt/supabase/youtube-worker}"
# ───────────────────────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
FUNCTIONS_DIR="$SCRIPT_DIR/../supabase/functions"
WORKER_DIR="$SCRIPT_DIR/../youtube-worker"
# ── Deploy edge functions ──────────────────────────────────────
echo "==> Deploying edge functions"
rsync -avz --delete \
--exclude='node_modules' \
--exclude='.DS_Store' \
"$FUNCTIONS_DIR/" \
"$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/"
echo "Restarting supabase-edge-functions..."
ssh "$DEPLOY_USER@$DEPLOY_HOST" "docker restart supabase-edge-functions"
# ── Deploy youtube-worker sidecar ──────────────────────────────
echo ""
echo "==> Deploying youtube-worker sidecar"
rsync -avz --delete \
--exclude='node_modules' \
--exclude='.DS_Store' \
"$WORKER_DIR/" \
"$DEPLOY_USER@$DEPLOY_HOST:$WORKER_PATH/"
echo "Building and restarting youtube-worker..."
ssh "$DEPLOY_USER@$DEPLOY_HOST" "\
cd $WORKER_PATH && \
docker build -t youtube-worker:latest . && \
docker stop youtube-worker 2>/dev/null || true && \
docker rm youtube-worker 2>/dev/null || true && \
docker run -d \
--name youtube-worker \
--restart unless-stopped \
--network supabase_supabase-network \
-e SUPABASE_URL=\$(docker exec supabase-edge-functions printenv SUPABASE_URL) \
-e SUPABASE_SERVICE_ROLE_KEY=\$(docker exec supabase-edge-functions printenv SUPABASE_SERVICE_ROLE_KEY) \
-e SUPABASE_PUBLIC_URL=https://supabase.1000co.fr \
-e GEMINI_API_KEY=\$(cat /opt/supabase/.env.gemini 2>/dev/null || echo '') \
-e STORAGE_BUCKET=workout-audio \
-e PORT=3001 \
youtube-worker:latest"
echo ""
echo "Done. Verifying youtube-worker health..."
sleep 3
ssh "$DEPLOY_USER@$DEPLOY_HOST" "docker logs youtube-worker --tail 5"