Admin Tools
Overview
Starnion provides CLI commands for server administrators to manage user accounts and database migrations directly from the terminal.
starnion users โ User Account Management
The starnion users command group accesses PostgreSQL directly to manage user accounts. No login required โ instead, a valid database connection must be configured in ~/.starnion/config.yaml.
List Users
starnion users list
Example output:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ USERS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ID EMAIL NAME ROLE CREATED
โโโโโโ โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโ โโโโโโโโโโ
a1b2c3 admin@example.com Admin admin 2024-01-15
d4e5f6 user@example.com John Doe user 2024-02-01
Total: 2 users
Add a New User
starnion users add \
--email user@example.com \
--password "StrongPassword123!" \
--name "John Doe"
# Grant admin privileges
starnion users add \
--email admin@example.com \
--password "AdminPass!" \
--name "System Admin" \
--admin
| Flag | Required | Description |
|---|---|---|
--email |
โ | Email address (must be unique) |
--password |
โ | Initial password |
--name |
โ | Display name |
--admin |
โ | Grant admin role (default: regular user) |
Remove a User
starnion users remove user@example.com
A confirmation prompt is shown. Type yes to proceed with deletion.
โ ๏ธ Warning: All data associated with the account โ conversations, memos, diary entries, etc. โ will be permanently deleted.
Reset Password
starnion users reset-password user@example.com
A secure prompt is displayed to enter the new password (input is hidden from the terminal).
starnion db โ Database Migrations
The starnion db command group manages the database schema version. It uses the schema_migrations table to track which migrations have been applied.
Apply Migrations
starnion db migrate
Runs all .sql files in gateway/internal/cli/migrations/incremental/ in filename order. Already-applied files are skipped.
Example output:
ยท v1.1.0-add-search-index.sql already applied
โ v1.2.0-add-usage-logs.sql applied
Migration complete: 1 applied, 1 skipped
Check Migration Status
starnion db status
Example output:
โโโโโโโโโโโโโโโโโโโโโโโโโโ MIGRATION STATUS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ v1.0.0 (baseline) [applied 2024-01-15 10:30:00]
โ v1.1.0-add-search-index [applied 2024-02-01 14:22:10]
ยท v1.2.0-add-usage-logs [pending]
Adding New Migration Files
- Create a
.sqlfile ingateway/internal/cli/migrations/incremental/ -
Use a version prefix โ filenames are executed in sort order:
v1.2.0-add-usage-logs.sql v1.2.1-add-audit-table.sql - Apply with
starnion db migrate - Verify with
starnion db status
Document Processing Queue (Background Queue)
Parsing and embedding large documents (โฅ 500 KB) is handled by a background queue to prevent gRPC handler timeouts.
How It Works
parse_document called
โ
File size check
โโโ < 500 KB โ process synchronously โ return result
โโโ โฅ 500 KB โ enqueue โ return task_id
โ
Background Workers (up to 2 concurrent)
โ
Docling parsing + embedding + DB storage
Check Status (AI Tool)
After uploading a large document, use the returned task_id to poll progress:
check_document_status('<task_id>')
Status values:
| Status | Meaning |
|---|---|
pending |
Waiting (not yet started) |
processing |
In progress (Docling parsing + embedding) |
done |
Complete (N sections stored in vector DB) |
error |
Failed (error message included) |
Configuration
# Number of concurrent workers (default: 2)
DOC_QUEUE_WORKERS=3
๐ก Docling is CPU-intensive. Setting too many workers can cause CPU contention and actually slow down processing.