Onboard a customer¶
Onboarding needs the customer's databases, their Neo4j role and a tier. Add a group to the policy, put the databases behind aliases, and take the first backup.
Add the group to the policy¶
-
Pick a tier. In the example policy,
goldtakes a daily full and hourly diffs.silvertakes a weekly full and 6-hourly diffs,bronzea weekly full and daily diffs. The diff interval is the most data a restore can lose. -
Grant the customer's role on the database. A restore copies these grants to the new database.
-
Add a group:
- id: shop profile: app-live # tier gold, 14 days; or data-interval, data-scratch, data-then-live aliases: [shop]Override profile values on the group (
retention_days: 30). -
Ship the policy. Dagster's
reconcile_registrysensor adds the targets within five minutes. Airflow picks them up at the next DAG parse. A new tier's schedules start stopped in Dagster; switch them on, or setschedules: runningin the policy.
Check, alias and take the first backup¶
Run the onboard prompt with the group and the policy file
(Claude Code: /mcp__neo4j-backup__onboard shop policies/prod.yaml). The agent:
- Checks the file with
validate_policyand shows the group's tier and retention withpolicy_show. -
Previews aliases with
preview_adoptand stops on aconflictormigrate. After the operator approves, it runsrun_adopt. -
Takes a full with
run_backup(kind="FULL"), thenrun_verify. - Confirms every member is
okincoverage_report.
neo4j-backup policy validate policies/prod.yaml # exit 0 valid, 2 invalid; no cluster needed
neo4j-backup policy show shop # effective settings and where each came from
neo4j-backup --json adopt shop --dry-run # then --confirm, if a member needs an alias
neo4j-backup backup shop --kind FULL
neo4j-backup verify shop
Materialize the group's backup partitions with kind FULL, then verify.
Trigger neo4j_backup_<tier>_full with {"group_id": "<group>"}, then neo4j_verify_<tier>.
Then send the customer their tier, their retention_days and the Customer guide.
A tenant: label on a customer's groups selects them all: backup --tenant acme, verify --tenant acme.
It selects only; Neo4j roles control access.
Adopt existing databases¶
adopt puts existing databases behind the group's aliases. Name the database when it differs from the alias:
- id: shop
profile: app-live
aliases: [shop]
overrides:
shop: {adopt_from: legacy-shop}
neo4j-backup --json adopt shop --dry-run # per member: create, skip, conflict, migrate
neo4j-backup --json adopt shop --confirm # CREATE ALIAS shop FOR DATABASE legacy-shop
Adopt only creates aliases. A conflict (alias points elsewhere) stops it.
MCP: preview_adopt, then run_adopt.
A database that already has the alias's name shows as migrate, since names and aliases share one namespace.
--migrate --replace moves it:
- Sets the database read-only (writes fail until step 4), then backs it up and verifies it.
- Seeds a new database from the backup, checks it and copies the privileges.
- Drops the original.
- Creates the alias with the old name for the new database.
Warning
Schedule this as an outage and try it on a copy first. A failure before step 3 sets the original read-write again.
Try a test group¶
Run the whole loop first on an unused database:
CREATE DATABASE `try-1` WAIT;
CREATE ALIAS `try` FOR DATABASE `try-1`;
- id: try # in the policy, on any tier
tier: gold
aliases: [try]
Back it up and verify it, then restore it and roll it back. Remove the group and drop the databases afterwards.