Skip to content

Commit d9cc0c9

Browse files
docs: add Cursor Cloud env setup instructions to AGENTS.md
Move the Cloud VM startup/run caveats onto main so future agents boot from main rather than kaushik-IDE. Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
1 parent ed761d5 commit d9cc0c9

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,65 @@ User Message → ChatController → SpringAIChatService
159159
- Database provider anti-pattern → never use if/else for database types
160160
- Connection pool pollution → always reset session state after benchmark operations
161161
- Frontend state → use Zustand selector hooks to avoid infinite re-render loops
162+
163+
## Cursor Cloud specific instructions
164+
165+
The dev environment runs the stack **natively (no Docker)**: Java 25 + Maven wrapper backend,
166+
Vite frontend, and locally-installed PostgreSQL 16 + Redis. System dependencies (JDK 25,
167+
Postgres, pgvector, Redis) are baked into the VM snapshot; the startup update script only
168+
refreshes `npm install`. Standard commands live in [`CLAUDE.md`](CLAUDE.md) — this section
169+
only covers cloud-specific, non-obvious caveats.
170+
171+
### Services (start these each session — systemd is NOT running in the VM)
172+
173+
- **PostgreSQL 16** (vault DB, port 5432): start with `sudo pg_ctlcluster 16 main start`.
174+
DB `dba_agent` (user/pass `postgres`/`postgres`), extensions `vector` + `pg_stat_statements`
175+
enabled. `shared_preload_libraries=pg_stat_statements` is already set in the cluster config.
176+
- **Redis** (cache, port 6379): start with `sudo redis-server /etc/redis/redis.conf --daemonize yes`.
177+
Redis degrades gracefully but the local `.env` points at it.
178+
- **Backend** (port 8080, base path `/api`): `bash scripts/start-backend.sh` (wraps
179+
`./mvnw spring-boot:run`; it strips `SPRING_PROFILES_ACTIVE=prod` for local runs → dev mode).
180+
- **Frontend** (port 3000): `npm run dev` (Vite proxies `/api` → 8080 and `/agent-api` → 8787).
181+
- **Hermes Agent webui** (port 8787, optional): needed only for the sidebar **Agent** tab.
182+
See caveats below for install + `HERMES_WEBUI_ALLOWED_ORIGINS`.
183+
- A demo target DB `demo_shop` (same Postgres server, sample `customers`/`products`/`orders`)
184+
exists for exercising connection/schema features without an external database.
185+
186+
### Non-obvious setup caveats (each cost real debugging time)
187+
188+
- **Java 25 is mandatory** (`pom.xml` sets `java.version=25`); the VM's default `java` is set
189+
to Temurin 25 via `update-alternatives`, and `JAVA_HOME` is exported in `~/.bashrc`.
190+
- **`.env` is loaded by `source` in `scripts/start-backend.sh`, which runs under `set -e`.**
191+
Dotted keys like `spring.data.redis.host=...` make bash abort the whole script with
192+
"command not found". Use Spring relaxed-binding UPPERCASE env names instead
193+
(e.g. `SPRING_DATA_REDIS_HOST`). This is why the local `.env` avoids dotted keys.
194+
- **`ENCRYPTION_KEYS` must be set, not just `ENCRYPTION_KEY`.** `application.properties`
195+
hardcodes `ENCRYPTION_KEYS=${ENCRYPTION_KEYS:}`; with the OS env var unset this is a
196+
circular placeholder reference that fails `EncryptionService` bean creation at boot. The
197+
local `.env` sets `ENCRYPTION_KEYS=<id>:<base64key>` matching `ENCRYPTION_KEY_ID`.
198+
- **`SECURITY_AUTH_ENABLED=false`** (set in `.env`) enables the dev auto-admin bypass, so the
199+
web UI needs no login. Auth defaults to ON in every profile otherwise (there is no
200+
`admin/admin`); a real login needs the localhost admin-bootstrap flow (see README).
201+
- **The `scheduled_tasks` table and the `vector`/`pg_stat_statements` extensions** come from
202+
`docker/postgres/init/*.sql`. In the native (non-Docker) setup those were applied by hand;
203+
they persist in the snapshot. If you ever recreate the vault DB, re-apply
204+
`docker/postgres/init/*.sql` or db-scheduler logs `relation "scheduled_tasks" does not exist`.
205+
- **LLM (Azure OpenAI) is configured in the local gitignored `.env`** (not committed). Working
206+
values for this environment: `DEEPSQL_CHAT_PROVIDER=openai`,
207+
`DEEPSQL_CHAT_ENDPOINT=https://deepsql-selfhost-resource.cognitiveservices.azure.com/`,
208+
`DEEPSQL_CHAT_MODEL=gpt-5.4` (deployment name), plus matching `DEEPSQL_EMBEDDING_*` with
209+
`text-embedding-3-large`. Also set `AZURE_OPENAI_KEY` / `AZURE_OPENAI_ENDPOINT` aliases —
210+
`hermes/install.sh` reads those. After changing LLM env, restart the backend
211+
(`scripts/start-backend.sh`); `/api/setup/status` should show `hasLlmConfig: true`.
212+
- **Agent tab (Hermes) is optional but required for the in-app Agent chat UI.** Install via
213+
`curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash -s -- --non-interactive --skip-setup`,
214+
symlink `~/.hermes/hermes-agent/.venv``venv` (DeepSQL's `hermes/install.sh` expects `.venv`),
215+
then `bash hermes/install.sh`. Start the webui with
216+
`HERMES_WEBUI_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000`
217+
(without this, Vite's Origin header makes Hermes return **403** "Cross-origin mismatch").
218+
Webui listens on `:8787`; Vite proxies `/agent-api` → there.
219+
- **Before running backend tests that boot the Spring context** (e.g. `ApiSmokeTest`), stop
220+
the running backend first — both use `ddl-auto=update` on the same `dba_agent` DB and can
221+
deadlock on an `ALTER TABLE`. Test env vars are documented in `CLAUDE.md` (Testing).
222+
- `npm run lint` currently reports many pre-existing warnings/errors in the repo; that is the
223+
baseline, not a setup failure.

0 commit comments

Comments
 (0)