Guides

Deploy an app

Deploy a repository, choose its apps and branch, and deploy it again after a change.

This guide deploys a GitHub repository and covers the choices you have on the way: which branch, which apps, and which values. For a first deploy with defaults, the Quickstart is shorter. Deployments explains each stage.

Before you start

  • A LILY account with a GitHub connection.
  • The commit you want to deploy is pushed to GitHub.
  • For the CLI: lly installed and signed in.
  • The examples use an app called copperfox. The console shows an app by its name. The CLI uses its address name, the first part of the app's address. In the examples both are copperfox.

Steps

Choose the repository and branch

Start a new project. Paste a repository link, or connect GitHub and pick one of your repositories, private ones included. Choose the branch with the Branch selector. It starts on the default branch.

In a clone of the repository, lly deploy uses the checked-out branch. Name a repository or a branch, tag or commit to deploy something else:

lly deploy                                   # this directory, checked-out branch
lly deploy acme/shop                         # a repository by name
lly deploy acme/shop --ref release           # a branch, tag or commit

Choose the apps

LILY looks for apps in the repository root and in the first level of folders such as apps/, packages/ and services/. Each one it finds can become an app.

Select the apps to deploy from the list. Each entry shows its path and framework.

lly shows the list with all supported apps selected. To skip the question, name them:

lly deploy --apps apps/web,services/api
lly deploy --all

Set variables and ports

Review the arguments, environment variables and ports of each app. What LILY detected is filled in already. Fill in empty values. Empty variables do not block the deploy.

lly asks for empty values. To set them up front:

lly deploy --env apps/web:NODE_ENV=production --port services/api=8080
lly deploy --env-file apps/web=.env.production

--save writes the settings of this run to a lily.toml, so the next deploy needs no flags.

Deploy and follow the build

Check the summary, then deploy. The project canvas shows the status of each app until it is live.

lly follows the build of each app and prints the summary:

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

Deploy again after a change

Push your commit, then deploy again. LILY does not deploy on push.

Select Redeploy in the action bar of the app.

Run the same command again. It redeploys the same apps from the latest commit and skips selection and configuration.

lly deploy

Check that it worked

Each public app answers at https://<slug>.lilylabs.app. lly ls lists the apps with their state.

If it does not work

What you seeCauseFix
Exit code 2 and a message that names a flagA choice is open and there is no terminal to ask inSet the flag the message names, for example --apps. See The CLI asks for a flag.
Exit code 5A build of this project is already runningWait for it, or follow it with lly project status --watch. See The project is busy.
Exit code 6The scan took longer than 20 minutes or the build longer than 45 minutesRun the command again. See The deploy takes too long.
Exit code 7Fetch, build or rollout failed, or GitHub is not connectedRun lly attach --build <slug> to read the build log. See The build failed.
A reason that starts with fetch:The download failed, for example because the branch does not existCheck the branch name and your GitHub connection. See GitHub is not connected.

More messages and their fixes: Troubleshooting.

Use an agent

Deploy this repository to LILY with the lly CLI.
Check that the branch is pushed, then run `lly deploy -y --json` from the repository root.
If it exits with code 2, set the flag its hint names and run it again.
If it exits with code 7, show me the build log with `lly attach <slug> --build`.
When it is live, tell me the URL and the app slug. Do not commit, push or delete anything without asking me.

Next steps

On this page