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

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 tsc when the folder has a tsconfig.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, .json and .py files. Folders named with a leading dot, node_modules and __pycache__ are skipped.
  • The app’s production dependencies go with it, as node_modules holds them, without TypeScript sources, source maps and Markdown. devDependencies stay behind, and so does the luna package itself. A package whose package.json has a luna field 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 .node addon, 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.ts and luna_gen.py in 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 code 6.
  • After a deploy, the CLI writes LUNA_URL and LUNA_KEY to .env.local when the file names this environment and lacks them.
  • --watch never deploys to production. luna dev does 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

Was this page helpful?