Repository navigation
Come Home Postgres
Start a fresh nSelf project before importing. Postgres and Hasura must be healthy. Use a source running PostgreSQL 12 or later, with a major no newer than the target. Set POSTGRES_VERSION to the source major if needed before starting the target.
Put the source PostgreSQL URL in an environment variable using your secret manager. The URL must not appear in a command argument or shell history.
nself db import postgres --from-env SRC_URL --plan --json
nself db import postgres --from-env SRC_URL --jsonIn v1.4 mode the command is nself migrate postgres. In v1.5 mode it lives under
db import. The plan checks the source and target and writes no stage or report.
The command takes the project's operation lock, including during a plan.
The importer holds a repeatable-read source snapshot during extraction. Restore uses the target image, loads pre-data and data, then auth users and storage, then post-data constraints. Imported tables are tracked with additive Hasura metadata. Existing target user tables cause E519 before restore. Plugin tables named np_* and nSelf-owned schemas do not make a fresh target non-empty.
The result appears in the JSON envelope and in
.nself/import/<run-id>/report.json. A pass means every non-exempt row count,
content hash, user hash algorithm, object checksum, tracking record, permission,
relationship and independent source count matched. E523 means a mismatch; E522
means verification could not run. Treat either outcome as an incomplete import.
The private stage is removed after a pass. Use --keep-stage to retain the
integrity-checked portable bundle for inspection. Failed imports retain their
stage and report. The error hint (E521, E522 and E523) names the report path,
.nself/import/<run-id>/report.json, which lists every mismatch.
report.json records wrote (true once the target may have changed) and
last_step (the last finished load step). The error hint reads the same flag.
If wrote is false, nothing was written to the target. Fix the cause named in the
error and rerun; no reset is needed. This covers every refusal before the first
write: an unreachable or too-old source (E517, E518), extraction failures
(E520, including a partitioned source table, which is not supported yet), a
target that is not empty or whose auth.users already holds users (E519), a
missing object store (E529), another import already running on the target (E519),
a function or type in the bundle that the target already owns (E519), an archive
that does not match the bundle, and a metadata conflict found in the preflight
(E521). Each restore section runs in one transaction, so a failure inside a
section undoes that section; a failure in the first section (pre-data) when no
compat step ran therefore also leaves wrote false. --plan runs the same
bundle-free target checks (emptiness and, when the source has users, auth.users),
so a plan does not pass where the real run would be refused with E519.
If wrote is true, the load has no rollback beyond that: the target holds partial
data and a rerun is refused with E519. Reset the target project database and start
the stack again, then rerun the import:
nself db reset --yes
nself stop
nself start
nself db import postgres --from-env SRC_URL --jsondb reset drops and recreates the project database, so run it only on the fresh
target you were importing into.
Only one import runs on a target at a time; a second run is refused with E519
instead of waiting. A source database must be Postgres 12 or newer; the importer
reads server_version_num, so beta versions count by their major.
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
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