Run your website locally
Start your website on your own computer on the production software, change code, and fix the usual local problems.
On this page
One command starts your website on your own computer, on the same software it runs on in production. It is served at an https address on your machine. What works locally is far more likely to work live, but it is not proof: always check a release after it is deployed.
Before you start
- Docker is installed and running, and
mkcertis set up. See Install the CLI. - You are signed in, and your checkout has a
.tilizy/app.yaml. See The project file.
Start
-
If you do not have the code yet, let the CLI fetch it. The command clones the repository and starts the website. With
--datait also copies the live database, with personal data replaced, and the files:tilizy project:setup <project> --data -
In a checkout you already have, start the website from its folder:
tilizy app:startThe CLI starts the services, then runs your build hooks and your deploy hooks. The first start takes longer, because the software has to be downloaded.
-
Open it. Your website is served at
https://<project>.localhost, an address that needs no setup:tilizy app:open -
To work with real content, copy the live database. See Database and files:
tilizy db:pull
Day-to-day commands
| Command | What it does |
|---|---|
tilizy app:status | Shows what is running, the build progress and the address. |
tilizy app:logs -f | Shows the recent log lines and keeps following them. Name a service to see only that one, for example tilizy app:logs php. |
tilizy app:shell | Opens a shell inside the running website. |
tilizy db:shell | Opens an SQL shell on the local database. |
tilizy app:mail | Opens the local mail inbox. Email your local website sends is caught there. |
tilizy app:restart | Applies changes in .tilizy/: it rebuilds while the website keeps serving, then restarts. |
tilizy app:stop | Stops the website. The database and the files are kept. |
Most of these have a short form: tilizy start, stop, restart, status, logs, shell and open.
Change code
PHP changes are live at once. There is nothing to restart. On Drupal, a change to service definitions still needs a cache rebuild: tilizy drush cr.
The running website sees your code as read-only, exactly as in production. Only the persistent folders are writable. Commands that have to write into the code run in a separate build container:
| Command | What it does |
|---|---|
tilizy app:build | Runs the build hooks from your project file. |
tilizy app:composer require vendor/package | Runs Composer. Everything after app:composer is passed to Composer. |
tilizy app:exec --build <command> | Runs any command in the build container, where the code is writable. |
tilizy app:exec <command> | Runs a command inside the running website, where the code is read-only. |
To rebuild automatically while you edit, put a script at .tilizy/hooks/change and run tilizy dev:watch. It calls the script after each batch of edits.
Local settings and secrets
Everything in .tilizy/local/ is yours alone and is not committed.
.tilizy/local/.envholds your local secret values, oneNAME=valueper line..tilizy/local/app.yamlholds local overrides of the project file, for example build hooks that also install development dependencies.
Access to the internet
The local website cannot reach the internet unless you allow it. List the hosts it may call under egress.allow in the project file, or in your local override when only you need it. Then start the website again.
egress:
allow:
- api.example.com
- "*.example.org"
- payments.example.net:8443
An entry is a host name, a host name with a port, or *. for all subdomains. Sending mail to the outside stays blocked locally.
Checks and debugging
| Command | What it does |
|---|---|
tilizy dev:qa | Runs every check your project is set up for: coding standards, static analysis, tests. A tool without a configuration file is skipped. |
tilizy dev:fix | Applies the automatic code fixers. |
tilizy dev:xdebug on | Switches step debugging on, for the local website only. off and status work the same way. |
Start again from nothing
Warning: This deletes the local database and the local files. It does not touch any hosted environment.
tilizy app:stop --purge
What can go wrong
- Something does not start. Run
tilizy app:doctor. It checks the local application, Docker, the certificates and your access, and names what is wrong. - Another program uses ports 80 and 443. The start is refused. Stop the other program, or run
tilizy app:start --allow-fallback-portsto serve on 8080 and 8443. - A command fails because the code is read-only. It tried to write into the code from inside the running website. Run it with
tilizy app:exec --build. - A request to another system fails although your computer is online. Its host name is not in
egress.allow. - The website is empty after you renamed the folder. The local copy is named after the folder of the checkout, so a new folder name starts a new, empty copy. Your old data is not deleted. To keep one name whatever the folder is called, write the short name of the project into a one-line file,
.tilizy/project, and start again. - A build fails after you moved the checkout. The local setup still points to the old location. Run
tilizy app:restart --skip-buildso that the CLI writes it again for the new one. - Docker was stopped abruptly. Run
tilizy app:startagain. The CLI removes leftover containers and keeps your data. Do not use--purgefor this.
Next: Database and files and Framework commands.