You push a commit. A little later the change is on your website. This article walks through what happens in between on Tilizy Hosting: what the platform reads, what it builds, when your visitors are switched over, and how you go back if the release was wrong. It is written for developers, and for owners who want to follow what their developer is talking about.
The repository is the source
Your code stays in your Git repository. You connect that repository to your Tilizy account, and from then on the platform reads the code from there and builds the website from it. Nobody copies files to a server by hand, and nothing on the server is edited in place.
What starts a deploy is a rule you set for each environment. There are three choices:
- every push to a branch you choose;
- a release tag;
- by hand, when you decide.
A common arrangement is a staging environment that deploys on every push to its own branch, and a live environment that deploys only when you tag a release. An environment can also wait for your tests to pass before it deploys.
# staging follows the branch
git push origin staging
# live follows release tags
git tag 2.4.0
git push origin 2.4.0
The project file
How the website is built and run is described in a file in the repository, next to the code: .tilizy/app.yaml. A small one for a Drupal site looks like this:
runtime: php-8.4-fpm
framework: drupal11
docroot: web
mounts:
- source: /sites/default/files
persistent: files
hooks:
build:
- composer install --no-dev --optimize-autoloader --no-interaction
deploy:
- drush updatedb --no-interaction
- drush config:import --no-interaction
crons:
- schedule: '*/15 * * * *'
cmd: drush cron
secrets:
- SMTP_PASSWORD
runtimeis the PHP version the site runs on.frameworkanddocrootsay what kind of site this is and which directory is served.mountsare the directories that are kept from one release to the next, such as uploaded files. The code is replaced by every release. These are not.hooks.buildlists the commands that run for every release, in the build step.hooks.deploylists the commands that bring the database in line with the new code.cronsare scheduled jobs.secretsnames the values the site needs and the repository must never hold.
Secrets appear by name only. Their values are kept outside the repository and set with the Tilizy CLI. Run like this, the command asks for the value without showing it on screen:
tilizy var:set SMTP_PASSWORD
The database and the other services the site needs are declared beside the project file, in .tilizy/services.yaml:
services:
db:
type: mariadb
version: '11.8'
persistent: data
You do not have to write these from nothing. In a checkout of an existing site, the first command below inspects the code and writes a first version. The second checks the result before you commit it.
tilizy app:init
tilizy app:validate
Because this lives in the repository, a new PHP version or a new scheduled job is a commit. It is reviewed like any other change, and the same file drives live, staging and the copy on your own computer.
The build
When a deploy starts, the platform takes the commit and builds a release from it in a separate build step, away from the running site. The build commands of your project file run here: installing dependencies, compiling assets, whatever your project needs. While this goes on, visitors are still served by the release that was live before. Nothing they use is touched.
If a build command fails, the deploy stops there and nothing changes on the website. You read the output, fix the commit and push again.
A new release beside the running one
The result of the build is a complete new release, prepared in full beside the old one. This is where the method differs most from copying files over a live site. With copying, there is a stretch where some files are new and some are old, and a visitor who arrives in that stretch gets a mix of both. With releases, the old one stays whole until the last moment and the new one is whole from its first request.
The switch
When the new release is ready, visitors are switched over to it in a single step. Each request is answered by the old release or by the new one, never by something in between. That is what "atomic release" means, and it is why a deploy of code or content goes live without downtime.
There is one exception, and it is better to know it in advance. A deploy that changes the structure of your database shows a short maintenance page, for seconds.
For developers the method has a consequence worth planning for. Until the switch, the old release is still serving, against the same database the new release is about to use. A database change has to be one the old code can live with for that stretch. Adding a column is usually easy. Removing one the old code still reads is better split over two releases: the first stops using it, the second drops it.
Deploying by hand, and checking the result
You never need the command line to deploy. A push or a tag is enough. When you want to start a deploy yourself, the Tilizy CLI does it from a checkout of the project:
tilizy app:deploy # the live environment
tilizy app:deploy --staging # the staging environment
tilizy app:deploy -e redesign # the environment of the branch "redesign"
The command follows the deploy and prints its progress. Two more are useful afterwards:
tilizy app:status --prod # address, branch and last deploy of the live environment
tilizy app:logs --prod # recent log lines of the live environment
A deploy that finished tells you the release was built and switched in. Whether the new feature does what it should is still for you to check. Open the pages you changed, and keep watching the site for a while.
Rolling back
The previous release is kept. Going back to it takes one command or one click.
tilizy app:rollback --list # the releases you can return to
tilizy app:rollback # back to the release before the current one
tilizy app:rollback --to 2.3.0 # back to a release you name
By default a rollback returns the code and leaves the database as it is. That suits most cases, because orders, form entries and edits made since the release stay where they are. If the release changed the database in a way the old code cannot work with, --db also restores the database snapshot taken before that deploy. Everything written to the database after that moment is then gone, so decide it case by case.
A rollback buys time and fixes nothing. The faulty commit is still in your repository, and an environment that follows a branch will deploy it again with the next push unless you revert or repair it first.
What stays your job
- Testing before live. The platform releases what you give it. Try the change on a staging copy first.
- A build that gives the same result twice. Commit your lock files, so the release is built from the versions you tested.
- Looking after the release. The work goes on after a clean deploy: watch the site, read the logs, be ready to roll back.
The plans, and what the server of each one holds, are on the Hosting page.
