deploy

Deploy a repository from the current directory, an existing project or GitHub.

lly deploy [OWNER[/NAME] | URL] [options]

Detects the apps in a GitHub repository, configures and builds them and follows the build until they are live. Running it again redeploys the same apps from the latest commit.

acme/shop @ main
apps/web
Next.js
services/api
JavaScript
docs
unsupported
lly deploy
copperfox
Live
copperfox.lilylabs.app
cinderrock
Live
cinderrock.lilylabs.app
Each supported root can become an app. Unsupported roots are listed but cannot be selected.

Examples

lly deploy                                          # repository and branch of this directory
lly deploy acme/shop                                # repository by name
lly deploy https://github.com/acme/shop --ref release
lly deploy acme                                     # choose from the repositories of acme
lly deploy acme/shop --all --env apps/web:NODE_ENV=production --db apps/web=postgres -y

Process

Repository

Without an argument, lly offers the repository of the current directory, then repositories already deployed by your projects, then your other GitHub repositories. Without a terminal, it uses the repository of the current directory.

The ref is --ref, otherwise the checked-out branch, the branch the project already deploys, or the default branch of the repository.

A GitHub connection is required. Without it, lly stops before creating anything and shows where to connect GitHub.

Project

The target project is, in this order: --project, the linked project, or the project that already deploys the repository. Otherwise lly creates a project named after the repository. --name or [project] name in lily.toml sets another name. --new always creates a new project.

If the project already deploys the repository at the same ref, lly redeploys those apps and skips scan, selection and configuration.

Scan

LILY fetches the repository and detects its roots, for example . or apps/web, with framework and support status.

Selection

In a terminal, lly shows a list with all supported roots selected. Otherwise the selection comes from --apps, --all, -y or the roots in lily.toml. Each selected root becomes an app. The app name is the directory of the root unless --slug or lily.toml sets another name. LILY assigns the slug.

Configuration

LILY proposes variables, ports, databases and connections for each app. Flags and lily.toml override the proposal per field. In a terminal, lly asks for values of empty proposed variables and asks you to confirm each proposed connection.

Build

The apps are built and rolled out. lly shows the phase of each app and prints a summary:

  Apps
  App         Phase     URL                             Since
  copperfox   deployed  https://copperfox.lilylabs.app  2m ago
  cinderrock  deployed  (private)                       2m ago

If an app fails, lly exits with code 7 and shows how to read the build log. With --detach, lly returns after the configuration is accepted.

If the repository comes from the current directory and the directory is not linked yet, lly links it to the project.

lly deploy warns about uncommitted changes and unpushed commits, because LILY builds from GitHub.

Options

OptionDescription
--ref <REF>Branch, tag or commit
--newCreate a new project, even if the repository is already deployed
--name <NAME>Name of a new project. Default: repository name.
--apps <ROOT,...>Roots to deploy, comma-separated
--allDeploy all supported roots
--slug <ROOT=NAME>App name for a root. LILY assigns the slug.
--env <ROOT:KEY=VALUE>Environment variable
--env-file <ROOT=FILE>Environment variables from a .env file. Overrides --env for the same key.
--port <ROOT=PORT[/PROTO]>Service port. PROTO: http, https, tcp or udp.
--db <ROOT=KIND>Database: postgres, mysql, mariadb, redis, mongodb or sqlite. See Databases.
--edge <FROM->TO[:PORT]>Connection between the apps of two roots
--args <ROOT="ARG ARG">Start arguments, split at spaces. Stored, not applied at startup yet.
--config <FILE>Read settings from this file instead of ./lily.toml
--saveWrite the settings of this run to lily.toml
--detachReturn after the configuration is accepted

Options with a root can be repeated. Global options apply, in particular --project, --yes and --json.

Non-interactive use

Without a terminal or with -y, lly deploy does not prompt. It uses the repository of the current directory and, with -y, all supported roots. Empty proposed variables are skipped and proposed connections are accepted. If a choice remains open, for example the roots without -y, it exits with code 2 and names the flag to set. See CI/CD.

Exit codes

CodeCause
2Open choice without a terminal, unknown or unsupported root
5A build of the project is already running
6Scan took longer than 20 minutes or build longer than 45 minutes
7Fetch, build or rollout failed, or GitHub is not connected

JSON output

stdout contains two JSON documents: the accepted configuration {"source_id", "state", "apps"} and, after the build, the summary {"project_id", "flow", "apps": [{"app", "phase", "url"}]}. With --detach, only the first document is printed. On a redeploy of an existing source, only the summary is printed.

See also

On this page