Deploy from the terminal
Deploy an environment by hand, follow the deploy, read logs and roll back from your terminal.
On this page
Most deploys start by themselves when you push to Git. The CLI is for the other cases: deploying by hand, watching a deploy, finding out why one failed, reading logs and rolling back. Every command on this page acts on a hosted environment.
Deploy
-
Push the commit you want to deploy. A deploy builds what is in your repository, not what is on your computer.
-
Start the deploy:
tilizy app:deployWithout a flag this deploys the live environment. The command shows the progress of the deploy, step by step, until it ends, and reports success or failure. Pressing Ctrl+C only stops watching: the deploy keeps running.
-
Open the website and check it:
tilizy app:open --prod
To deploy another environment:
tilizy app:deploy --staging
tilizy app:deploy -e feature-checkout
| Option | What it does |
|---|---|
--force | Builds again even when the commit has not changed. Without it, deploying an unchanged commit does nothing. |
--tag <tag> | Sends this release tag through the tag deploy again, including the wait for your pipeline if the environment has one. Use it when you pushed a tag and no deploy started. |
--no-follow | Queues the deploy and returns at once. |
--skip-config-check | Drupal only. Skips the comparison described below. |
The configuration check on Drupal
A Drupal deploy usually imports the configuration from the repository, which overwrites changes somebody made on the live site. Before the deploy starts, the CLI compares the configuration on the environment with the configuration the deploy will import, and lists the differences. It warns and does not stop the deploy. To look before you deploy, and to bring live changes into the repository, use tilizy drupal:config:status and tilizy drupal:config:pull. See Framework commands.
See the state of an environment
tilizy app:status --prod
The output has two parts: what the portal knows about the environment (its address, its branch, the last deploy and its domains), and what your project file declares (PHP version, services, mounts, hooks and scheduled jobs).
See what happened
List the recent deploys of the project, newest first:
tilizy activity:list --deploys
Each line has a job number. Show one job with its result, its error and the time each step took:
tilizy activity:show <job-number>
This is the quickest way to answer two questions: did my deploy ship, and where did it spend its time. Without --deploys, the list shows every kind of job, for example backups.
Read the logs
tilizy app:logs --prod
The command prints the most recent log lines of the environment, 120 unless you set another number with -n. Add -f to keep following new lines until you press Ctrl+C. Name a service to see only that one:
tilizy app:logs php --prod -f
Note: Without a flag,app:logsandapp:statusshow the copy on your computer. Add--prod,--stagingor-e <branch>for a hosted environment.
Roll back
List the releases you can return to:
tilizy app:rollback --list
Return to the release before the current one:
tilizy app:rollback
The command asks you to confirm and then follows the rollback to its end. Only the code goes back. The database stays as it is unless you add --db. Choosing a specific release and everything a rollback does and does not change are described in Roll back.
In a script
Add --no-input so that no command waits for an answer, and name the project when the script does not run inside a checkout:
tilizy app:deploy -p <project> --staging --no-input
The command ends with a non-zero exit code when the deploy fails.
What can go wrong
- Nothing happens. The commit is the one that is already live. Push your change first, or add
--forceto build the same commit again. - The deploy is held or refused. The environment waits for the pipeline of the release, and the pipeline has not passed. Fix the pipeline and release again. See Deploys and releases.
- The deploy fails in a hook.
tilizy activity:shownames the step. A failed build or deploy hook leaves the previous release serving. A failedpost_deployhook leaves the new release live. - You deployed live by accident.
app:deployandapp:rollbackact on live when you give no flag. Pass--stagingor-e <branch>for anything else. - The job succeeded but the website is wrong. A finished job is not proof. Open the website, and read the logs.
Next: Deploys and releases and Roll back.