Environments
Create, refresh, pause and remove environments of your website, and see what they share.
On this page
An environment is a complete running copy of your website: the code of one branch, its own database, its own files and its own address. Your server runs one project with as many environments as fit in its processor, memory and disk. This page shows how to create, refresh, pause and remove them.
The kinds of environment
| Environment | What it is for | How the CLI selects it |
|---|---|---|
| Live | The website your visitors use. Your domain points to it. | --prod |
| Staging | A copy where you check a release before it goes live. It follows a branch called staging or stage. | --staging |
| A copy from a branch | One feature on its own, for you or for someone who approves it. | -e <branch> |
| Local | The copy on your own computer. See Run your website locally. | -e local, or no flag on commands that work locally |
Staging and branch copies are called secondary environments on this page.
Create an environment from a branch
-
Push the branch to your repository. It must exist there before you create the environment.
-
Create the environment:
tilizy app:create -e feature-checkoutThe command sets up the environment for that branch, waits until it is running, then fills it with the database and the files of live. The personal data your project declares is replaced with made-up values on the way. Progress is shown until the job ends.
-
Open it:
tilizy app:open -e feature-checkoutA secondary environment has a preview address that only your team can open. The command opens it in your browser without asking you for the preview password. Add
--printto print the address instead.
To start with an empty database or without files, pass --db=false or --files=false.
Refresh an environment from live
tilizy app:sync -e feature-checkout
This copies the database and the files of live into the environment again, with personal data replaced. Live can only be the source of a sync, never the target.
A sync moves data, not code. The environment keeps the code of its own branch. After the database arrives, Tilizy runs the deploy hooks of that environment, so the copied data is brought to the state its code expects. If the branch is behind live, merge live's branch into it and deploy before you sync: older code cannot be matched to newer data automatically.
Use --db=false or --files=false to copy only one of the two.
Pause and resume
A paused environment uses no processor and no memory. Its data stays on disk.
tilizy app:stop -e feature-checkout
tilizy app:start -e feature-checkout
Warning: Without-e,app:startandapp:stopact on the copy on your computer, not on a hosted environment.
Remove an environment
tilizy app:destroy -e feature-checkout
This removes the environment for good, with its database and its files, and frees its disk space. The command asks you to confirm. It refuses to remove the live environment.
What environments share, and what they do not
| Shared by all environments | Separate for each environment |
|---|---|
| The processor cores and the memory of your plan | Disk: each environment holds its own copy of the code, the database and the files |
| The project file: framework, web root, mounts, hooks, services and the names of the secrets | The branch and the release it runs |
Secrets with the scope shared | Secrets with the scope per_env, and the settings you override per environment |
The software versions, unless you override runtime for one environment | Its address, its backups and its rule for what triggers a deploy |
Your live site always keeps what it needs. The portal shows what each environment uses and tells you when a bigger plan would help, and why.
What can go wrong
- The create is refused before it starts. Your project file declares a secret that has no value yet. Set it with
tilizy var:setand run the same command again. - The create stopped halfway. Run
tilizy app:createwith the same branch again. It continues an environment that an earlier run left unfinished. - The sync fails after copying. A deploy hook failed on the copied data. The environment now holds live data that its code has not processed. Fix the hook or the branch, then deploy or sync again.
- A command acts on live by mistake. Commands that work only on hosted environments use live when you give no flag. Always pass
-e <branch>or--stagingwhen you mean a secondary environment. - Real personal data in a copy.
--no-scrubcopies live data as it is. Use it only when you are allowed to handle that data.
Next: Deploys and releases and Storage and limits.