| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| param( |
| [Parameter(Position=0)] |
| [ValidateSet("push", "deploy", "full")] |
| [string]$Action = "full" |
| ) |
|
|
| $ErrorActionPreference = "Stop" |
| $ProjectRoot = Split-Path -Parent $PSScriptRoot |
| $AiMemoryDir = $PSScriptRoot |
|
|
| |
| |
| |
| $GCP_PROJECT = "faraday-memory-cloud" |
| $GCP_REGION = "asia-south1" |
| $SERVICE_NAME = "faraday-mcp" |
| $FARADAY_API_KEY = "frdy_" + [System.Guid]::NewGuid().ToString("N").Substring(0, 24) |
|
|
| |
| |
| |
| function Push-Data { |
| Write-Host "`nπ¦ Pushing data to Supabase Storage..." -ForegroundColor Cyan |
| |
| $venvPython = Join-Path $ProjectRoot ".venv\Scripts\python.exe" |
| if (Test-Path $venvPython) { |
| & $venvPython (Join-Path $AiMemoryDir "sync.py") push |
| } else { |
| python (Join-Path $AiMemoryDir "sync.py") push |
| } |
| |
| if ($LASTEXITCODE -ne 0) { |
| Write-Host "β Data push failed!" -ForegroundColor Red |
| exit 1 |
| } |
| Write-Host "β
Data pushed to Supabase." -ForegroundColor Green |
| } |
|
|
| |
| |
| |
| function Deploy-CloudRun { |
| Write-Host "`nπ Deploying to Google Cloud Run..." -ForegroundColor Cyan |
| |
| |
| $account = gcloud auth list --filter="status=ACTIVE" --format="value(account)" 2>$null |
| if (-not $account) { |
| Write-Host "β οΈ Not authenticated with gcloud. Running 'gcloud auth login'..." -ForegroundColor Yellow |
| gcloud auth login |
| } |
| |
| |
| gcloud config set project $GCP_PROJECT 2>$null |
| |
| |
| Write-Host " Enabling Cloud Run API..." -ForegroundColor Gray |
| gcloud services enable run.googleapis.com artifactregistry.googleapis.com cloudbuild.googleapis.com 2>$null |
| |
| |
| Write-Host " Building and deploying container..." -ForegroundColor Gray |
| gcloud run deploy $SERVICE_NAME ` |
| --source $AiMemoryDir ` |
| --region $GCP_REGION ` |
| --platform managed ` |
| --allow-unauthenticated ` |
| --memory 2Gi ` |
| --cpu 1 ` |
| --min-instances 0 ` |
| --max-instances 2 ` |
| --timeout 300 ` |
| --set-env-vars "SUPABASE_URL=https://qwxagrmoryojholseclm.supabase.co" ` |
| --set-env-vars "SUPABASE_KEY=$env:SUPABASE_KEY" ` |
| --set-env-vars "FARADAY_API_KEY=$FARADAY_API_KEY" ` |
| --set-env-vars "SUPABASE_BUCKET=faraday-memory" |
| |
| if ($LASTEXITCODE -ne 0) { |
| Write-Host "β Cloud Run deployment failed!" -ForegroundColor Red |
| exit 1 |
| } |
| |
| |
| $serviceUrl = gcloud run services describe $SERVICE_NAME --region $GCP_REGION --format="value(status.url)" |
| |
| Write-Host "`n" -NoNewline |
| Write-Host "βββββββββββββββββββββββββββββββββββββββββββββββββββ" -ForegroundColor Green |
| Write-Host " β
DEPLOYMENT COMPLETE!" -ForegroundColor Green |
| Write-Host "βββββββββββββββββββββββββββββββββββββββββββββββββββ" -ForegroundColor Green |
| Write-Host "`n Service URL: $serviceUrl" -ForegroundColor White |
| Write-Host " SSE Endpoint: $serviceUrl/sse" -ForegroundColor White |
| Write-Host " API Key: $FARADAY_API_KEY" -ForegroundColor Yellow |
| Write-Host "`n π± Claude Phone Config:" -ForegroundColor Cyan |
| Write-Host @" |
| { |
| "mcpServers": { |
| "faraday": { |
| "command": "npx", |
| "args": [ |
| "-y", "mcp-remote", |
| "$serviceUrl/sse" |
| ] |
| } |
| } |
| } |
| "@ -ForegroundColor Gray |
| Write-Host "" |
| } |
|
|
| |
| |
| |
| switch ($Action) { |
| "push" { |
| Push-Data |
| } |
| "deploy" { |
| Deploy-CloudRun |
| } |
| "full" { |
| Push-Data |
| Deploy-CloudRun |
| } |
| } |
|
|