CLI: Infrastructure
Infrastructure and operational commands for health checks, migrations, signing keys, configuration, and audit logs.
porta health
Check database and Redis connectivity.
# Via HTTP (requires running server)
porta health
# Direct database check (no server needed)
porta health --direct| Flag | Description |
|---|---|
--direct | Connect directly to DB and Redis instead of HTTP |
Output:
┌───────────┬──────────┐
│ Service │ Status │
├───────────┼──────────┤
│ Server │ ✅ OK │
│ Database │ ✅ OK │
│ Redis │ ✅ OK │
└───────────┴──────────┘Mode: Both (HTTP by default, direct with --direct)
porta migrate
Run database migrations using node-pg-migrate.
Mode: Direct DB
porta migrate up
porta migrate upApplies all pending migrations.
porta migrate down
porta migrate down [--count 1]Rolls back the specified number of migrations (default: 1).
porta migrate status
porta migrate statusShows the current migration status — which migrations have been applied and which are pending.
porta seed
Load development seed data.
Mode: Direct DB
porta seed runWARNING
Only use porta seed in development environments. It creates sample organizations, users, and clients with known credentials.
porta keys
Manage ES256 signing keys.
Mode: HTTP (requires porta login)
porta keys list
porta keys listporta keys generate
porta keys generateGenerates a new ES256 key pair.
porta keys rotate
porta keys rotateGenerates a new key and schedules the old key for retirement.
porta config
Manage system configuration values.
Mode: HTTP (requires porta login)
porta config list
porta config listShows all configuration entries. Sensitive values are masked.
porta config get
porta config get --key access_token_ttlporta config set
porta config set --key access_token_ttl --value 7200porta audit
View the audit log.
Mode: HTTP (requires porta login)
porta audit list
porta audit list \
[--action "organization.created"] \
[--entity-type organization] \
[--entity-id <id>] \
[--actor-id <id>] \
[--from "2024-01-01"] \
[--to "2024-01-31"] \
[--page 1] \
[--page-size 20]| Flag | Description |
|---|---|
--action | Filter by action type |
--entity-type | Filter by entity type |
--entity-id | Filter by entity ID |
--actor-id | Filter by actor ID |
--from | Start date (ISO 8601) |
--to | End date (ISO 8601) |
--page | Page number |
--page-size | Items per page |
porta audit cleanup
porta audit cleanupDeletes audit log entries older than the configured retention period. The retention period is controlled by the audit_retention_days system configuration key (set via porta config set).
# Set retention to 365 days, then clean up
porta config set --key audit_retention_days --value 365
porta audit cleanupOutput:
✅ Deleted 1,542 audit entries older than 365 days (cutoff: 2025-04-21)WARNING
Audit cleanup is irreversible. Ensure your retention period meets compliance requirements before running this command. Consider scheduling regular cleanup via cron or a Kubernetes CronJob.