mirror of
https://origin.cursor.com/mrdevmx/panels.git
synced 2026-10-09 12:43:18 +00:00
Add Cloud Agent dev environment config
Adds .cursor/environment.json plus install/start scripts to provision the full PANELS stack (Postgres 16 + Redis + Deno API + two Nuxt frontends): - install.sh: installs toolchain, provisions DB roles/schemas + Redis ACLs, runs Liquibase (dev context), bootstraps seed admins, installs web deps. - start.sh: brings up Postgres + Redis per boot (idempotent). - terminals: api (:8000), web-panel (:3000), web-saas (:3001). Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
This commit is contained in:
parent
1ac04996b6
commit
aa87ce4944
3 changed files with 113 additions and 0 deletions
27
.cursor/environment.json
Normal file
27
.cursor/environment.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "PANELS (panel-obra)",
|
||||
"install": "bash .cursor/install.sh",
|
||||
"start": "bash .cursor/start.sh",
|
||||
"terminals": [
|
||||
{
|
||||
"name": "api",
|
||||
"command": "export PATH=\"$HOME/.deno/bin:$PATH\"; cd api && deno task dev",
|
||||
"description": "API Deno/Hono en http://localhost:8000 (Postgres + Redis)."
|
||||
},
|
||||
{
|
||||
"name": "web-panel",
|
||||
"command": "cd web-panel && npm run dev -- --host",
|
||||
"description": "Frontend del panel (Nuxt SPA) en http://localhost:3000; proxy /v1 -> API."
|
||||
},
|
||||
{
|
||||
"name": "web-saas",
|
||||
"command": "cd web-saas && npm run dev -- --host",
|
||||
"description": "Frontend SaaS (Nuxt SPA) en http://localhost:3001; proxy /v1 -> API."
|
||||
}
|
||||
],
|
||||
"ports": [
|
||||
{ "name": "api", "port": 8000 },
|
||||
{ "name": "web-panel", "port": 3000 },
|
||||
{ "name": "web-saas", "port": 3001 }
|
||||
]
|
||||
}
|
||||
70
.cursor/install.sh
Executable file
70
.cursor/install.sh
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/env bash
|
||||
# PANELS · Cloud Agent · bootstrap idempotente del entorno de desarrollo.
|
||||
# Instala toolchain (Postgres 16, Redis, Java, Deno), aprovisiona la base
|
||||
# de datos local, aplica migraciones Liquibase (contexto dev con datos de
|
||||
# demostración), crea los administradores semilla e instala dependencias.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
echo "== [1/8] Toolchain del sistema (Postgres 16, Redis, Java, unzip) =="
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
postgresql postgresql-contrib redis-server openjdk-21-jre-headless unzip curl ca-certificates
|
||||
|
||||
echo "== [2/8] Deno =="
|
||||
if [ ! -x "$HOME/.deno/bin/deno" ]; then
|
||||
curl -fsSL https://deno.land/install.sh | DENO_INSTALL="$HOME/.deno" sh
|
||||
fi
|
||||
export PATH="$HOME/.deno/bin:$PATH"
|
||||
|
||||
echo "== [3/8] Arrancar Postgres + Redis =="
|
||||
sudo service postgresql start
|
||||
sudo service redis-server start
|
||||
for _ in $(seq 1 30); do sudo -u postgres pg_isready -q && break; sleep 1; done
|
||||
|
||||
echo "== [4/8] Aprovisionar roles/bases/esquemas + ACL de Redis (idempotente) =="
|
||||
chmod +x db/*.sh db/provision/*.sh
|
||||
if [ ! -f "$ROOT/.env.dev-local" ]; then
|
||||
bash db/provision/dev-local.sh
|
||||
else
|
||||
echo " .env.dev-local ya existe; se omite el aprovisionamiento."
|
||||
fi
|
||||
|
||||
echo "== [5/8] Archivo .env de la API =="
|
||||
if [ ! -f "$ROOT/.env" ]; then
|
||||
{
|
||||
grep -v '^#' .env.dev-local | grep .
|
||||
echo ""
|
||||
echo "# --- Secretos de aplicación (solo desarrollo) ---"
|
||||
echo "PORT=8000"
|
||||
echo "SESSION_SECRET=$(openssl rand -hex 24)"
|
||||
echo "DOCS_KEY=$(openssl rand -hex 32)"
|
||||
echo "SEED_PASSWORD=PanelsDev2026!"
|
||||
echo "PANEL_LOGIN_URL=http://localhost:3000/login"
|
||||
echo "COOKIE_SECURE=false"
|
||||
echo "DENO_ENV=development"
|
||||
} > "$ROOT/.env"
|
||||
else
|
||||
echo " .env ya existe; se conserva."
|
||||
fi
|
||||
|
||||
echo "== [6/8] Migraciones Liquibase (contexto dev) =="
|
||||
set -a; source .env.dev-local; set +a
|
||||
./db/update.sh all --context-filter=dev
|
||||
|
||||
echo "== [7/8] Administradores semilla (platform + tenant) =="
|
||||
(
|
||||
cd api
|
||||
set -a; source ../.env; set +a
|
||||
deno run --allow-net --allow-env --allow-read scripts/bootstrap-admin.ts platform
|
||||
deno run --allow-net --allow-env --allow-read scripts/bootstrap-admin.ts tenant --tenant-id=1
|
||||
)
|
||||
|
||||
echo "== [8/8] Dependencias web + caché de Deno =="
|
||||
( cd web-panel && npm install --no-audit --no-fund )
|
||||
( cd web-saas && npm install --no-audit --no-fund )
|
||||
( cd api && deno cache main.ts )
|
||||
|
||||
echo "Entorno PANELS listo."
|
||||
16
.cursor/start.sh
Executable file
16
.cursor/start.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
# PANELS · Cloud Agent · arranque por-boot de los servicios de infraestructura.
|
||||
# Deben estar arriba antes de que los terminales levanten la API y los
|
||||
# frontends. Es idempotente: si ya corren, no falla.
|
||||
set -euo pipefail
|
||||
|
||||
sudo service postgresql start || true
|
||||
sudo service redis-server start || true
|
||||
|
||||
for _ in $(seq 1 30); do
|
||||
if sudo -u postgres pg_isready -q; then break; fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
redis-cli ping >/dev/null 2>&1 || true
|
||||
echo "Postgres + Redis listos."
|
||||
Loading…
Reference in a new issue