chore: remove legacy startup paths

This commit is contained in:
2026-04-03 13:45:57 +08:00
parent 2027635efe
commit dc0b250adc
36 changed files with 598 additions and 1923 deletions

View File

@@ -20,31 +20,19 @@ and the next-step execution plan lives at
| `backend.apps.trading_service` | `8001` | Read-only trading data APIs such as prices, financials, insider trades |
| `backend.apps.news_service` | `8002` | Read-only explain/news APIs such as story, similar days, range explain |
| `backend.apps.runtime_service` | `8003` | Runtime lifecycle APIs under `/api/runtime/*` |
| Gateway (`backend.main`) | `8765` | WebSocket feed, runtime event stream, pipeline execution |
| Gateway process | `8765` | WebSocket feed, runtime event stream, pipeline execution |
| OpenClaw Gateway | `18789` | External OpenClaw WebSocket endpoint consumed by 大时代 gateway |
## Runtime Modes
## Runtime Mode
### Standalone Mode (Direct Gateway Startup)
For simple deployments or backward compatibility:
```bash
python -m backend.main --mode live --host 0.0.0.0 --port 8765
```
In this mode, Gateway runs as the primary process with all components
(Pipeline, Market Service, Scheduler) loaded in-process.
### Microservice Mode (Recommended)
For development and production with service isolation:
For development and service isolation:
```bash
./start-dev.sh
```
This starts all services with `runtime_service` managing the Gateway lifecycle.
Today this script starts the split services and then relies on
`runtime_service` to spawn the Gateway during startup.
## What Runs By Default In Dev
@@ -60,11 +48,9 @@ That script starts:
- `trading_service` on `8001`
- `news_service` on `8002`
- `runtime_service` on `8003`
- 大时代 gateway on `8765` (as subprocess of runtime_service)
- 大时代 gateway on `8765` (spawned by `runtime_service`)
It does **not** start.
Instead, the gateway expects an OpenClaw WebSocket server to already be
It also expects an OpenClaw WebSocket server to already be
available at `ws://localhost:18789` unless you override the OpenClaw gateway
configuration outside the script.
@@ -79,8 +65,9 @@ python -m uvicorn backend.apps.news_service:app --host 0.0.0.0 --port 8002 --rel
python -m uvicorn backend.apps.runtime_service:app --host 0.0.0.0 --port 8003 --reload
```
The Gateway is started by `runtime_service` via the `/api/runtime/start` API,
not manually. To start a runtime:
If you launch only the split FastAPI surfaces manually, `runtime_service` can
start the Gateway via the `/api/runtime/start` API. To start a runtime in that
fully managed flow:
```bash
curl -X POST http://localhost:8003/api/runtime/start \
@@ -94,11 +81,6 @@ curl -X POST http://localhost:8003/api/runtime/start \
}'
```
Optional OpenClaw REST surface:
```bash
```
## Runtime Responsibilities
The runtime path is intentionally split:
@@ -159,7 +141,7 @@ architecture. Its responsibilities:
```
runtime_service (:8003)
|
|-- spawns --> Gateway subprocess (:8765)
|-- can spawn --> Gateway subprocess (:8765)
|
|-- TradingPipeline
|-- MarketService
@@ -167,8 +149,8 @@ runtime_service (:8003)
|-- WebSocket server
```
The Gateway subprocess runs `backend.gateway_server` module (not `backend.main`)
with run-specific configuration passed via CLI arguments.
The Gateway subprocess runs `backend.gateway_server` with run-specific
configuration passed by `runtime_service`.
## Environment Variables
@@ -221,13 +203,14 @@ Other flows still depend on the gateway WebSocket and control plane APIs.
## OpenClaw Integration Notes
There are two separate OpenClaw integration surfaces in this repo:
OpenClaw currently appears through two concrete access patterns in this repo:
- OpenClaw WebSocket gateway on `:18789`
- used directly by `backend/services/gateway.py`
- this is what `start-dev.sh` assumes exists
- optional REST facade over OpenClaw CLI-backed reads
- useful for typed client access and service-level testing
- selected CLI-backed read helpers behind gateway handlers
- used for a small set of history/status style reads
- not a separate standalone REST service surface
Do not treat those as interchangeable in docs or deployment config.
@@ -256,8 +239,6 @@ backend.apps.news_service
backend.gateway_server
└─ Gateway subprocess entry point (run-scoped)
backend.main
└─ standalone Gateway entry point (compatibility)
```
## Migration Boundaries
@@ -279,14 +260,14 @@ Also note the remaining naming split:
- Pipeline logic lives in Gateway process
- Gateway is spawned as subprocess by runtime_service
- Standalone mode (`backend.main`) preserved for compatibility
- Historical direct gateway startup has been removed from the repository
### Target State
- Pipeline stages become independent services
- Gateway becomes thin event router
- runtime_service becomes full orchestrator
- Standalone mode deprecated and removed
- Keep converging on the split-service startup model
See [docs/development-roadmap.md](../docs/development-roadmap.md) for detailed
phase planning.