luna restore
Rewind one luna, every luna of a type or a whole environment to an earlier moment.
luna restore puts lunas back as they were at a moment in the past: one luna, every luna of a type or every luna of the environment.
luna restore List --key '{"id":"groceries"}' --to "1h ago"
Reference
luna restore [OPTIONS] --to <TO> [LUNA_TYPE]
| Option | Type | Default | Does |
|---|---|---|---|
[LUNA_TYPE] |
text | Every type | Restores only the lunas of this type. |
--key <KEY> |
JSON | None | Restores only the luna with this key, such as '{"id":"a"}'. Needs a type. |
--to <TO> |
moment | Required | The moment to go back to. It must be in the past. |
--limit <LIMIT> |
number | 64 |
How many lunas each request to Luna restores, at most 1000. |
--yes |
flag | Off | Restores without asking first. |
--dir <DIR> |
path | . |
The app’s folder. Its env file names the project and environment. |
--env <ENV> |
text | LUNA_ENV, then production |
The environment. |
--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 CLI asks before it restores. Without a terminal, pass
--yes, or the command changes nothing and ends with exit code6. - A luna that did not exist yet at that moment is left as it is. The CLI counts these apart from the lunas it restored.
- The CLI restores page after page until every luna is done. A luna that fails is named with its error, and the command ends with exit code
1. Run it again for those.
Examples
Rewind one luna
luna restore List --key '{"id":"groceries"}' --to "1h ago"
Rewind every luna of a type to a time
luna restore List --to 2026-11-09T10:00:00Z
Rewind a whole environment from a script
luna restore --env staging --to "30m ago" --yes