Skip to content

Commit be32503

Browse files
committed
More worktree guidelines
1 parent e8a40b8 commit be32503

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ pnpm dx:down # Stop Docker containers
1515
### Worktrees
1616

1717
- when using git worktrees, store them in the .worktrees directory in the root of the project folder
18-
- remember to copy the .env file and change the dev server port number to a random one
18+
- when creating a worktree, copy `.env` from the root project into the worktree
19+
- update worktree-local app urls/port to avoid conflicts with the main workspace:
20+
- set `NEXTAUTH_URL` and `NEXTAUTH_URL_INTERNAL` to a unique localhost port
21+
- run dev server with that same port (for example `pnpm dev --port 3174`)
22+
- use a separate postgres instance per worktree (different host port + db name)
23+
- set unique values in the worktree `.env`: `POSTGRES_PORT`, `POSTGRES_DB`, `POSTGRES_CONTAINER_NAME`, `DATABASE_URL`
24+
- start dedicated db container, for example:
25+
- `docker run -d --name <unique-container-name> -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=strong-password -e POSTGRES_DB=<worktree-db> -p <worktree-port>:5432 ossapps/postgres:17.7-trixie postgres -c shared_preload_libraries=pg_cron -c cron.database_name=<worktree-db> -c cron.timezone=UTC`
26+
- enable pg_cron extension once: `psql "postgresql://postgres:strong-password@localhost:<worktree-port>/<worktree-db>" -c "CREATE EXTENSION IF NOT EXISTS pg_cron;"`
27+
- initialize schema and data: `pnpm exec prisma migrate reset --force --skip-seed && pnpm db:seed`
1928

2029
### Database
2130

0 commit comments

Comments
 (0)