From 7a942facae32f9b09de0bcc6e5543a00ec51962a Mon Sep 17 00:00:00 2001 From: needs <624097+needs@users.noreply.github.com> Date: Fri, 11 Sep 2026 01:03:52 +0200 Subject: [PATCH] Add a Conductor run script and drop the VSCode tasks Spotlight testing syncs the active workspace into the repository root, and the single `dev` run script serves the whole stack from there: docker compose, prisma migrate and generate, then worker, scheduler and frontend under one `nx run-many`. Every workspace therefore shares one node_modules, one docker stack and one database, while `setup.sh` keeps lint, build and test working per workspace. Local dev values live in `.conductor/dev.env`, which is also handed to agents, and the compose ports move to an unusual range so they stop colliding with other projects on the same machine. The VSCode tasks that used to launch the same processes are removed. Co-Authored-By: Claude Opus 5 (1M context) --- .conductor/dev.env | 5 ++ .conductor/dev.sh | 24 +++++++ .conductor/settings.toml | 26 ++++++++ .conductor/setup.sh | 17 +++++ .gitignore | 6 +- .vscode/extensions.json | 8 --- .vscode/tasks.json | 124 ------------------------------------- README.md | 7 ++- apps/frontend/project.json | 3 +- docker-compose.yml | 12 ++-- 10 files changed, 86 insertions(+), 146 deletions(-) create mode 100644 .conductor/dev.env create mode 100755 .conductor/dev.sh create mode 100644 .conductor/settings.toml create mode 100755 .conductor/setup.sh delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/tasks.json diff --git a/.conductor/dev.env b/.conductor/dev.env new file mode 100644 index 00000000..b12c76dc --- /dev/null +++ b/.conductor/dev.env @@ -0,0 +1,5 @@ +DATABASE_URL=postgres://postgres:postgres@localhost:47821/teerank +REDIS_HOST=localhost +REDIS_PORT=47822 +S3_ENDPOINT=http://localhost:47823 +PRISMA_BINARY_TARGETS='["native"]' diff --git a/.conductor/dev.sh b/.conductor/dev.sh new file mode 100755 index 00000000..e7884e80 --- /dev/null +++ b/.conductor/dev.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Conductor run script: docker, worker, scheduler and frontend, from the +# repository root that spotlight testing keeps in sync with the active workspace. +set -euo pipefail + +cd "$(dirname "$0")/.." +set -a +. .conductor/dev.env +set +a +cd "${CONDUCTOR_ROOT_PATH:-.}" + +export COMPOSE_PROJECT_NAME=teerank + +[ -d node_modules ] || npm install + +# Wait only for what the apps need; bullboard and pghero can take their time. +docker compose up --detach --wait postgres redis minio +docker compose up --detach + +npx prisma migrate deploy --schema=libs/prisma/prisma/schema.prisma +npx prisma generate --sql --schema=libs/prisma/prisma/schema.prisma + +# exec so a stop signal reaches nx itself rather than this wrapper shell. +exec node_modules/.bin/nx run-many -t serve -p frontend worker scheduler --output-style=stream diff --git a/.conductor/settings.toml b/.conductor/settings.toml new file mode 100644 index 00000000..5885d022 --- /dev/null +++ b/.conductor/settings.toml @@ -0,0 +1,26 @@ +"$schema" = "https://conductor.build/schemas/settings.repo.schema.json" + +spotlight_testing = true +environment_variable_files = [ ".conductor/dev.env" ] + +[scripts] +setup = ".conductor/setup.sh" +run_mode = "nonconcurrent" + +[scripts.run.dev] +command = ".conductor/dev.sh" +available_in = [ "local" ] +default = true +icon = "play" + +[[preview_urls]] +name = "Frontend" +url = "http://localhost:47820" + +[[preview_urls]] +name = "Bull Board" +url = "http://localhost:47825" + +[[preview_urls]] +name = "pghero" +url = "http://localhost:47826" diff --git a/.conductor/setup.sh b/.conductor/setup.sh new file mode 100755 index 00000000..134ad8e8 --- /dev/null +++ b/.conductor/setup.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Conductor setup script: make lint, build and test work in the workspace. The +# app itself runs from the repository root, see dev.sh. +set -euo pipefail + +cd "$(dirname "$0")/.." +set -a +. .conductor/dev.env +set +a + +export COMPOSE_PROJECT_NAME=teerank + +npm install +# Only postgres: generate --sql compiles the typed queries against the database. +docker compose up --detach --wait postgres +npx prisma migrate deploy --schema=libs/prisma/prisma/schema.prisma +npx prisma generate --sql --schema=libs/prisma/prisma/schema.prisma diff --git a/.gitignore b/.gitignore index 11920de3..84d1512f 100644 --- a/.gitignore +++ b/.gitignore @@ -18,11 +18,7 @@ node_modules *.sublime-workspace # IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +.vscode # misc /.sass-cache diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 64553b17..00000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "recommendations": [ - "nrwl.angular-console", - "esbenp.prettier-vscode", - "firsttris.vscode-jest-runner", - "dbaeumer.vscode-eslint" - ] -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 80961bb1..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "version": "2.0.0", - "presentation": { - "echo": false, - "reveal": "silent", - "focus": false, - "panel": "dedicated", - }, - "inputs": [ - { - "id": "terminateFrontend", - "type": "command", - "command": "workbench.action.tasks.terminate", - "args": "Frontend" - }, - { - "id": "terminateWorker", - "type": "command", - "command": "workbench.action.tasks.terminate", - "args": "Worker" - }, - { - "id": "terminateScheduler", - "type": "command", - "command": "workbench.action.tasks.terminate", - "args": "Scheduler" - }, - { - "id": "terminateDocker", - "type": "command", - "command": "workbench.action.tasks.terminate", - "args": "Docker" - }, - ], - "tasks": [ - { - "label": "Launch local dev", - "dependsOn": [ - "Terminate Serve", - "Npm install", - "Start docker", - "Setup databases", - "Start Serve" - ], - "dependsOrder": "sequence", - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "Terminate Serve", - "dependsOn": [ - "Terminate Frontend", - "Terminate Worker", - "Terminate Scheduler", - "Terminate Docker" - ], - }, - { - "label": "Terminate Frontend", - "type": "process", - "command": "echo ${input:terminateFrontend}", - }, - { - "label": "Terminate Worker", - "type": "process", - "command": "echo ${input:terminateWorker}", - }, - { - "label": "Terminate Scheduler", - "type": "process", - "command": "echo ${input:terminateScheduler}", - }, - { - "label": "Terminate Docker", - "type": "process", - "command": "echo ${input:terminateDocker}", - }, - { - "label": "Npm install", - "type": "shell", - "command": "npm install", - "presentation": { - "close": true - } - }, - { - "label": "Start docker", - "type": "shell", - "command": "docker compose up --detach --wait", - "presentation": { - "close": true - } - }, - { - "label": "Start Serve", - "dependsOn": [ - "Start docker", - "Frontend", - "Worker", - "Scheduler", - ], - }, - { - "label": "Frontend", - "type": "shell", - "command": "npx nx serve frontend", - "isBackground": true, - }, - { - "label": "Worker", - "type": "shell", - "command": "npx nx serve worker", - "isBackground": true, - }, - { - "label": "Scheduler", - "type": "shell", - "command": "npx nx serve scheduler", - "isBackground": true, - }, - ] -} diff --git a/README.md b/README.md index f6c6feda..539595b1 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,13 @@ npm install docker compose up -d npx nx run frontend:serve npx nx run worker:serve +npx nx run scheduler:serve ``` -Alternatively, open the projetc on VSCode and run the start building using: -`Command + Shift + B`. +In Conductor, the `dev` run script does all of the above. Spotlight testing +syncs the active workspace into the repository root and the script serves from +there, so every workspace shares one `node_modules`, one docker stack and one +database. # Legacy diff --git a/apps/frontend/project.json b/apps/frontend/project.json index 82be406c..194a3055 100644 --- a/apps/frontend/project.json +++ b/apps/frontend/project.json @@ -23,7 +23,8 @@ "defaultConfiguration": "development", "options": { "buildTarget": "frontend:build", - "dev": true + "dev": true, + "port": 47820 }, "configurations": { "development": { diff --git a/docker-compose.yml b/docker-compose.yml index c4934341..60d71fbf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: postgres: image: postgres:latest ports: - - "5452:5432" + - "47821:5432" environment: POSTGRES_PASSWORD: postgres POSTGRES_DB: teerank @@ -14,7 +14,7 @@ services: redis: image: redis:latest ports: - - "6399:6379" + - "47822:6379" restart: always bullboard: @@ -22,7 +22,7 @@ services: image: venatum/bull-board restart: always ports: - - 3000:3000 + - "47825:3000" environment: REDIS_HOST: redis REDIS_PORT: 6379 @@ -34,7 +34,7 @@ services: pghero: image: ankane/pghero ports: - - "8080:8080" + - "47826:8080" environment: DATABASE_URL: postgres://postgres:postgres@postgres:5432/teerank depends_on: @@ -44,8 +44,8 @@ services: image: minio/minio command: server /data --console-address ":9001" ports: - - "9000:9000" - - "9001:9001" + - "47823:9000" + - "47824:9001" environment: MINIO_ROOT_USER: minioadmin MINIO_ROOT_PASSWORD: minioadmin