Add dynamic analyst runtime updates and deployment guides

This commit is contained in:
2026-04-07 09:39:37 +08:00
parent 80ce63da5a
commit 62c7341cf6
45 changed files with 1886 additions and 159 deletions

47
deploy/systemd/README.md Normal file
View File

@@ -0,0 +1,47 @@
# systemd Units
This directory contains recommended `systemd` unit templates for the current
split-service production topology.
## Recommended Topology
- `agent_service` on `127.0.0.1:8000`
- `trading_service` on `127.0.0.1:8001`
- `news_service` on `127.0.0.1:8002`
- `runtime_service` on `127.0.0.1:8003`
- `nginx` serves `frontend/dist` and proxies `/api/*` + `/ws`
- `runtime_service` spawns the run-scoped Gateway subprocess on demand
- skill execution runs with `SKILL_SANDBOX_MODE=docker`
## Install
Adjust these placeholders before installing:
- `/opt/bigtime/app` -> repository root on the server
- `/opt/bigtime/app/.venv/bin/python` -> Python interpreter
- `/etc/bigtime/bigtime.env` -> shared environment file
- `bigtime` -> service user
Then copy units:
```bash
sudo mkdir -p /etc/bigtime
sudo cp .env /etc/bigtime/bigtime.env
sudo cp deploy/systemd/bigtime-*.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now bigtime-agent.service
sudo systemctl enable --now bigtime-trading.service
sudo systemctl enable --now bigtime-news.service
sudo systemctl enable --now bigtime-runtime.service
```
## Frontend
Recommended production frontend mode:
- build with `cd frontend && npm ci && npm run build`
- let `nginx` serve `frontend/dist` directly
The repository also contains `backend.apps.frontend_service`, but for
production the lower-complexity path is static hosting via `nginx`.

View File

@@ -0,0 +1,25 @@
[Unit]
Description=BigTime Agent Service
After=network.target
[Service]
Type=simple
User=bigtime
Group=bigtime
WorkingDirectory=/opt/bigtime/app
EnvironmentFile=/etc/bigtime/bigtime.env
ExecStart=/opt/bigtime/app/.venv/bin/python -m uvicorn backend.apps.agent_service:app --host 127.0.0.1 --port 8000 --workers 1 --log-level warning --no-access-log
Restart=always
RestartSec=3
TimeoutStopSec=20
KillMode=mixed
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
LimitNOFILE=65535
TasksMax=4096
MemoryMax=1024M
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,25 @@
[Unit]
Description=BigTime News Service
After=network.target
[Service]
Type=simple
User=bigtime
Group=bigtime
WorkingDirectory=/opt/bigtime/app
EnvironmentFile=/etc/bigtime/bigtime.env
ExecStart=/opt/bigtime/app/.venv/bin/python -m uvicorn backend.apps.news_service:app --host 127.0.0.1 --port 8002 --workers 1 --log-level warning --no-access-log
Restart=always
RestartSec=3
TimeoutStopSec=20
KillMode=mixed
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
LimitNOFILE=65535
TasksMax=4096
MemoryMax=768M
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,25 @@
[Unit]
Description=BigTime Runtime Service
After=network.target
[Service]
Type=simple
User=bigtime
Group=bigtime
WorkingDirectory=/opt/bigtime/app
EnvironmentFile=/etc/bigtime/bigtime.env
ExecStart=/opt/bigtime/app/.venv/bin/python -m uvicorn backend.apps.runtime_service:app --host 127.0.0.1 --port 8003 --workers 1 --log-level warning --no-access-log
Restart=always
RestartSec=3
TimeoutStopSec=30
KillMode=mixed
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
LimitNOFILE=65535
TasksMax=4096
MemoryMax=1536M
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,25 @@
[Unit]
Description=BigTime Trading Service
After=network.target
[Service]
Type=simple
User=bigtime
Group=bigtime
WorkingDirectory=/opt/bigtime/app
EnvironmentFile=/etc/bigtime/bigtime.env
ExecStart=/opt/bigtime/app/.venv/bin/python -m uvicorn backend.apps.trading_service:app --host 127.0.0.1 --port 8001 --workers 1 --log-level warning --no-access-log
Restart=always
RestartSec=3
TimeoutStopSec=20
KillMode=mixed
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
LimitNOFILE=65535
TasksMax=4096
MemoryMax=768M
[Install]
WantedBy=multi-user.target