Skip to content

Commit a494593

Browse files
committed
docs: deployment guides, CHANGELOG, and env-var alignment
- Traditional / docker deployment guides with systemd + launchd notes - logrotate copytruncate sample for orb-server.log - ORB_ env-var prefix throughout (replacing legacy HF_ references) - CHANGELOG entries for orb-server.token, allow_destructive_admin, alembic migrations - API reference + user guide updates for new routers
1 parent c333b46 commit a494593

17 files changed

Lines changed: 386 additions & 120 deletions

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
<!-- insertion marker -->
99
## Unreleased
1010

11+
### BREAKING CHANGES
12+
13+
- **Daemon token file at `<work_dir>/server/orb-server.token`.**
14+
When `orb server start` is invoked (daemon or `--foreground` mode), a
15+
random bearer token is written to `<work_dir>/server/orb-server.token`
16+
with mode `0600`. The CLI reads this file to authenticate loopback admin
17+
requests such as `orb server reload`. The file is removed when the daemon
18+
exits. Operators who snapshot the work directory should exclude
19+
`*.token` from backups.
20+
21+
- **`allow_destructive_admin` config field (default `false`).**
22+
Administrative endpoints that can wipe state (purge, bulk-delete, etc.)
23+
now require `allow_destructive_admin: true` in the server config. The
24+
field defaults to `false` and must be opted in explicitly.
25+
26+
- **SQL storage strategy applies Alembic migrations on startup.**
27+
When `storage.strategy` is `sql`, the server now runs `alembic upgrade
28+
head` automatically on startup. Operators using a managed database
29+
(RDS, Aurora) should ensure the database user has DDL privileges, or run
30+
migrations out-of-band with `orb db upgrade` before starting the server
31+
with `allow_auto_migrate: false`.
32+
1133
### Added
1234

1335
- New `[aws]` extra (alias for AWS deps currently in core). The canonical install

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ The container supports multiple entry points:
330330
docker run --rm image --version
331331

332332
# API server
333-
docker run -p 8000:8000 image system serve
333+
docker run -p 8000:8000 image server start --foreground
334334

335335
# Health check
336336
docker run --rm image --health

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ See the [CLI Reference](docs/root/cli/cli-reference.md) for the full flag refere
229229
<details>
230230
<summary>REST API</summary>
231231

232-
Example API calls. Requires `pip install "orb-py[api]"` and `orb system serve`.
232+
Example API calls. Requires `pip install "orb-py[api]"` and `orb server start` (add `--foreground` for an in-shell variant).
233233

234234
```bash
235235
# Get available templates

docs/root/cli/cli-reference.md

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -612,23 +612,68 @@ orb system metrics [OPTIONS]
612612
|------|-------------|---------|
613613
| `--format` | Output format | `--format table` |
614614

615-
#### `system serve`
615+
### Server
616616

617-
Start REST API server.
617+
Process lifecycle for the local ORB daemon (REST API + optional embedded UI).
618+
`orb system *` is for **remote API observability** (status/health/metrics/reload of a
619+
running ORB). `orb server *` manages **the local process** itself.
620+
621+
#### `server start`
622+
623+
Start the ORB server. Daemonised by default; pass `--foreground` to keep it in
624+
the current shell (useful for containers, systemd `Type=simple`, and dev).
618625

619626
**Usage:**
620627
```bash
621-
orb system serve [OPTIONS]
628+
orb server start [OPTIONS]
622629
```
623630

624631
**Options:**
625632
| Flag | Description | Default | Example |
626633
|------|-------------|---------|---------|
627-
| `--host` | Server host | `0.0.0.0` | `--host localhost` |
628-
| `--port` | Server port | `8000` | `--port 9000` |
629-
| `--workers` | Number of workers | `1` | `--workers 4` |
630-
| `--reload` | Enable auto-reload | `false` | `--reload` |
631-
| `--server-log-level` | Server log level | `info` | `--server-log-level debug` |
634+
| `--foreground`, `-F` | Run in the foreground instead of daemonising | `false` | `--foreground` |
635+
| `--api-only` | Skip the embedded UI even if `ui.enabled=true` | `false` | `--api-only` |
636+
| `--host` | Server host (overrides config) | from config | `--host localhost` |
637+
| `--port` | Server port (overrides config) | from config | `--port 9000` |
638+
| `--workers` | Number of workers | from config | `--workers 4` |
639+
| `--reload` | Enable uvicorn auto-reload (dev only) | `false` | `--reload` |
640+
| `--server-log-level` | Server log level | from config | `--server-log-level debug` |
641+
| `--socket-path` | Unix domain socket path (alternative to host/port) | none | `--socket-path /tmp/orb.sock` |
642+
643+
#### `server stop`
644+
645+
Stop the running ORB server. Sends `SIGTERM`, waits up to the configured
646+
`stop_timeout_seconds`, then escalates to `SIGKILL`. The whole process group
647+
is signalled so the embedded Reflex tree (Node/Next included) terminates with
648+
the parent.
649+
650+
```bash
651+
orb server stop [--timeout N]
652+
```
653+
654+
#### `server status`
655+
656+
Report PID, liveness, and a best-effort `/health` probe.
657+
658+
```bash
659+
orb server status
660+
```
661+
662+
#### `server restart`
663+
664+
`stop` followed by `start`. Accepts the same flags as `start`.
665+
666+
#### `server reload`
667+
668+
Send `SIGHUP` to the running daemon.
669+
670+
#### `server logs`
671+
672+
Tail the daemon log file (`<log_dir>/orb-server.log` by default).
673+
674+
```bash
675+
orb server logs [-n LINES]
676+
```
632677

633678
### Config
634679

@@ -1447,5 +1492,5 @@ orb config validate
14471492
orb storage test --timeout 60
14481493
14491494
# Start API server for development
1450-
orb system serve --reload --port 9000
1495+
orb server start --foreground --reload --port 9000
14511496
```

