Conversation
Adds .cursor/environment.json plus idempotent install.sh and start.sh that: - install Docker + fuse-overlayfs (overlayfs snapshotter fails in nested VM) - install npm dependencies - run mongo:3 and mysql:5 containers the app depends on - run the app via a 'goof' terminal, exposing port 3001 Co-authored-by: Dan Shappir <dan.shappir@snyk.io>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
mysql:5 opens its TCP port while still initializing its data directory on first boot, so the previous bare port check returned prematurely. The app then connected too early, failed to seed the users table, and crashed on the first /users or /login request. Wait on 'mysqladmin ping' until the server can actually answer queries before returning from start.sh. Co-authored-by: Dan Shappir <dan.shappir@snyk.io>
shappir
marked this pull request as ready for review
September 2, 2026 12:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets up a reproducible Cursor Cloud Agent development environment for
nodejs-goof. The app is an Express todo app that depends on MongoDB (todos + auth) and MySQL/TypeORM (users table), and listens on port 3001.MongoDB's official download/apt domains are blocked by the Cloud Agent egress policy, but
docker.iois allowed. This setup therefore runs the databases via Docker using the samemongo:3/mysql:5images the repo's owndocker-compose.ymluses (these old images are required for compatibility with the app's 2015-eramongoose@4driver). Docker's default overlayfs snapshotter fails inside the nested Cloud Agent VM, so the daemon is pinned to thefuse-overlayfsstorage driver.Files
.cursor/environment.json— repo-managed config:install,start, agoofterminal runningnpm start, and exposes port 3001..cursor/install.sh— idempotent: installsdocker.io+fuse-overlayfs, writes the Docker daemon config, runsnpm install, and best-effort pre-pulls the DB images so a fresh boot is fast..cursor/start.sh— idempotent per-boot: starts the Docker daemon, launchesgoof-mongo(mongo:3) andgoof-mysql(mysql:5), and waits for both to be ready — MySQL is gated on real query readiness (mysqladmin ping), not just an open port.Validation
Validated locally from a clean slate and on two fresh Cloud Agents booted from prebuilt environment builds:
GET /GET /users(MySQL/TypeORM seeded data)[{"id":1,"name":"Liran",...}]POST /login→/admininstall.sh/start.shidempotenceFixed: first-boot MySQL race
The initial fresh-agent verification caught a real race —
mysql:5opens its TCP port while still initializing its data directory, so a bare port check returned prematurely, the app connected too early, failed to seed the users table, and crashed on the first/users//loginrequest.start.shnow blocks onmysqladmin pinguntil MySQL can actually serve queries. A second fresh-agent verification (booted from a rebuilt image) confirmed the happy pathstart.sh→npm startnow works on the first try with no crash and clean seeding.Handoff
This is a repo-managed environment (
.cursor/environment.jsonis the highest-precedence config source). Merging this PR makes the tested setup active for future Cloud Agents automatically — no dashboard Save is required.