Keep run as ignored local checkout

This commit is contained in:
npc0-hue
2026-07-14 18:03:12 +08:00
parent a57a5dbfcf
commit 4ba5bd6971
8 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ PLATFORM_METADATA_PATH=.platform-data/metadata.json
PLATFORM_LOG_BODY_BACKEND=file PLATFORM_LOG_BODY_BACKEND=file
PLATFORM_LOG_DIR=.platform-data/logs PLATFORM_LOG_DIR=.platform-data/logs
RUN_REPO_DIR=../run RUN_REPO_DIR=./run
RUN_MODE=worker RUN_MODE=worker
RUN_PLATFORM_URL=http://127.0.0.1:8080 RUN_PLATFORM_URL=http://127.0.0.1:8080
RUN_ENDPOINT_ID=run-local RUN_ENDPOINT_ID=run-local
+1 -1
View File
@@ -4,9 +4,9 @@ coverage/
.DS_Store .DS_Store
.tmp .tmp
.local-debug .local-debug
/run/
.idea .idea
.claude .claude
.github .github
.codex .codex
.agents .agents
+8 -8
View File
@@ -6,7 +6,7 @@ This repository is the game server management platform workspace. It replaces th
- `platform_web/`: management console frontend. - `platform_web/`: management console frontend.
- `plugins/`: game management plugin workspace. A plugin defines how to create and manage one server type, and one installed plugin can create many server instances. - `plugins/`: game management plugin workspace. A plugin defines how to create and manage one server type, and one installed plugin can create many server instances.
The machine-side executor source lives in the separate `git@git.npc0.com:admin343/run.git` repository. Local debug and Docker workflows can still start it through `RUN_REPO_DIR`. The machine-side executor source lives in the separate `git@git.npc0.com:admin343/run.git` repository. Local debug and Docker workflows can keep it at `./run` as an ignored nested checkout, or use another path through `RUN_REPO_DIR`.
## Product Scope ## Product Scope
@@ -69,13 +69,13 @@ Run focused checks when working in one root:
Run executor checks are owned by the separate run checkout: Run executor checks are owned by the separate run checkout:
```bash ```bash
(cd "${RUN_REPO_DIR:-../run}" && go test ./...) (cd "${RUN_REPO_DIR:-./run}" && go test ./...)
``` ```
Run the API-backed local debug workspace when you need platform, run, platform_web, and the dev plugin fixture together: Run the API-backed local debug workspace when you need platform, run, platform_web, and the dev plugin fixture together:
```bash ```bash
git clone git@git.npc0.com:admin343/run.git ../run # once, if the sibling checkout is missing git clone git@git.npc0.com:admin343/run.git run # once, if the ignored local checkout is missing
scripts/local-debug-start.sh scripts/local-debug-start.sh
scripts/local-debug-smoke.sh scripts/local-debug-smoke.sh
``` ```
@@ -87,7 +87,7 @@ Start local processes:
```bash ```bash
(cd platform && go run ./cmd/platform) (cd platform && go run ./cmd/platform)
(cd "${RUN_REPO_DIR:-../run}" && go run ./cmd/run) (cd "${RUN_REPO_DIR:-./run}" && go run ./cmd/run)
(cd platform_web && npm run dev) (cd platform_web && npm run dev)
``` ```
@@ -96,7 +96,7 @@ Start local processes:
Use the root compose file for a local all-in-one deployment: Use the root compose file for a local all-in-one deployment:
```bash ```bash
git clone git@git.npc0.com:admin343/run.git ../run # once, if the sibling checkout is missing git clone git@git.npc0.com:admin343/run.git run # once, if the ignored local checkout is missing
docker compose up --build docker compose up --build
``` ```
@@ -108,7 +108,7 @@ Then open:
The compose deployment starts: The compose deployment starts:
- `platform`: backend on container port `8080`, published as host port `8080`. - `platform`: backend on container port `8080`, published as host port `8080`.
- `run`: worker mode executor built from `${RUN_REPO_DIR:-../run}` and connected to `http://platform:8080`. - `run`: worker mode executor built from `${RUN_REPO_DIR:-./run}` and connected to `http://platform:8080`.
- `platform-web`: built static console served by Nginx on container port `80`, published as host port `5173`. - `platform-web`: built static console served by Nginx on container port `80`, published as host port `5173`.
Persistent Docker data lives in named volumes: Persistent Docker data lives in named volumes:
@@ -157,7 +157,7 @@ cp platform/.env.example platform/.env
cp platform_web/.env.example platform_web/.env cp platform_web/.env.example platform_web/.env
(cd platform && set -a && source .env && set +a && go run ./cmd/platform) (cd platform && set -a && source .env && set +a && go run ./cmd/platform)
(cd "${RUN_REPO_DIR:-../run}" && go run ./cmd/run) (cd "${RUN_REPO_DIR:-./run}" && go run ./cmd/run)
(cd platform_web && npm run dev) (cd platform_web && npm run dev)
``` ```
@@ -167,7 +167,7 @@ Most common edits:
- Platform file persistence: `PLATFORM_STORAGE_BACKEND=file`, `PLATFORM_METADATA_PATH`, `PLATFORM_LOG_DIR`. - Platform file persistence: `PLATFORM_STORAGE_BACKEND=file`, `PLATFORM_METADATA_PATH`, `PLATFORM_LOG_DIR`.
- Platform MySQL metadata: `PLATFORM_STORAGE_BACKEND=mysql`, `PLATFORM_MYSQL_DSN=platform:platform@tcp(127.0.0.1:3306)/platform?parseTime=true`. - Platform MySQL metadata: `PLATFORM_STORAGE_BACKEND=mysql`, `PLATFORM_MYSQL_DSN=platform:platform@tcp(127.0.0.1:3306)/platform?parseTime=true`.
- Log body persistence: `PLATFORM_LOG_BODY_BACKEND=file`, `PLATFORM_LOG_DIR`. - Log body persistence: `PLATFORM_LOG_BODY_BACKEND=file`, `PLATFORM_LOG_DIR`.
- Run source checkout: `RUN_REPO_DIR=../run`. - Run source checkout: `RUN_REPO_DIR=./run` by default; `run/` is ignored by the browser repository.
- Run worker mode: `RUN_MODE=worker`. - Run worker mode: `RUN_MODE=worker`.
- Run-to-platform URL: `RUN_PLATFORM_URL=http://127.0.0.1:8080` locally, `http://platform:8080` in Docker. - Run-to-platform URL: `RUN_PLATFORM_URL=http://127.0.0.1:8080` locally, `http://platform:8080` in Docker.
- Run local data: `RUN_WORKSPACE_ROOT`, `RUN_SPOOL_ROOT`. - Run local data: `RUN_WORKSPACE_ROOT`, `RUN_SPOOL_ROOT`.
+1 -1
View File
@@ -53,7 +53,7 @@ services:
run: run:
build: build:
context: ${RUN_REPO_DIR:-../run} context: ${RUN_REPO_DIR:-./run}
dockerfile: Dockerfile dockerfile: Dockerfile
depends_on: depends_on:
platform: platform:
+4 -4
View File
@@ -6,7 +6,7 @@ The local debug workspace runs the real platform API, run worker, platform_web c
- Platform listens on `http://127.0.0.1:18080` by default. - Platform listens on `http://127.0.0.1:18080` by default.
- platform_web listens on `http://127.0.0.1:5173` by default and proxies `/api/v1` plus `/healthz` to platform. - platform_web listens on `http://127.0.0.1:5173` by default and proxies `/api/v1` plus `/healthz` to platform.
- Run worker is loaded from `RUN_REPO_DIR`, defaulting to a sibling `../run` checkout, and registers as `run-local-debug`. - Run worker is loaded from `RUN_REPO_DIR`, defaulting to the ignored nested `./run` checkout, and registers as `run-local-debug`.
- Disposable state lives under `.local-debug/`. - Disposable state lives under `.local-debug/`.
- Logs live under `.local-debug/logs/`. - Logs live under `.local-debug/logs/`.
- PIDs live under `.local-debug/pids/`. - PIDs live under `.local-debug/pids/`.
@@ -18,7 +18,7 @@ The workflow does not require Docker-only infrastructure, external cloud service
## Start ## Start
```bash ```bash
git clone git@git.npc0.com:admin343/run.git ../run # once, if the sibling checkout is missing git clone git@git.npc0.com:admin343/run.git run # once, if the ignored local checkout is missing
scripts/local-debug-start.sh scripts/local-debug-start.sh
``` ```
@@ -49,7 +49,7 @@ Key platform variables:
Key run variables: Key run variables:
- `RUN_REPO_DIR=../run` - `RUN_REPO_DIR=./run`
- `RUN_MODE=worker` - `RUN_MODE=worker`
- `RUN_PLATFORM_URL=http://127.0.0.1:18080` - `RUN_PLATFORM_URL=http://127.0.0.1:18080`
- `RUN_ENDPOINT_ID=run-local-debug` - `RUN_ENDPOINT_ID=run-local-debug`
@@ -162,7 +162,7 @@ The start script wraps these commands with the local debug environment:
```bash ```bash
(cd platform && go run ./cmd/platform) (cd platform && go run ./cmd/platform)
(cd "${RUN_REPO_DIR:-../run}" && go run ./cmd/run) (cd "${RUN_REPO_DIR:-./run}" && go run ./cmd/run)
npm --prefix platform_web run dev -- --port 5173 npm --prefix platform_web run dev -- --port 5173
``` ```
@@ -8,17 +8,17 @@ Browser-side code can still expose platform APIs for run endpoints, jobs, logs,
## Local Development ## Local Development
Local debug workflows use `RUN_REPO_DIR` to find an external run checkout. The default points to `../run`, matching a sibling clone beside this repository: Local debug workflows use `RUN_REPO_DIR` to find an external run checkout. The default points to `./run`, an ignored nested checkout inside this repository:
```bash ```bash
git clone git@git.npc0.com:admin343/run.git ../run git clone git@git.npc0.com:admin343/run.git run
``` ```
If `RUN_REPO_DIR` is missing or does not contain a run `go.mod`, local debug scripts fail with a clear message instead of assuming `browser/run`. If `RUN_REPO_DIR` is missing or does not contain a run `go.mod`, local debug scripts fail with a clear setup message.
## Docker Compose ## Docker Compose
The compose file keeps the run service for all-in-one local deployment, but its build context points at `${RUN_REPO_DIR:-../run}` and uses the external repository's `Dockerfile`. The compose file keeps the run service for all-in-one local deployment, but its build context points at `${RUN_REPO_DIR:-./run}` and uses the external repository's `Dockerfile`.
## Structure Validation ## Structure Validation
@@ -10,7 +10,7 @@ The browser repository SHALL NOT store the machine-side run executor source tree
#### Scenario: Local debug needs a run worker #### Scenario: Local debug needs a run worker
- **WHEN** a local debug or Docker workflow needs to start run - **WHEN** a local debug or Docker workflow needs to start run
- **THEN** it MUST locate run through `RUN_REPO_DIR` or a documented sibling checkout - **THEN** it MUST locate run through `RUN_REPO_DIR` or the documented ignored nested checkout
- **AND** it MUST fail with a clear setup message when the external checkout is missing - **AND** it MUST fail with a clear setup message when the external checkout is missing
#### Scenario: Structure validation runs #### Scenario: Structure validation runs
+2 -2
View File
@@ -21,7 +21,7 @@ export PLATFORM_METADATA_PATH="${PLATFORM_METADATA_PATH:-$PLATFORM_DATA_DIR/meta
export PLATFORM_LOG_BODY_BACKEND="${PLATFORM_LOG_BODY_BACKEND:-file}" export PLATFORM_LOG_BODY_BACKEND="${PLATFORM_LOG_BODY_BACKEND:-file}"
export PLATFORM_LOG_DIR="${PLATFORM_LOG_DIR:-$PLATFORM_DATA_DIR/logs}" export PLATFORM_LOG_DIR="${PLATFORM_LOG_DIR:-$PLATFORM_DATA_DIR/logs}"
export RUN_REPO_DIR="${RUN_REPO_DIR:-$LOCAL_DEBUG_ROOT_DIR/../run}" export RUN_REPO_DIR="${RUN_REPO_DIR:-$LOCAL_DEBUG_ROOT_DIR/run}"
export RUN_MODE="${RUN_MODE:-worker}" export RUN_MODE="${RUN_MODE:-worker}"
export RUN_PLATFORM_URL="${RUN_PLATFORM_URL:-http://127.0.0.1:$LOCAL_DEBUG_PLATFORM_PORT}" export RUN_PLATFORM_URL="${RUN_PLATFORM_URL:-http://127.0.0.1:$LOCAL_DEBUG_PLATFORM_PORT}"
export RUN_ENDPOINT_ID="${RUN_ENDPOINT_ID:-run-local-debug}" export RUN_ENDPOINT_ID="${RUN_ENDPOINT_ID:-run-local-debug}"
@@ -50,7 +50,7 @@ local_debug_web_url() {
ensure_local_run_repo() { ensure_local_run_repo() {
if [[ ! -f "$RUN_REPO_DIR/go.mod" ]]; then if [[ ! -f "$RUN_REPO_DIR/go.mod" ]]; then
printf 'run repo not found at %s\n' "$RUN_REPO_DIR" >&2 printf 'run repo not found at %s\n' "$RUN_REPO_DIR" >&2
printf 'clone git@git.npc0.com:admin343/run.git next to this repo or set RUN_REPO_DIR to the run checkout\n' >&2 printf 'clone git@git.npc0.com:admin343/run.git into this repo as ./run or set RUN_REPO_DIR to the run checkout\n' >&2
return 1 return 1
fi fi
} }