docs/root/cli/provider-override.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ orb --provider aws-prod mcp serve --stdio
315315

316316
```bash
317317
# Start API server with provider override
318-
orb --provider aws-dev system serve --port 8000
318+
orb --provider aws-dev server start --foreground --port 8000
319319
```
320320

321321
### Batch Operations

docs/root/configuration-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ The consolidated configuration format provides comprehensive provider management
125125
},
126126
"logging": {
127127
"level": "INFO",
128-
"file_path": "logs/app.log",
128+
"file_path": "logs/orb.log",
129129
"console_enabled": true
130130
},
131131
"storage": {
@@ -424,7 +424,7 @@ export ORB_CIRCUIT_BREAKER__ENABLED=true
424424
export ORB_CIRCUIT_BREAKER__FAILURE_THRESHOLD=5
425425

426426
# Start the application
427-
orb system serve --port 8000
427+
orb server start --foreground --port 8000
428428
```
429429

430430
### Configuration Validation

docs/root/configuration/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ The scheduler configuration determines how the system interfaces with job schedu
611611
},
612612
"logging": {
613613
"level": "INFO",
614-
"file_path": "logs/app.log",
614+
"file_path": "logs/orb.log",
615615
"console_enabled": true
616616
}
617617
}

docs/root/deployment/monitoring.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The application exposes metrics for:
7373
"level": "INFO",
7474
"format": "json",
7575
"file_enabled": true,
76-
"file_path": "/app/logs/app.log",
76+
"file_path": "/app/logs/orb.log",
7777
"console_enabled": true
7878
}
7979
}
@@ -102,7 +102,7 @@ output.elasticsearch:
102102
```conf
103103
<source>
104104
@type tail
105-
path /app/logs/app.log
105+
path /app/logs/orb.log
106106
pos_file /var/log/fluentd/orb.log.pos
107107
tag orb.api
108108
format json

docs/root/deployment/readme.md

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ spec:
6565
ports:
6666
- containerPort: 8000
6767
env:
68-
- name: HF_SERVER_ENABLED
68+
- name: ORB_SERVER_ENABLED
6969
value: "true"
70-
- name: HF_AUTH_ENABLED
70+
- name: ORB_AUTH_ENABLED
7171
value: "true"
72-
- name: HF_AUTH_STRATEGY
72+
- name: ORB_AUTH_STRATEGY
7373
value: "bearer_token"
74-
- name: HF_AUTH_BEARER_SECRET_KEY
74+
- name: ORB_AUTH_BEARER_SECRET_KEY
7575
valueFrom:
7676
secretKeyRef:
7777
name: orb-secrets
@@ -108,7 +108,7 @@ gcloud run deploy orb-api \
108108
--image gcr.io/your-project/orb-api:latest \
109109
--platform managed \
110110
--region us-central1 \
111-
--set-env-vars HF_SERVER_ENABLED=true,HF_AUTH_ENABLED=true
111+
--set-env-vars ORB_SERVER_ENABLED=true,ORB_AUTH_ENABLED=true
112112
```
113113

114114
### [Server] Traditional Server Deployment
@@ -127,8 +127,11 @@ pip install -e .
127127
cp config/default_config.json config/production.json
128128
# Edit config/production.json
129129

130-
# Start server
131-
orb system serve --host 0.0.0.0 --port 8000 --config config/production.json
130+
# Start server (foreground)
131+
orb --config config/production.json server start --foreground --host 0.0.0.0 --port 8000
132+
133+
# Or daemonise (writes a PID file under <work_dir>/server/orb-server.pid)
134+
orb --config config/production.json server start --host 0.0.0.0 --port 8000
132135
```
133136

134137
#### Systemd Service
@@ -143,9 +146,9 @@ Type=simple
143146
User=orb
144147
Group=orb
145148
WorkingDirectory=/opt/orb
146-
Environment=HF_SERVER_ENABLED=true
147-
Environment=HF_AUTH_ENABLED=true
148-
ExecStart=/opt/orb/.venv/bin/python src/run.py system serve --config config/production.json
149+
Environment=ORB_SERVER_ENABLED=true
150+
Environment=ORB_AUTH_ENABLED=true
151+
ExecStart=/opt/orb/.venv/bin/orb --config config/production.json server start --foreground
149152
Restart=always
150153
RestartSec=10
151154

@@ -161,38 +164,38 @@ WantedBy=multi-user.target
161164

162165
```bash
163166
# Server Configuration
164-
HF_SERVER_ENABLED=true
165-
HF_SERVER_HOST=0.0.0.0
166-
HF_SERVER_PORT=8000
167-
HF_SERVER_WORKERS=4
168-
HF_SERVER_LOG_LEVEL=info
169-
HF_SERVER_DOCS_ENABLED=false # Disable in production
167+
ORB_SERVER_ENABLED=true
168+
ORB_SERVER_HOST=0.0.0.0
169+
ORB_SERVER_PORT=8000
170+
ORB_SERVER_WORKERS=4
171+
ORB_SERVER_LOG_LEVEL=info
172+
ORB_SERVER_DOCS_ENABLED=false # Disable in production
170173

171174
# Authentication Configuration
172-
HF_AUTH_ENABLED=true
173-
HF_AUTH_STRATEGY=bearer_token
174-
HF_AUTH_BEARER_SECRET_KEY=your-very-secure-secret-key
175-
HF_AUTH_BEARER_TOKEN_EXPIRY=3600
175+
ORB_AUTH_ENABLED=true
176+
ORB_AUTH_STRATEGY=bearer_token
177+
ORB_AUTH_BEARER_SECRET_KEY=your-very-secure-secret-key
178+
ORB_AUTH_BEARER_TOKEN_EXPIRY=3600
176179

177180
# AWS Provider Configuration
178-
HF_PROVIDER_TYPE=aws
179-
HF_PROVIDER_AWS_REGION=us-east-1
181+
ORB_PROVIDER_TYPE=aws
182+
ORB_PROVIDER_AWS_REGION=us-east-1
180183
AWS_ACCESS_KEY_ID=your-access-key
181184
AWS_SECRET_ACCESS_KEY=your-secret-key
182185

183186
# Storage Configuration
184-
HF_STORAGE_STRATEGY=json
185-
HF_STORAGE_BASE_PATH=/app/data
187+
ORB_STORAGE_STRATEGY=json
188+
ORB_STORAGE_BASE_PATH=/app/data
186189

187190
# Logging Configuration
188-
HF_LOGGING_LEVEL=INFO
189-
HF_LOGGING_CONSOLE_ENABLED=true
190-
HF_LOGGING_FILE_ENABLED=true
191-
HF_LOGGING_FILE_PATH=/app/logs/app.log
191+
ORB_LOGGING_LEVEL=INFO
192+
ORB_LOGGING_CONSOLE_ENABLED=true
193+
ORB_LOGGING_FILE_ENABLED=true
194+
ORB_LOGGING_FILE_PATH=/app/logs/orb.log
192195

193196
# Security Configuration
194-
HF_SERVER_REQUIRE_HTTPS=true
195-
HF_SERVER_TRUSTED_HOSTS=your-domain.com,api.your-domain.com
197+
ORB_SERVER_REQUIRE_HTTPS=true
198+
ORB_SERVER_TRUSTED_HOSTS=your-domain.com,api.your-domain.com
196199
```
197200

198201
### Configuration Files
@@ -217,7 +220,7 @@ services:
217220
secrets:
218221
- orb-jwt-secret
219222
environment:
220-
HF_AUTH_BEARER_SECRET_KEY_FILE: /run/secrets/orb-jwt-secret
223+
ORB_AUTH_BEARER_SECRET_KEY_FILE: /run/secrets/orb-jwt-secret
221224
```
222225

223226
#### Kubernetes Secrets
@@ -244,7 +247,7 @@ aws secretsmanager create-secret \
244247
{
245248
"secrets": [
246249
{
247-
"name": "HF_AUTH_BEARER_SECRET_KEY",
250+
"name": "ORB_AUTH_BEARER_SECRET_KEY",
248251
"valueFrom": "arn:aws:secretsmanager:region:account:secret:orb/jwt-secret"
249252
}
250253
]
@@ -255,11 +258,11 @@ aws secretsmanager create-secret \
255258

256259
### Production Security Checklist
257260

258-
- [ ] **Authentication enabled**: `HF_AUTH_ENABLED=true`
261+
- [ ] **Authentication enabled**: `ORB_AUTH_ENABLED=true`
259262
- [ ] **Strong JWT secret**: Use cryptographically secure random key
260-
- [ ] **HTTPS required**: `HF_SERVER_REQUIRE_HTTPS=true`
263+
- [ ] **HTTPS required**: `ORB_SERVER_REQUIRE_HTTPS=true`
261264
- [ ] **Trusted hosts configured**: Limit to your domains
262-
- [ ] **API docs disabled**: `HF_SERVER_DOCS_ENABLED=false`
265+
- [ ] **API docs disabled**: `ORB_SERVER_DOCS_ENABLED=false`
263266
- [ ] **Non-root execution**: Container runs as `orb` user
264267
- [ ] **Resource limits**: Set CPU and memory limits
265268
- [ ] **Network isolation**: Use private networks where possible
@@ -323,7 +326,7 @@ livenessProbe:
323326
{
324327
"logging": {
325328
"level": "INFO",
326-
"file_path": "/app/logs/app.log",
329+
"file_path": "/app/logs/orb.log",
327330
"console_enabled": true,
328331
"file_enabled": true,
329332
"max_file_size": "50MB",
@@ -441,7 +444,7 @@ docker exec -i orb-postgres psql -U orb orb < backup-20250107.sql
441444
docker logs container-name
442445

443446
# Check configuration
444-
docker exec container-name env | grep HF_
447+
docker exec container-name env | grep ORB_
445448

446449
# Test configuration
447450
docker run --rm -it orb-api:latest bash
@@ -456,7 +459,7 @@ docker stats
456459
curl http://localhost:8000/metrics
457460

458461
# Increase workers
459-
docker run -e HF_SERVER_WORKERS=4 orb-api:latest
462+
docker run -e ORB_SERVER_WORKERS=4 orb-api:latest
460463
```
461464

462465
**Authentication problems:**
@@ -476,7 +479,7 @@ print(config.get_typed(ServerConfig).auth.enabled)
476479

477480
```bash
478481
# Enable debug mode
479-
docker run -e HF_DEBUG=true -e HF_LOGGING_LEVEL=DEBUG orb-api:latest
482+
docker run -e ORB_DEBUG=true -e ORB_LOGGING_LEVEL=DEBUG orb-api:latest
480483

481484
# Interactive debugging
482485
docker run -it --rm orb-api:latest bash
@@ -501,11 +504,11 @@ resources:
501504
502505
```bash
503506
# Increase worker processes
504-
HF_SERVER_WORKERS=4
507+
ORB_SERVER_WORKERS=4
505508

506509
# Optimize for high concurrency
507-
HF_SERVER_WORKER_CLASS=uvicorn.workers.UvicornWorker
508-
HF_SERVER_WORKER_CONNECTIONS=1000
510+
ORB_SERVER_WORKER_CLASS=uvicorn.workers.UvicornWorker
511+
ORB_SERVER_WORKER_CONNECTIONS=1000
509512
```
510513

511514
## Migration Guide

0 commit comments

Comments
 (0)