teqo-backup/.cursor/cloud-setup.sh
Francisco Solla b0d158cc87 fix(cloud): bootstrap Postgres nativo no Cursor Cloud (#59)
* fix(cloud): bootstrap Postgres nativo no Cursor Cloud

VMs Cloud não têm Docker (sem daemon/systemd; overlayfs falha em
docker compose). Substitui compose por ensure-postgres.sh (PG 16 via
apt, pg_ctlcluster) e corrige placeholders do .env (BLOB token no
formato vercel_blob_rw_* exigido pelo adapter).

Testado: cloud-setup.sh completa migrate + seed em teqo e teqo_test.

* fix(ci): define GH_REPO no job migration-lock

gh pr list falha sem checkout quando não há repositório git no runner
(fatal: not a git repository). GH_REPO aponta explicitamente para o repo.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-07-30 18:36:33 -03:00

34 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Cursor Cloud environment setup: deps are installed by environment.json's
# `install`; this script brings up the local Postgres and builds the MINIMAL
# synthetic database (docs/AGENT-OPS.md — agents never see stage/prod URLs).
#
# Uses native PostgreSQL — Cursor Cloud VMs cannot run Docker (no daemon / overlayfs).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${REPO_ROOT}"
bash "${SCRIPT_DIR}/ensure-postgres.sh"
if [ ! -f .env ]; then
sed \
-e 's/YOUR_SECRET_HERE/cursor-cloud-local-secret/' \
-e 's/YOUR_BLOB_TOKEN_HERE/vercel_blob_rw_cloud01_localplaceholder01/' \
.env.example > .env
echo "[cloud-setup] wrote .env from .env.example (local-only values)"
fi
# Dev database (teqo) and test database (teqo_test).
echo "[cloud-setup] migrating teqo..."
pnpm migrate
echo "[cloud-setup] migrating teqo_test..."
DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo_test pnpm migrate
echo "[cloud-setup] seeding teqo..."
pnpm db:seed:minimal
echo "[cloud-setup] seeding teqo_test..."
DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo_test pnpm db:seed:minimal
echo "[cloud-setup] OK — minimal database ready (dev + test)."