feat: switch workspace provisioning from Coolify to Cloud Run

- lib/cloud-run-workspace.ts: provisions per-project Theia workspaces as
  Cloud Run services (theia-{slug}), scales to zero when idle, starts in
  ~5-15s from cached image
- create/route.ts: imports cloud-run-workspace instead of coolify-workspace
- Image: northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest
- Includes prewarmWorkspace() for near-zero perceived load time on login

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-19 14:01:02 -08:00
parent a22d5a0f18
commit 106d9c5ff1
2 changed files with 173 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import { authOptions } from '@/lib/auth/authOptions';
import { query } from '@/lib/db-postgres';
import { randomUUID } from 'crypto';
import { createRepo, createWebhook, GITEA_ADMIN_USER_EXPORT } from '@/lib/gitea';
import { provisionTheiaWorkspace } from '@/lib/coolify-workspace';
import { provisionTheiaWorkspace } from '@/lib/cloud-run-workspace';
import type { ProjectPhaseData, ProjectPhaseScores } from '@/lib/types/project-artifacts';
const GITEA_ADMIN_USER = GITEA_ADMIN_USER_EXPORT;
@@ -99,8 +99,8 @@ export async function POST(request: Request) {
try {
const workspace = await provisionTheiaWorkspace(slug, projectId, giteaRepo);
theiaWorkspaceUrl = workspace.workspaceUrl;
theiaAppUuid = workspace.appUuid;
theiaWorkspaceUrl = workspace.serviceUrl;
theiaAppUuid = workspace.serviceName;
console.log(`[API] Theia workspace provisioned: ${theiaWorkspaceUrl}`);
} catch (err) {
theiaError = err instanceof Error ? err.message : String(err);