Repository navigation
Drills
A drill is a script that proves something about nSelf by doing it for real: install on a clean host, upgrade across a version, run an importer against a fixture. Drills are not a separate harness. They are jobs of the drills pipeline in .nself/ci.yaml, run by nself ci like any other job, on a schedule or on demand.
.nself/ci.yaml is committed (the rest of .nself/ stays ignored, see .gitignore):
pipelines:
drills:
triggers: [schedule, manual]
schedule: "30 2 * * *"
max_age: 36h
drills_dir: scripts/drill/legsEvery directory of scripts/drill/legs/ that holds an executable file called run is one job of kind drill, named drill-<directory>. The file's exit code is the result: 0 passes, anything else fails. The working directory is the repository root.
| Drill | Directory | What it does |
|---|---|---|
drill-two-command |
scripts/drill/legs/two-command/ |
Runs the Two-Command Drill (scripts/drill/two-command.sh --host) once with NSELF_V15 unset and once with NSELF_V15=1, and exits with that script's code. The drill, its legs and its budgets are not changed by the wrapper. |
drill-importers |
scripts/drill/legs/importers/ |
Reruns the six importer e2e scripts and the export round trip, one fixture at a time, and prints one evidence check per source. See Importers Drill. |
drill-clean-host |
scripts/drill/legs/clean-host/ |
The lifecycle of a new user: install, init, start, add a plugin, backup create, backup restore, with row equality on a seeded table. See Clean-host lifecycle. |
drill-upgrade-continuity |
scripts/drill/legs/upgrade-continuity/ |
A stack started by the latest released cli (N) is upgraded by nself update stack of the build from the ref (N+1) with the seeded rows unchanged. See Upgrade continuity. |
scripts/drill/legs/clean-host/run is the path a new user takes, on a clean directory and an empty HOME. It prints one ci.evidence/v1 document (one check per step) as its last stdout line and saves it as evidence.json. The first failed step marks the later steps skip.
| Step | What it proves |
|---|---|
install |
The cli under test (NSELF_BIN, or .nself/bin/nself built from the checkout) is copied into an empty bin directory that leads PATH, and nself version answers. |
init |
nself init in an empty directory with stdin closed: no prompt. |
start |
nself start, then nself status exit 0 and a GraphQL answer from Hasura. |
add-plugin |
nself add feature-flags installs the plugin bytes that plugins.nself.org serves (the cli checks the checksum), the plugin is listed [installed] and its plugin.json is under the throw-away HOME. Change the plugin with DRILL_PLUGIN. |
seed |
A Hasura-layout migration creates public.drill_seed with 50 rows and nself db migrate up applies it. The row count and an md5 of every row are recorded. |
backup |
nself backup create --tag drill, nself backup verify latest, and the backup is in nself backup list. |
restore |
The table is dropped (and checked gone), then nself backup restore latest --yes runs. |
rows-equal |
The restored table has the count and md5 recorded at seed. |
The plugin is installed, not started: building a plugin image is the job of the plugin checks, and this drill proves the install path and that the data survives a restore with a plugin present.
scripts/drill/legs/upgrade-continuity/run upgrades a running stack across versions. Version N is the latest GitHub release (downloaded from the /releases/latest/download/checksums.txt redirect and checked against its sha256, so it needs no API call or token; set DRILL_PREV_BIN to use a local binary). Version N+1 is the build from the ref. When the ref and the latest release are the same version the drill still runs and says so in the fetch-n excerpt.
| Step | What it proves |
|---|---|
fetch-n |
The release binary for this OS and CPU is downloaded and verified. Both versions are recorded in tool_versions. |
init-n, start-n
|
N creates and starts a healthy project (no prompt, status exit 0, GraphQL answers). |
seed |
As in the clean-host drill: 50 rows through a migration, count and md5 recorded. |
upgrade |
N+1 runs nself update stack --yes --json in the project; the report status is complete (backup, pull, build, start, migrate, readiness and health all ok). |
healthy |
After the upgrade nself status exits 0 and Hasura answers again. |
rows-identical |
The seeded table has the count and md5 recorded before the upgrade. |
The report of update stack is kept as update-stack.json next to the step logs. Consecutive nights of green are counted by the ship drill (P7-SHIP-03).
Both drills stop the stack with nself stop --volumes (and docker compose down -v) on every exit path, and run with a throw-away HOME. They need Docker with the compose plugin, jq and timeout; they print the reason and exit 2 when one is missing. Results land in .nself/drill-out/<leg>/ (<step>.log, evidence.json).
The stack's compose file publishes fixed host ports (5432, 8080, 4000, 80, 443) and nself-ci starts every drill job at once. The legs that start a stack (two-command, clean-host, upgrade-continuity) therefore take one host-wide lock, scripts/drill/stack-lock.sh (the directory /tmp/nself-drill-stack.lock, one path for every job; a lock whose holder process is gone is taken over). They run one after another; a waiting leg's job timeout keeps running, so the three together must finish within NSELF_CI_TIMEOUT; a waiting leg that reaches the cap reports a failure, not a skip (80 minutes in the nightly workflow, 120 for the job). A new leg that starts a stack sources the same file. DRILL_LOCK_TIMEOUT (default 3600 seconds) bounds the wait.
Each leg takes a few minutes on top of the image pulls. A run of the funnel without NSELF_CI_TIMEOUT needs it raised to at least 20 minutes per leg.
- Create
scripts/drill/legs/<name>/. The name starts with a letter or digit and uses only letters, digits,.,_and-. - Put an executable
runin it (chmod +x, committed with the execute bit). Any language works; a shebang line picks it. - Commit. The next run has a job
drill-<name>. You do not edit.nself/ci.yamlor the workflow.
A directory without a run, a run that is not executable, a symlink and loose files are ignored. A directory name that breaks the rule fails the pipeline with E640 rather than being skipped.
The job gets the default 10-minute timeout and only the allowlisted environment (PATH, HOME, TMPDIR, CI, the Go and Cargo variables, LC_*). NSELF_BIN and NSELF_V15 are not passed, so a leg that needs the cli takes it from .nself/bin/nself (built from the checkout when missing) and sets what it needs itself, as two-command/run does. The nightly workflow raises it to 80 minutes with --timeout 80m (the NSELF_CI_TIMEOUT variable alone does not reach discovered drill jobs); a drill can also define its own drill-<name> job in .nself/ci.yaml.
A drill with several steps may print one ci.evidence/v1 document as the last compact JSON line of its output; its failing checks are listed in the job's check.
nself-ci --pipeline drills # all drills, in name order
nself-ci --pipeline drills --json # one check per drill in the evidence
nself ci evidence --pipeline drills # overdue report (exit 10 when overdue)
The first two need Docker and take about as long as the Two-Command Drill (tens of minutes). Results of the two-command leg land in .nself/drill-out/<mode>/ (drill.json, perfbench.json, step logs).
.github/workflows/drill-nightly.yml runs the pipeline on a GitHub-hosted ubuntu-latest runner at 02:30 UTC, on workflow_dispatch, and on pull requests that touch scripts/drill/legs/**, .nself/ci.yaml or the workflow. It:
- builds
nselffrom the ref (.nself/bin/nself); - installs the
nself-cirelease pinned in the workflowenv(tag and linux-amd64 sha256, checked withsha256sum --check --strict; the binary is never built from the checkout); - runs
nself-ci --no-status --pipeline drills --json; - uploads
evidence.jsonas the artifactdrills-evidenceand.nself/drill-out/(the results of every leg, not only two-command) asdrills-two-command-results.
The job is named drills and allows 120 minutes. It has no secrets and a read-only token.
The drills above run on Linux with Docker. The platform matrix is split so that each runner does only what it can:
| Platform | What runs | Where |
|---|---|---|
| Linux | every drill leg, with Docker |
drill-nightly (ubuntu-latest) |
| Windows | Docker coverage = the Linux drills | Windows = WSL2 (owner answer 6c): Docker on Windows runs in WSL2, which is Linux, so WSL2 runs the same Linux drills and drill-nightly covers it |
| macOS, native Windows | the binary smoke below, no Docker |
drill-cross-platform (macos-latest, windows-2022) |
scripts/drill/cross-platform/run is not a drill leg: it sits outside scripts/drill/legs, because the drills pipeline of nself-ci cannot place a macOS or a Windows job. .github/workflows/drill-cross-platform.yml runs it directly, as job cross-platform with a matrix over the two hosted runners (free on this public repo). It runs at 02:45 UTC, on workflow_dispatch, and on pull requests that touch the script or the workflow. Per runner it:
- builds
nselffrom the ref with its ownGOOSand a version no release carries (0.0.0-smoke.<run id>); -
version:nself versionandnself version --jsonprint that version, andplatformnames the runner's OS; -
help-json:nself help --jsonparses and lists the verbs,initandstartamong them; -
init:nself initin an empty temp directory, stdin/dev/null, under a timeout (120 s), writes.envwithPROJECT_NAME. A prompt would hit end of input or the timeout and fail the step.
HOME, USERPROFILE, APPDATA and LOCALAPPDATA point at a throw-away directory, so nothing touches the runner's real home. Run it locally against any build: NSELF_BIN=./nself scripts/drill/cross-platform/run. Results (results.json, one log per step) are kept as the artifact cross-platform-<os>. Needs jq; no Docker, no secret.
A drill job is overdue when no passing, commit-bound run newer than max_age (36 hours) exists in the machine's run store. A throwaway runner keeps no store, so on GitHub a red run is the alert and a missing run (a schedule that stopped firing) is the staleness signal: check the Actions tab for drill-nightly. A runner-availability failure (image pull, runner start) is re-run, never counted as a pass. On a machine that keeps its run store, nself ci evidence --pipeline drills exits 10 and names the overdue drills.
To move the pinned nself-ci, change CI_VERSION, CI_RELEASE_URL and CI_RELEASE_SHA256 together in the workflow.
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