Skip to content
Luna
Esc
↑↓navigate↵open⌘Jpreview
On this page

luna export

Write an environment's lunas, as they are now or as they were at an earlier moment, to an archive of SQLite files and file contents.

luna export writes the lunas of an environment to an archive on this machine. Each luna is a plain SQLite database, readable without Luna.

luna export --out backup.tar.zst

Reference

luna export [OPTIONS] --out <OUT>
Option Type Default Does
--out <OUT> path Required The archive to write, a .tar.zst file.
--type <LUNA_TYPE> text Every type Exports only the lunas of this type.
--at <AT> moment Now Exports the lunas as they were at this moment.
--dir <DIR> path . The app’s folder. Its env file names the project and environment.
--env <ENV> text LUNA_ENV, then production The environment to export.
--project <PROJECT> text LUNA_PROJECT The project, by name or as organisation/project.
--tenant <TENANT> text The environment’s own A tenant added to the environment, by name.
--token <TOKEN> text LUNA_TOKEN, then your login An API token or account key to act with.

Good to know

The archive is a tar file compressed with Zstandard. It starts with luna-export.json, and then holds a folder for each luna.

Path Holds
luna-export.json The archive’s format, the environment it came from and the moment it shows
<TYPE>/<HASH>/key.json The luna’s key, as JSON
<TYPE>/<HASH>/db.sqlite The luna’s SQLite database
<TYPE>/<HASH>/parts/<ID> The contents of the luna’s files
  • <HASH> is made from the luna’s key, so the folder name is safe whatever the key holds. Read the key from key.json.
  • Exporting needs data:read on the environment.
  • luna import creates lunas from the archive.

Examples

Export an environment

luna export --env production --out production.tar.zst

Export one luna type as it was yesterday

luna export --type List --at "24h ago" --out lists.tar.zst

Read a luna’s database with SQLite

tar --zstd -xf production.tar.zst
sqlite3 List/<HASH>/db.sqlite .tables

Was this page helpful?