luna deploy
Deploy the app in this folder to an environment of its project, after checking its types and what the deploy would change.
luna deploy sends the app in this folder to an environment and starts its new version.
luna deploy --env production
Reference
luna deploy [OPTIONS]
| Option | Type | Default | Does |
|---|---|---|---|
--env <ENV> |
text | LUNA_ENV, then production |
The environment to deploy to. It must exist already, see luna env create. |
--project <PROJECT> |
text | LUNA_PROJECT |
The project, by name or as organisation/project. |
--dir <DIR> |
path | . |
The app’s folder: where luna.config.ts is, or the folder whose luna folder has it. |
--yes |
flag | Off | Deploys the changes that preflight would ask you to confirm. |
--preflight |
flag | Off | Shows what the deploy would change, and deploys nothing. |
--no-check |
flag | Off | Deploys without checking types first. |
--watch |
flag | Off | Keeps watching the app’s files and deploys again whenever one changes. |
--json |
flag | Off | Prints what was deployed as JSON. |
--show-token |
flag | Off | Also prints the environment’s API token, which is otherwise left out. |
--token <TOKEN> |
text | LUNA_TOKEN, then your login |
The API token or account key to deploy with. |
Good to know
- A deploy loads the app with Node.js through the installed TypeScript SDK, checks its types, uploads the files Luna does not have yet, asks Luna for a preflight and then deploys.
- The type check runs the app’s own
tscwhen the folder has atsconfig.json. Python lunas are checked with Pyright or mypy when the app is set up for one. A failed check deploys nothing. - The app’s files are its
.ts,.mts,.cts,.js,.mjs,.cjs,.jsonand.pyfiles. Folders named with a leading dot,node_modulesand__pycache__are skipped. - The app’s production dependencies go with it, as
node_modulesholds them, without TypeScript sources, source maps and Markdown.devDependenciesstay behind, and so does thelunapackage itself. A package whosepackage.jsonhas alunafield always goes, see Share lunas as a package. - The CLI refuses an app over 256 MiB with its dependencies, and names the largest packages. It also refuses a required dependency with a native
.nodeaddon, a dependency that is not installed and the linked layout of pnpm. - When the app has lunas in both TypeScript and Python, the CLI writes
luna_gen.tsandluna_gen.pyin the app’s folder, with each language’s luna types for the other. - Preflight lists every change. A change Luna refuses stops the deploy. Luna also tries the new version’s migration on copies of a sample of each changed type’s lunas, and any failure there stops the deploy.
- A change that needs your confirmation asks
Deploy anyway?at a terminal. Without a terminal and without--yes, nothing is deployed and the command ends with exit code6. - After a deploy, the CLI writes
LUNA_URLandLUNA_KEYto.env.localwhen the file names this environment and lacks them. --watchnever deploys toproduction.luna devdoes the same and also prints the environment’s log lines.
Examples
Deploy to production
luna deploy --env production
See what a deploy would change
luna deploy --env production --preflight
Deploy from a script
LUNA_TOKEN=<API_TOKEN> luna deploy --project <ORGANISATION>/<PROJECT> --env production --yes
Deploy again on every change
luna deploy --env staging --watch