A deployed environment and URL for every branch and pull request, created on push and cleaned up automatically when the branch is done.
Preview environments
Every branch can have its own environment with its own URL, built from that branch.
How previews work#
-
Push a branch. Light Cloud creates an environment for it and deploys it.
-
The environment gets its own URL, named after the branch:
{branch}-{app}-{org}.light-cloud.ioA branch called
feature-checkouton appstorefrontin orgacmeserves atfeature-checkout-storefront-acme.light-cloud.io. Drop the link into the pull request and reviewers click instead of pulling the branch. -
Every further push to the branch redeploys its environment.
-
Delete the branch and the environment is removed with it. Stale previews do not pile up.
Settings#
Three toggles control the lifecycle, all on by default:
- Auto-create environment per branch (application) - new branches get an environment on their first push.
- Auto-cleanup when branch is deleted (application) - deleting a branch deletes its environment. Never touches production.
- Auto-deploy on push (per environment) - turn it off on an environment to deploy it only when you say so.
All three are explained field by field under Git automation.
Environment variables#
A preview starts from the application's variables and can override any of them - point a branch at a test database while production keeps the real one. See Environment variables.
Tip
Give previews a Shared-tier database of their own instead of sharing production data: it is ready in seconds, costs about $3 a month, and a preview can never corrupt what production reads.
A long-lived staging environment#
Previews don't have to be short-lived. Create an environment for a staging or develop branch and keep it: it deploys on every push to that branch, carries its own variables and domain, and behaves like a second production - minus the protection.
Protect a preview#
Give an environment a visitor password in its settings and the URL asks for it before serving. Handy for demos and unreleased features that should not be public while they are reviewed.
Production is protected#
Each application has one production environment, marked and protected. Branch activity does not touch it: automatic cleanup skips it, and only its own branch deploys to it. See The production environment.
Cost#
Container previews scale to zero when no one is using them, so idle review apps cost nothing. A preview is billed only while someone is actually looking at it. See Billing.