Checked on Izumi 0.5.7, 2026-11-21: ./tb backup, the monthly restore check and ./tb restore live on a throwaway stack (Docker Desktop, Mac, arm64), and the nightly backup and file ownership on production by reading.The backup service makes an encrypted copy of the whole database every night. This page describes what is kept, how to take a copy right now, how to check every month that a copy restores, and how to restore an install.
Not checked live yet: the nightly run at the scheduled hour, TB_BACKUP_REMOTE, restoring on a different server, and the behavior with root as the owner (on the throwaway stack the files belong to the Mac user, so sudo was not needed). Run live and passed: ./tb backup (file and manifest, mode 0600), ./tb status with the age of the copy, scripts/ops/restore-test.sh --from (every check after the restore passed, a corrupted copy refused at the decrypt step, a second restore refused with exit 3) and ./tb restore over a deleted database (11 steps, check passed, /readyz 200).
What gets made
Every night at TB_BACKUP_HOUR:00 (time from TZ, by default 2 o’clock in Europe/Belgrade) the backup service runs pg_dump -Fc as the superuser, encrypts the output with the key TB_BACKUP_KEY (gpg, AES256) and writes TB_BACKUP_DIR/daily/tb-<UTC time>-<version>.dump.gpg with <file>.manifest.json next to it (row count per table, no data).
The first backup of a month is also kept in monthly/. 14 daily and 6 monthly copies remain.
With TB_BACKUP_REMOTE every file is also copied there and rotated the same way.
A failed night leaves no file: the next night tries again. If only the copy to TB_BACKUP_REMOTE fails, the local file stays.
This was verified on Izumi production (2026-11-21): daily/ holds pairs like tb-20261121T010001Z-0.5.7.dump.gpg and .manifest.json (14 copies and 14 manifests), monthly/ exists, and TB_BACKUP_REMOTE is not set.
A copy right now and the age check
./tb backup # one copy now; prints the file./tb status # shows the age of the last copy
The files are owned by root with mode 0600, and the folders have mode 0700. Reading, listing and copying need root or sudo: sudo ls -l backups/daily.
Set an alarm for a copy older than one day, see Monitoring.
Keys
TB_MASTER_KEY is never in the backup or in the backup service. A full recovery needs both keys: TB_BACKUP_KEY (to decrypt the file) and TB_MASTER_KEY (to read the company keys inside it).
Keep a copy of each key off the server, in two different places (for example two entries in a password manager that different people can open). Never next to the backup and never in TB_BACKUP_REMOTE. Losing either key loses the backups.
Copy backups off the server: mount a remote directory and set TB_BACKUP_REMOTE, or copy backups/ with your own tool (as root). A backup on the same disk does not survive losing the server.
Monthly restore check
Once a month restore the newest copy into a trial stack. The script scripts/ops/restore-test.sh --from <file> starts a temporary project tbp4-restore-b (ports 18082 and 18092, image team-brain:tbp4-restore), restores the file with the keys from the install’s env file, runs the after-restore check (row counts against the manifest, the security catalog, no identity sees anything) and removes the trial stack. The install is not touched.
The docker tag line makes the trial stack use the image of the release the install runs, so the script builds nothing. Without internet it is required: building the image downloads npm packages and fails.
Exit 0 and a result file mean the copy restores.
The trial stack starts a second embedder. On a server with 8 GB run the test in a quiet hour, or on another machine with a copy of the backup and both keys. On the throwaway stack the install’s own embedder was stopped for the test, because two embedders do not fit in 8 GB.
Restore
./tb restore <file> restores a copy into an empty stack.
It refuses (exit 3, nothing changes) when tb.company or tb_audit.log have rows.
The manifest must be next to the file.
The steps are printed, and an error names the step: it starts db, checks that the stack is empty, stops app, worker and backup, decrypts and verifies the file (a wrong key or a damaged file stops here), creates the database and roles again as in a new install, runs pg_restore, runs migrate, brings the stack up as docker compose up -d (without the worker), waits for /healthz, runs the after-restore check and only then starts worker and waits for /readyz.
The worker stays off until the check passes: the restored copy holds a live Google refresh token and would otherwise sync the real Drive and change the counts the check compares. If the check fails, the worker stays stopped.
sudo is needed because the backup folders belong to root. sudo drops the variables of your shell: with another directory name run sudo TB_COMPOSE_PROJECT=team-brain ./tb restore <file>.
On a new server first install as in Install with the old TB_MASTER_KEY and TB_BACKUP_KEY in .env (new role passwords are fine), copy the backup and manifest there, then run ./tb restore <file> while the stack is empty.
Limits
Restoring without the old TB_MASTER_KEY brings back the rows, but the company keys cannot be unwrapped.
./tb restore works only on an empty stack.
A backup on the same disk does not protect against losing the server: copy it off the server.
A backup grows with the number of text chunks. The pilot corpus of 43 documents gives a 1.1 MB backup (from the guide, not measured in this check).
Troubleshooting
What you see
What to check
./tb backup fails
TB_BACKUP_KEY is not in .env, or pg_dump or gpg failed (see the command output). A manual backup does not need the backup service to run.
The last copy is older than a day
Look at docker compose logs backup. A failed night leaves no file.
./tb restore says the file does not exist
You ran it without sudo: the folders belong to root.
./tb restore exit 3
The stack is not empty. Remove the database volume as above.
Restore stops at decryption
Wrong TB_BACKUP_KEY or a damaged file.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Izumi","colors":{"primary":"#ff6b35","light":"#ff6b35","dark":"#0b0c0e"},"logo":{"light":"https://mintcdn.com/akia-consulting/-l5XLI7ftc2U1SZX/logo/light.svg?fit=max\u0026auto=format\u0026n=-l5XLI7ftc2U1SZX\u0026q=85\u0026s=96af7cf3d62f98290e82d9b350a9e3f9","dark":"https://mintcdn.com/akia-consulting/-l5XLI7ftc2U1SZX/logo/dark.svg?fit=max\u0026auto=format\u0026n=-l5XLI7ftc2U1SZX\u0026q=85\u0026s=c30d00f6d1a891b28bff5b756eb7e523","href":"https://izumi.akiaconsulting.com"},"favicon":"https://mintcdn.com/akia-consulting/UfDKk95B0JApANc6/favicon.svg?fit=max\u0026auto=format\u0026n=UfDKk95B0JApANc6\u0026q=85\u0026s=a74575c718248bf0aceb8785ebfd9868","navbar":{"primary":{"type":"button","label":"Prijava / Sign in","href":"https://izumi.akiaconsulting.com"}},"footer":{"links":[{"header":"Izumi","items":[{"label":"izumi.akiaconsulting.com","href":"https://izumi.akiaconsulting.com"},{"label":"Akia Consulting","href":"https://akiaconsulting.com"}]}]},"search":{"prompt":"Pretraga / Search..."},"seo":{"metatags":{"canonical":"https://docs.izumi.akiaconsulting.com"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"akia-consulting","hasAudioNarration":false,"actualSubdomain":"akia-consulting","customDomains":["docs.izumi.akiaconsulting.com"],"gitSource":{"type":"github","owner":"vuuribica","repo":"izumi-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":"","_id":"6b004ee7d53e418143901602"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b01968c0d13a27bf2848752","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"default","tag":"Installation","count":11},{"language":"default","tag":"Setting up","count":11},{"language":"default","tag":"Instalacija","count":11},{"language":"default","tag":"Postavljanje","count":11},{"language":"default","tag":"Administration","count":9},{"language":"default","tag":"Managing","count":9},{"language":"default","tag":"Administracija","count":9},{"language":"default","tag":"Upravljanje","count":9},{"language":"default","tag":"Using Izumi","count":8},{"language":"default","tag":"Everyday use","count":8}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"en/install/backup","slug":"/en/install/backup","pageMetadata":{"title":"Backup and restore","description":"How to take and restore a backup.","href":"/en/install/backup"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"How to take and restore a backup.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Checked on Izumi 0.5.7, 2026-11-21: `,_jsx(_components.code,{children:`./tb backup`}),`, the monthly restore check and `,_jsx(_components.code,{children:`./tb restore`}),` live on a throwaway stack (Docker Desktop, Mac, arm64), and the nightly backup and file ownership on production by reading.`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`backup`}),` service makes an encrypted copy of the whole database every night. This page describes what is kept, how to take a copy right now, how to check every month that a copy restores, and how to restore an install.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Not checked live yet: the nightly run at the scheduled hour, `,_jsx(_components.code,{children:`TB_BACKUP_REMOTE`}),`, restoring on a different server, and the behavior with root as the owner (on the throwaway stack the files belong to the Mac user, so `,_jsx(_components.code,{children:`sudo`}),` was not needed). Run live and passed: `,_jsx(_components.code,{children:`./tb backup`}),` (file and manifest, mode 0600), `,_jsx(_components.code,{children:`./tb status`}),` with the age of the copy, `,_jsx(_components.code,{children:`scripts/ops/restore-test.sh --from`}),` (every check after the restore passed, a corrupted copy refused at the decrypt step, a second restore refused with exit 3) and `,_jsx(_components.code,{children:`./tb restore`}),` over a deleted database (11 steps, check passed, `,_jsx(_components.code,{children:`/readyz`}),` 200).`]})}),`\n`,_jsx(Heading,{level:`2`,id:`what-gets-made`,children:`What gets made`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Every night at `,_jsx(_components.code,{children:`TB_BACKUP_HOUR:00`}),` (time from `,_jsx(_components.code,{children:`TZ`}),`, by default 2 o’clock in `,_jsx(_components.code,{children:`Europe/Belgrade`}),`) the `,_jsx(_components.code,{children:`backup`}),` service runs `,_jsx(_components.code,{children:`pg_dump -Fc`}),` as the superuser, encrypts the output with the key `,_jsx(_components.code,{children:`TB_BACKUP_KEY`}),` (gpg, AES256) and writes `,_jsx(_components.code,{children:`TB_BACKUP_DIR/daily/tb-\u003cUTC time>-\u003cversion>.dump.gpg`}),` with `,_jsx(_components.code,{children:`\u003cfile>.manifest.json`}),` next to it (row count per table, no data).`]}),`\n`,_jsxs(_components.li,{children:[`The first backup of a month is also kept in `,_jsx(_components.code,{children:`monthly/`}),`. 14 daily and 6 monthly copies remain.`]}),`\n`,_jsxs(_components.li,{children:[`With `,_jsx(_components.code,{children:`TB_BACKUP_REMOTE`}),` every file is also copied there and rotated the same way.`]}),`\n`,_jsxs(_components.li,{children:[`A failed night leaves no file: the next night tries again. If only the copy to `,_jsx(_components.code,{children:`TB_BACKUP_REMOTE`}),` fails, the local file stays.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`This was verified on Izumi production (2026-11-21): `,_jsx(_components.code,{children:`daily/`}),` holds pairs like `,_jsx(_components.code,{children:`tb-20261121T010001Z-0.5.7.dump.gpg`}),` and `,_jsx(_components.code,{children:`.manifest.json`}),` (14 copies and 14 manifests), `,_jsx(_components.code,{children:`monthly/`}),` exists, and `,_jsx(_components.code,{children:`TB_BACKUP_REMOTE`}),` is not set.`]}),`\n`,_jsx(Heading,{level:`2`,id:`a-copy-right-now-and-the-age-check`,children:`A copy right now and the age check`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`./tb backup # one copy now; prints the file`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`./tb status # shows the age of the last copy`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The files are owned by root with mode 0600, and the folders have mode 0700. Reading, listing and copying need root or `,_jsx(_components.code,{children:`sudo`}),`: `,_jsx(_components.code,{children:`sudo ls -l backups/daily`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Set an alarm for a copy older than one day, see `,_jsx(_components.a,{href:`/en/install/monitoring`,children:`Monitoring`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`keys`,children:`Keys`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`TB_MASTER_KEY`}),` is never in the backup or in the `,_jsx(_components.code,{children:`backup`}),` service. A full recovery needs both keys: `,_jsx(_components.code,{children:`TB_BACKUP_KEY`}),` (to decrypt the file) and `,_jsx(_components.code,{children:`TB_MASTER_KEY`}),` (to read the company keys inside it).`]}),`\n`,_jsxs(_components.li,{children:[`Keep a copy of each key off the server, in two different places (for example two entries in a password manager that different people can open). Never next to the backup and never in `,_jsx(_components.code,{children:`TB_BACKUP_REMOTE`}),`. Losing either key loses the backups.`]}),`\n`,_jsxs(_components.li,{children:[`Copy backups off the server: mount a remote directory and set `,_jsx(_components.code,{children:`TB_BACKUP_REMOTE`}),`, or copy `,_jsx(_components.code,{children:`backups/`}),` with your own tool (as root). A backup on the same disk does not survive losing the server.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`monthly-restore-check`,children:`Monthly restore check`}),`\n`,_jsxs(_components.p,{children:[`Once a month restore the newest copy into a trial stack. The script `,_jsx(_components.code,{children:`scripts/ops/restore-test.sh --from \u003cfile>`}),` starts a temporary project `,_jsx(_components.code,{children:`tbp4-restore-b`}),` (ports 18082 and 18092, image `,_jsx(_components.code,{children:`team-brain:tbp4-restore`}),`), restores the file with the keys from the install’s env file, runs the after-restore check (row counts against the manifest, the security catalog, no identity sees anything) and removes the trial stack. The install is not touched.`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`8`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`tag=$(sed -n 's/^TB_IMAGE_TAG=//p' .env | tail -n 1) # the release the install runs`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`docker tag \"team-brain:$tag\" team-brain:tbp4-restore`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`mkdir -p ~/restore-test`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`sudo cp backups/daily/tb-\u003ctime>-\u003cversion>.dump.gpg backups/daily/tb-\u003ctime>-\u003cversion>.dump.gpg.manifest.json ~/restore-test/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`sudo chown \"$USER\" ~/restore-test/*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`scripts/ops/restore-test.sh --from ~/restore-test/tb-\u003ctime>-\u003cversion>.dump.gpg --env .env --out ~/restore-test/result-$(date +%F).md`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`rm ~/restore-test/*.dump.gpg`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The `,_jsx(_components.code,{children:`docker tag`}),` line makes the trial stack use the image of the release the install runs, so the script builds nothing. Without internet it is required: building the image downloads npm packages and fails.`]}),`\n`,_jsx(_components.li,{children:`Exit 0 and a result file mean the copy restores.`}),`\n`,_jsx(_components.li,{children:`The trial stack starts a second embedder. On a server with 8 GB run the test in a quiet hour, or on another machine with a copy of the backup and both keys. On the throwaway stack the install’s own embedder was stopped for the test, because two embedders do not fit in 8 GB.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`restore`,children:`Restore`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`./tb restore \u003cfile>`}),` restores a copy into an empty stack.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`It refuses (exit 3, nothing changes) when `,_jsx(_components.code,{children:`tb.company`}),` or `,_jsx(_components.code,{children:`tb_audit.log`}),` have rows.`]}),`\n`,_jsx(_components.li,{children:`The manifest must be next to the file.`}),`\n`,_jsxs(_components.li,{children:[`The steps are printed, and an error names the step: it starts `,_jsx(_components.code,{children:`db`}),`, checks that the stack is empty, stops `,_jsx(_components.code,{children:`app`}),`, `,_jsx(_components.code,{children:`worker`}),` and `,_jsx(_components.code,{children:`backup`}),`, decrypts and verifies the file (a wrong key or a damaged file stops here), creates the database and roles again as in a new install, runs `,_jsx(_components.code,{children:`pg_restore`}),`, runs `,_jsx(_components.code,{children:`migrate`}),`, brings the stack up as `,_jsx(_components.code,{children:`docker compose up -d`}),` (without the worker), waits for `,_jsx(_components.code,{children:`/healthz`}),`, runs the after-restore check and only then starts `,_jsx(_components.code,{children:`worker`}),` and waits for `,_jsx(_components.code,{children:`/readyz`}),`.`]}),`\n`,_jsx(_components.li,{children:`The worker stays off until the check passes: the restored copy holds a live Google refresh token and would otherwise sync the real Drive and change the counts the check compares. If the check fails, the worker stays stopped.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Restoring over a broken install:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`docker compose down`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`docker volume rm team-brain_db-data`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`sudo ./tb restore backups/daily/tb-\u003ctime>-\u003cversion>.dump.gpg`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`sudo`}),` is needed because the backup folders belong to root. `,_jsx(_components.code,{children:`sudo`}),` drops the variables of your shell: with another directory name run `,_jsx(_components.code,{children:`sudo TB_COMPOSE_PROJECT=team-brain ./tb restore \u003cfile>`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`On a new server first install as in `,_jsx(_components.a,{href:`/en/install/install`,children:`Install`}),` with the old `,_jsx(_components.code,{children:`TB_MASTER_KEY`}),` and `,_jsx(_components.code,{children:`TB_BACKUP_KEY`}),` in `,_jsx(_components.code,{children:`.env`}),` (new role passwords are fine), copy the backup and manifest there, then run `,_jsx(_components.code,{children:`./tb restore \u003cfile>`}),` while the stack is empty.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`limits`,children:`Limits`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Restoring without the old `,_jsx(_components.code,{children:`TB_MASTER_KEY`}),` brings back the rows, but the company keys cannot be unwrapped.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`./tb restore`}),` works only on an empty stack.`]}),`\n`,_jsx(_components.li,{children:`A backup on the same disk does not protect against losing the server: copy it off the server.`}),`\n`,_jsx(_components.li,{children:`A backup grows with the number of text chunks. The pilot corpus of 43 documents gives a 1.1 MB backup (from the guide, not measured in this check).`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`troubleshooting`,children:`Troubleshooting`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`What you see`}),_jsx(_components.th,{children:`What to check`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`./tb backup`}),` fails`]}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`TB_BACKUP_KEY`}),` is not in `,_jsx(_components.code,{children:`.env`}),`, or `,_jsx(_components.code,{children:`pg_dump`}),` or gpg failed (see the command output). A manual backup does not need the `,_jsx(_components.code,{children:`backup`}),` service to run.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`The last copy is older than a day`}),_jsxs(_components.td,{children:[`Look at `,_jsx(_components.code,{children:`docker compose logs backup`}),`. A failed night leaves no file.`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`./tb restore`}),` says the file does not exist`]}),_jsxs(_components.td,{children:[`You ran it without `,_jsx(_components.code,{children:`sudo`}),`: the folders belong to root.`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`./tb restore`}),` exit 3`]}),_jsx(_components.td,{children:`The stack is not empty. Remove the database volume as above.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Restore stops at decryption`}),_jsxs(_components.td,{children:[`Wrong `,_jsx(_components.code,{children:`TB_BACKUP_KEY`}),` or a damaged file.`]})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Backup and restore","description":"How to take and restore a backup.","href":"/en/install/backup"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"What gets made","slug":"what-gets-made","depth":2,"children":[]},{"title":"A copy right now and the age check","slug":"a-copy-right-now-and-the-age-check","depth":2,"children":[]},{"title":"Keys","slug":"keys","depth":2,"children":[]},{"title":"Monthly restore check","slug":"monthly-restore-check","depth":2,"children":[]},{"title":"Restore","slug":"restore","depth":2,"children":[]},{"title":"Limits","slug":"limits","depth":2,"children":[]},{"title":"Troubleshooting","slug":"troubleshooting","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"akia-consulting","siteName":"Izumi","title":"Backup and restore - Izumi","navMaps":{"firstHrefInVersion":{"Srpski":{"href":"/sr/upoznaj/sta-je-izumi","matchLevel":4},"English":{"href":"/en/install/backup","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-11-21T12:41:29.962Z","originalFileLocation":"en/install/backup.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"How to take and restore a backup.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Izumi\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Backup and restore - Izumi\">\u003cmeta data-mint-head property=\"og:description\" content=\"How to take and restore a backup.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Izumi\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.izumi.akiaconsulting.com/en/install/backup\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://akia-consulting.mintlify.site/_mintlify/api/og/v2?division=Setting+up\u0026amp;title=Backup+and+restore\u0026amp;description=How+to+take+and+restore+a+backup.\u0026amp;theme=12c8ef4e20932cca09adf228\u0026amp;signature=3c7179b5f59ee4ed0944452e3a8bcd8ccaae3d57b287b4b11a9aa47e4119b6c0\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Backup and restore - Izumi\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How to take and restore a backup.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://akia-consulting.mintlify.site/_mintlify/api/og/v2?division=Setting+up\u0026amp;title=Backup+and+restore\u0026amp;description=How+to+take+and+restore+a+backup.\u0026amp;theme=12c8ef4e20932cca09adf228\u0026amp;signature=3c7179b5f59ee4ed0944452e3a8bcd8ccaae3d57b287b4b11a9aa47e4119b6c0\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/akia-consulting/IZKlsOdu96JblZDm/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Izumi\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ff6b35\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.izumi.akiaconsulting.com/en/install/backup\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/en/install/backup.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.izumi.akiaconsulting.com/#organization\",\"name\":\"Izumi\",\"url\":\"https://docs.izumi.akiaconsulting.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/akia-consulting/-l5XLI7ftc2U1SZX/logo/light.svg?fit=max\u0026auto=format\u0026n=-l5XLI7ftc2U1SZX\u0026q=85\u0026s=96af7cf3d62f98290e82d9b350a9e3f9\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.izumi.akiaconsulting.com#website\",\"name\":\"Izumi\",\"url\":\"https://docs.izumi.akiaconsulting.com\",\"publisher\":{\"@id\":\"https://docs.izumi.akiaconsulting.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.izumi.akiaconsulting.com/en/install/backup#webpage\",\"url\":\"https://docs.izumi.akiaconsulting.com/en/install/backup\",\"name\":\"Backup and restore\",\"description\":\"How to take and restore a backup.\",\"dateModified\":\"2026-11-21T12:41:29.962Z\",\"isPartOf\":{\"@id\":\"https://docs.izumi.akiaconsulting.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.izumi.akiaconsulting.com/en/install/backup#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.izumi.akiaconsulting.com/en/install/backup#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Setting up\",\"item\":\"https://docs.izumi.akiaconsulting.com/en/install/requirements\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Backup and restore\",\"item\":\"https://docs.izumi.akiaconsulting.com/en/install/backup\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.izumi.akiaconsulting.com/en/install/backup#article\",\"headline\":\"Backup and restore\",\"name\":\"Backup and restore\",\"description\":\"How to take and restore a backup.\",\"url\":\"https://docs.izumi.akiaconsulting.com/en/install/backup\",\"mainEntityOfPage\":{\"@id\":\"https://docs.izumi.akiaconsulting.com/en/install/backup#webpage\"},\"dateModified\":\"2026-11-21T12:41:29.962Z\",\"publisher\":{\"@id\":\"https://docs.izumi.akiaconsulting.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.izumi.akiaconsulting.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Izumi\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Izumi\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/en/install/backup.md","siteName":"Izumi","nav":{"global":null,"versions":[{"version":"Srpski","default":true,"pages":[{"title":"Srpski","href":"/sr/upoznaj/sta-je-izumi"}]},{"version":"English","tabs":[{"tab":"Meet Izumi","pages":[{"title":"Meet Izumi","href":"/en/overview/what-is-izumi"}]},{"tab":"Using Izumi","pages":[{"title":"Using Izumi","href":"/en/using/search"}]},{"tab":"AI tools (MCP)","pages":[{"title":"AI tools (MCP)","href":"/en/ai-tools/overview"}]},{"tab":"Administration","pages":[{"title":"Administration","href":"/en/admin/people"}]},{"tab":"Installation","groups":[{"group":"Setting up","pages":[{"title":"Requirements","href":"/en/install/requirements"},{"title":"Install","href":"/en/install/install"},{"title":"First sign-in and admin","href":"/en/install/first-admin"},{"title":"Sign-in (Google, Entra)","href":"/en/install/sign-in"},{"title":"Connectors (Google Cloud, Microsoft Graph)","href":"/en/install/connectors"},{"title":"OAuth for MCP clients","href":"/en/install/oauth"},{"title":"TLS","description":"Certificate and HTTPS.","href":"/en/install/tls"},{"title":"Backup and restore","href":"/en/install/backup"},{"title":"Upgrade","description":"How to move to a new version.","href":"/en/install/upgrade"},{"title":"Monitoring","href":"/en/install/monitoring"},{"title":"Running offline","href":"/en/install/offline"}]}]}]}]},"basePath":"","title":"Backup and restore - Izumi","deploymentId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","buildId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","dynamics":[],"chunks":[]}