Environments
Production, Preview, and your own environments such as staging or test.
Every project has two built-in environments:
- Production builds the production branch (
mainby default) and serves your project's domain. - Preview builds every other branch and pull request, each at its own URL.
Add a custom environment when a branch needs to behave like a long-lived copy of the app, for example a test environment for the dev branch with its own database.
Create one
clouzark environments create test --branch devFrom then on, a push to dev deploys to test instead of Preview, even when preview deployments are turned off. The environment has:
- Its own URL,
https://<project>-env-test.clouzark.com, which always serves its current deployment. - Its own variables. A custom environment gets its own variables plus those for All Environments. It doesn't inherit Preview's.
- Its own domains, if you point any at it.
- Its own history, so promote and rollback work within it.
In the dashboard, open the project's Settings → General → Environments.
The production branch can't belong to an environment, and a branch can deploy to only one environment.
Give it its own database
Set the variables the app reads, scoped to the environment:
clouzark env add DATABASE_URL "postgres://...test..." -e test
clouzark env ls
clouzark env pull -e testOr have it use another of the team's databases instead of the project's linked database:
clouzark environments update test --db my-app-test
clouzark environments update test --no-db # back to the project's databaseA variable you set yourself, like DATABASE_URL above, wins over the linked database's values.
Until you do one of these, a custom environment uses the project's linked database, the same one production uses.
Deploy, promote, roll back
clouzark deploy -e test # the latest commit on its branch
clouzark deploy -e test --branch feature # any branch, built with test's variables
clouzark deploy --upload -e test # this directory as it is now
clouzark rollback -e test
clouzark promote <deploymentId> # within the deployment's own environmentA new deployment serves the environment as soon as it's live. Promoting moves the environment to an earlier live deployment of its own. A custom environment's deployment can't be promoted to production: it was built with that environment's variables, so promoting it would serve production with them. Deploy the production branch instead.
Domains
clouzark domains add test.example.com -e test
clouzark domains route test.example.com -e testIn the dashboard, edit the domain under Domains and choose Connect to a Custom Environment.
Change or delete
clouzark environments update test --branch develop
clouzark environments update test --no-branch # manual deploys only
clouzark environments rm testDeleting an environment stops its running deployments and deletes its variables. Its deployments stay in the history. Point any domains elsewhere first: an environment with domains can't be deleted.
Limits
A project can have up to 3 custom environments.