Repository navigation
cmd deploy
Deploy the stack to a target environment (local, staging, production).
nself deploy <target> [flags]
nself deploy status [--env <target>]
nself deploy rollback [target]
nself deploy logs [target]
nself deploy health [target]
nself deploy check-access
nself deploy builds your stack and starts it against a target environment. It chains nself build and nself start, then applies strategy-aware orchestration for staging and production. When a deploy host is configured (NSELF_DEPLOY_HOST_STAGING, NSELF_DEPLOY_HOST_PROD), the CLI prepares the push step; otherwise it runs the stack on the current host.
Targets accept both short and long forms:
| Target | Accepts | Description |
|---|---|---|
| local | local |
Build and start on this machine |
| staging | staging |
Staging environment (uses NSELF_DEPLOY_HOST_STAGING if set) |
| prod |
prod, production
|
Production (uses NSELF_DEPLOY_HOST_PROD if set; requires --force or --dry-run) |
| Flag | Default | Description |
|---|---|---|
--strategy |
rolling |
Deploy strategy: rolling, blue-green, canary, preview
|
--dry-run |
false | Preview the deploy without executing |
--force |
false | Skip confirmation prompts (required for prod when not dry-run) |
--rolling |
false | Alias for --strategy=rolling
|
--skip-health |
false | Skip post-deploy health checks |
--include-frontends |
false | Include frontend apps in the deploy |
--exclude-frontends |
false | Exclude frontend apps from the deploy |
--json |
false | Emit structured JSON output |
--env |
— | Override target (alias for the positional argument) |
--help, -h
|
— | Show help |
-
nself deploy status— report current deploy state for a target -
nself deploy rollback [target]— roll back the last deployment by restoring the pre-promotion backup snapshot written bynself promote. Reads the most recent record from<projectDir>/.nself/promotions/and callsnself backup restoreagainst that snapshot. Returns a clear error if no promote history is found. -
nself deploy logs [target]— tail the last 200 lines of Docker logs on the target host -
nself deploy health [target]— runnself doctoragainst the deployment -
nself deploy check-access— verifyNSELF_DEPLOY_HOST_*values resolve
nself deploy rollback is wired to the last nself promote tag. Every nself promote <src> <target> call creates a backup snapshot tagged pre-promote-<target>-<unix> and saves a promotion record to .nself/promotions/<id>.json. Rollback reads the most recent record and restores that snapshot:
# After a failed or unwanted production promotion:
nself deploy rollback prod
# → Finds last pre-promote-prod-* backup tag
# → Runs: nself backup restore --tag pre-promote-prod-<ts>
# → Prints: Rollback for prod completed — prior promote state restoredWhen no promote history exists:
Error: rollback failed: find backup: no promotion records found
# Local build + start
nself deploy local
# Staging dry-run with JSON output
nself deploy staging --dry-run --json
# Production blue-green deploy
nself deploy production --strategy=blue-green --force
# Production with skipped health checks
nself deploy prod --force --skip-health
# Inspect a target
nself deploy status --env staging
# Roll back to the last promoted state
nself deploy rollback prodWhen --json is set, the command writes a structured result:
{
"target": "staging",
"strategy": "rolling",
"steps": [
{"name": "Build images", "status": "done"},
{"name": "Start stack", "status": "skipped"}
],
"durationMs": 1234,
"success": true
}Human output uses the same step vocabulary (done, failed, skipped, running, pending) inside [...] brackets so Admin's deploy API route can parse it without a separate protocol.
| Var | Purpose |
|---|---|
NSELF_DEPLOY_HOST_STAGING |
SSH/rsync target for staging pushes |
NSELF_DEPLOY_HOST_PROD |
SSH/rsync target for production pushes |
STAGING_DEPLOY_HOST |
Fallback alias (staging) |
PROD_DEPLOY_HOST |
Fallback alias (production) |
When no host is configured, the CLI runs the deploy on the current host. This matches the v0.9.x behaviour where deploys were triggered from a session on the target machine itself.
Production deploys without --force are rejected with a clear message. Use --dry-run first to preview steps on any target. Rollback for promotions is handled by nself promote rollback; the deploy rollback subcommand is a stub until the full rollback pipeline ships.
-
cmd-build — generates
docker-compose.ymland nginx configs - cmd-start — boot the stack with health checks
- cmd-promote — promote env-to-env with rollback support
- Home
Getting Started
Commands
- Commands, Overview
- Lifecycle: cmd-init · cmd-build · cmd-start · cmd-stop · cmd-restart · cmd-dev
- Monitoring: cmd-status · cmd-logs · cmd-health · cmd-urls · cmd-doctor · cmd-monitor · cmd-alerts · cmd-sentry · cmd-watchdog
- Data: cmd-db · cmd-backup · cmd-dr · cmd-queue · cmd-webhooks
- Config: cmd-config · cmd-service · cmd-env · cmd-promote
- Networking: cmd-ssl · cmd-trust · cmd-dns-setup
- Security: cmd-access · cmd-security · cmd-secrets
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license · cmd-dogfood (extracted, CLI-R11) · cmd-k8s (extracted, CLI-R11) · cmd-encryption (extracted, CLI-R11) · cmd-waf (extracted, CLI-R11) · cmd-federation (extracted, CLI-R11) · cmd-mail (extracted, CLI-R11) · cmd-dlq (extracted, CLI-R11)
- AI: cmd-ai · cmd-claw · cmd-model
- Templates: cmd-template
- Utilities: cmd-exec · cmd-clean · cmd-reset · cmd-update · cmd-upgrade · cmd-version · cmd-admin · cmd-migrate · cmd-migrate-firebase · cmd-migrate-supabase · cmd-completion
Features
- Features, Overview
- Feature-Auth
- Feature-Storage
- Feature-Search
- Feature-Functions
- Feature-Email
- Feature-Monitoring
- Feature-Plugins
- Feature-nClaw, AI Assistant
- Feature-nChat, Messaging
- Feature-nFamily, Family Social
- Feature-nCloud, Managed Hosting
- Feature-Memory-Rooms, Knowledge Organization
- Feature-Agent-Dashboard, Agent Metrics
- Feature-Image-Generation, AI Image Generation
Configuration
- Configuration, Overview
- Config-Env-Vars
- Config-Postgres
- Config-Hasura
- Config-Auth
- Config-Nginx
- Shared-Proxy
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
- Plugin-Overview
- Plugin-Catalog
- Plugin-Install
- Plugin-Licensing
- Plugin-Architecture
- Plugin-Dev-Guide
- Plugin-Migrations-Contract
Free (25)
- plugin-backup
- plugin-content-acquisition
- plugin-content-progress
- plugin-cron
- plugin-donorbox
- plugin-feature-flags
- plugin-github
- plugin-github-runner
- plugin-invitations
- plugin-jobs
- plugin-link-preview
- plugin-mdns
- plugin-mlflow
- plugin-monitoring
- plugin-notifications
- plugin-notify
- plugin-paypal
- plugin-search
- plugin-shopify
- plugin-stripe
- plugin-subtitle-manager
- plugin-tokens
- plugin-torrent-manager
- plugin-vpn
- plugin-webhooks
Pro (62)
- plugin-access-controls
- plugin-activity-feed
- plugin-admin-api
- plugin-analytics
- plugin-auth
- plugin-bots
- plugin-browser
- plugin-calendar
- plugin-cdn
- plugin-chat
- plugin-claw
- plugin-claw-budget
- plugin-claw-news
- plugin-claw-web
- plugin-cloudflare
- plugin-cms
- plugin-compliance
- plugin-ddns
- plugin-devices
- plugin-documents
- plugin-entitlements
- plugin-file-processing
- plugin-game-metadata
- plugin-geocoding
- plugin-geolocation
- plugin-google
- plugin-home
- plugin-idme
- plugin-knowledge-base
- plugin-linkedin
- plugin-livekit
- plugin-media-processing
- plugin-meetings
- plugin-moderation
- plugin-mux
- plugin-object-storage
- plugin-observability
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-social
- plugin-sports
- plugin-support
- plugin-tmdb
- plugin-voice
- plugin-web3
- plugin-workflows
Planned (26)
plugin-auditplugin-blogplugin-checkoutplugin-commerceplugin-drmplugin-exportplugin-flowplugin-importplugin-ldapplugin-mailgunplugin-mediaplugin-oauth-providersplugin-pagesplugin-postmarkplugin-rate-limitplugin-reportsplugin-samlplugin-schedulerplugin-sendgridplugin-ssoplugin-subscriptionplugin-thumbplugin-transcoderplugin-twilioplugin-wafplugin-watermark
Guides
- Guide-Production-Deployment
- Guide-SSL-Setup
- Guide-Multi-Tenancy
- Guide-Security-Hardening
- Guide-Monitoring-Setup
- Guide-Backup-Restore
- Guide-Custom-Services
- Guide-Migration-from-v1
- Guide-Agents-MCP
- Guide-CI-CD
- Guide-SDK
Architecture
- Architecture
- Architecture-Guardrails
- Service-Graph
- Compose-Generation
- Nginx-Generation
- Plugin-Architecture
Reference
Machine interface
-
JSON-Output,
--jsonenvelope -
Command-Registry,
nself help --json - Exit-Codes
- error-codes, Error Codes
-
Compat-V15,
NSELF_V15gate
Licensing
Security
Brand
Operations
- operations/release-cascade, Release Cascade
- operations/self-healing, Self-Healing Schema
- operations/redis-tuning, Redis Pool Tuning
- operations/meilisearch-warmup, MeiliSearch Warm-Up
- operations/jwt-rotation, JWT Key Rotation
- operations/windows-wsl2-setup, Windows / WSL2 Setup
- operations/gemini-oauth-reauth, Gemini OAuth Reauth
Contributing
Admin
- USER-ACTION-QUEUE, Pending Admin Actions
All commands (21)
- A: cmd-add · cmd-admin
- B: cmd-backup · cmd-build
- C: cmd-clean · cmd-config
- D: cmd-db · cmd-deploy · cmd-doctor
- E: cmd-exec
- I: cmd-init
- L: cmd-license · cmd-logs
- M: cmd-mcp
- R: cmd-remove · cmd-reset · cmd-restart
- S: cmd-start · cmd-status · cmd-stop
- U: cmd-update