Apps from GitHub
Deploy any repo and branch that has a Dockerfile. Images are built on GitHub Actions, so building costs your servers nothing, and every push to the branch can deploy itself.
Connect GitHub
Lanternly talks to GitHub through a GitHub App it creates for you, so there are no keys to copy.
- Make sure
DEPLOYER_URLis the console's publichttps://address, so GitHub can send pushes to it. - Open Settings → GitHub apps → Connect GitHub.
- Enter the GitHub organisation or user whose repos you'll deploy, and Builds run in: your copy of the Lanternly repo (for example
my-company/lanternly), which holds the build workflow. - Press Create GitHub app. GitHub asks you to confirm the new app's name.
- Install it on your Lanternly repo plus the repos you'll deploy, and you're sent back to the console.
The console saves the app's ID, private key and webhook secret (encrypted) and copies the ID and key into your Lanternly repo's Actions secrets so the build workflow can use them. The GitHub page then shows Connected, the repos it's installed on, and buttons to Add repos and Check the connection.
An app already in use keeps working until the new one is installed.
Using a GitHub App you made yourself
Under Settings → GitHub apps by hand, enter the App ID, the organisation, the repo builds run in, the private key (.pem) and the webhook secret. The app needs:
- Repository permissions: Contents read, Metadata read, Actions read and write, and optionally Secrets read and write (so the console can save the build secrets itself).
- Webhook address
https://admin.example.com/api/github/webhook, subscribed to the Push event.
Without the Secrets permission, add the repo variable APPS_GITHUB_APP_ID and secret APPS_GITHUB_APP_KEY to your Lanternly repo by hand.
What your repo needs
- A
Dockerfile(at the root, or tell the console its path). - One web port the app listens on. The app gets
PORTas a setting; default 3000. - Ideally a health page that answers once the app is ready, such as
/health.
# A minimal Node app
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
Add an app
- Open a project and press New service → App from GitHub.
- Pick the repository and branch. Only repos the GitHub App is installed on are listed.
- Give it a short name: its address becomes
<name>.example.comand other services in the project reach it by this name. - Change the advanced fields if needed: Dockerfile path, port, health page, memory.
- Add settings and secret settings, one
NAME=valueper line. Secret ones are stored encrypted, masked in logs and never shown again. - Under Databases and storage, tick a database or storage to link, or Create a new PostgreSQL database for it. See Link a database.
- Optionally a Pre-deploy command such as
npm run migrate. - Press Create app.
GitHub builds the image (usually one to five minutes; Watch the build on GitHub links to the run), then the console starts it and gives it its address with HTTPS.
How builds work
The console starts .github/workflows/build-app-image.yml in your Lanternly repo with the app's repo, commit and Dockerfile. The workflow checks out the app repo with a short-lived token from the GitHub App, builds a linux/amd64 image and pushes it to ghcr.io/<owner>/app-<name>:<commit>, keeping the newest 10 versions. The console follows the run and, once it succeeds, deploys that image.
- A commit that was already built is deployed without building again.
- A build that doesn't start within 5 minutes, or takes over 45, counts as failed. A failed build never touches the running app.
- Builds use your GitHub Actions minutes. Public repos build free.
The app's page
- Deploy latest builds the newest commit on the branch and swaps it in.
- Deploy every push to the branch by itself (in Settings) does the same on each push, through the GitHub webhook.
- Versions lists each commit that has run. Roll back starts an earlier one in seconds, with no rebuild.
- Builds lists every build with its result and a link to its GitHub log.
- Settings changes the branch, Dockerfile, port, health page, memory, settings, secrets, databases and pre-deploy command. Changing the branch or Dockerfile starts a new build.
- Logs: the latest 200 to 2,000 lines, or Live to watch new ones, with filter, pause and download. Secret values are blanked out.
- Pause shows visitors a "paused" page; Resume brings the app back.
- More → Custom domain, Move to project and Remove.
If the very first build fails, the page says This app wasn't created but keeps Settings: fix the branch, Dockerfile or port, press Save, then Build and try again.
Health checks and safe deploys
A new version must answer its health page (any status under 400) within 2 minutes. If it doesn't, the previous version is started again and the deploy is marked failed, with the output in History. With no health page, "running and not restarting" is enough.
While a new version starts, the app is briefly unavailable.
Pre-deploy command
A command that runs once for every new version, with the app's settings and linked databases, before it takes over: usually database migrations. It runs in a throwaway container of the new image on the project's network, with a 15-minute limit. If it fails, the version already running keeps running and the output is on the app's page.
Settings an app gets
| Setting | Where it comes from |
|---|---|
PORT | The port you set. You can't override it in settings. |
| Your settings and secrets | The app's Settings. |
DATABASE_URL, PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE | Each linked database (with its prefix, if any). |
S3_ENDPOINT, S3_BUCKET, keys… (and AWS_*) | Each linked storage. See S3 storage. |
${{shop-db.DATABASE_URL}} in any value | Filled in on the server from a database in the same project. |
Limits
- Apps have no volumes yet: anything written inside the container is lost on the next deploy. Keep data in a database or S3 storage.
- One build at a time per app.
- Apps get 1 CPU, a memory limit, a process limit and
no-new-privileges.