scalio-backup
Encrypted export and import of a whole Scalio app instance, shared by the Scalio apps (Nexus first, then Foundry, Rosetta, Citadel). Used for backup/restore and for moving an instance between self-hosted and SaaS. Concept and decisions E1-E12: https://claude.ai/artifact/Ej8DFrgi4hcFDQ69dvKWZ7
Nothing in this package is secret. The password is the customer's; without it nobody (Scalio included) can open a bundle.
Bundle format (.scaliobak)
- Outside: standard age v1 with a passphrase (scrypt, work factor 2^18),
ChaCha20-Poly1305 in 64 KiB chunks.
age -d backup.scaliobak > backup.taropens it without Scalio. - Inside: a tar stream.
manifest.jsonfirst (formatscalio-backup/1, product, app and schema version, source, options, SHA-256 per part), thencollections/<name>.jsonl(MongoDB Extended JSON, canonical, so dates, Int64 and ObjectIds stay exact),meta.jsonl, and for file foldersfiles/<dir>.index.jsonlplus the files. The import checks every hash; a changed or incomplete bundle is refused before anything is written.
Classes
Every collection (and every document of a mixed meta collection) has one class: config (always exported),
data (exported unless "configuration only"), cache, ephemeral, instance (never exported). Each app keeps
its classes in its own backup_spec.py and a test that fails on an unclassified collection.
Use in an app
from scalio_backup import AppSpec, Preserve, apply_import, export_instance, open_bundle, recover, rollback, purge
SPEC = AppSpec(product="scalio-nexus", app_version=VERSION, collections=..., meta_ids=...,
secret_fields={"settings": ("entra.clientSecret", ...)}, file_dirs={"hr": HR_UPLOAD_DIR},
schema_version=current_schema, export_hook=decrypt_instance_secrets, import_hook=encrypt_again)
# export (background job): writes the encrypted bundle to a file object
manifest = await export_instance(db, SPEC, out, password, include_data=True, include_secrets=True,
created_by=user_email, source={"mode": "selfhosted", "host": host, "tenant": tid})
# import, step 1: decrypt and verify into a work folder, nothing changes yet (WrongPassword, BundleError,
# IncompatibleBundle when the product differs or the bundle is newer than this instance)
bundle = open_bundle(upload, password, SPEC, target_schema=await current_schema(db))
show(bundle.preview()) # source, counts, warnings; the app adds its own (other tenant, license limits)
# import, step 2: inside the app's maintenance window (no writes, background jobs paused)
await apply_import(db, SPEC, bundle, preserve=(Preserve("app_users", {"email": me}),), imported_by=me)
bundle.cleanup()
# then: migrations, end all sessions, re-sync caches, show the checklist
await rollback(db, SPEC) # back to the state before the import (until purge)
await recover(db, SPEC) # on startup: cleans up an import that stopped half way
await purge(db, SPEC) # daily: drops the rollback copy after 7 days
How the swap works: documents go into _import_<name>, then each collection is renamed to
_preimport_<name> and the staging copy into its place. A journal (_backup_journal) records each step, so an
interrupted import is rolled back on the next start. File folders keep their old content in .preimport/.
Development
pip install -e ".[dev]", then pytest -q and ruff check .. Engine tests use mongomock; with MONGO_URL set
they run against a real MongoDB (CI does both). tests/vector.scaliobak is the shared test bundle
(tests/make_vector.py); the age layer is checked against rage (pyrage) in both directions.
Metadata
Release files for scalio-backup 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scalio_backup-0.1.0.tar.gz | 19.7 kB | With provenance | Details for scalio_backup-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scalio_backup-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for scalio_backup-0.1.0-py3-none-any.whl |
Total release size: 34.4 kB
Release files / scalio_backup-0.1.0.tar.gz
| Download URL | scalio_backup-0.1.0.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf2fff508020aa6859eccd9542160c3a19f5114885a6c44c389671dfedde554f
|
|
BLAKE2b-256 checksum How to use checksums |
2df0d7e352763cf141d19f387659a8da391af3fae20b913e389d3f7cdd3ed25f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / scalio_backup-0.1.0-py3-none-any.whl
| Download URL | scalio_backup-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1868b545a4c8518ece58a418aaa5f3a0eb7bf923b06ed253d233c3b32a47a176
|
|
BLAKE2b-256 checksum How to use checksums |
3b81cf6ab4711f45c7310f146c9071504fccb6d27b848950ba2827b8868a1620
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for scalio-backup 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for scalio_backup-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.