Sari la conținutul principal
FreeThree checks for your projectUptime, accessibility, SEO and cookie checks for your project
Menu

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 mkcert is set up. See Install the CLI.
  • You are signed in, and your checkout has a .tilizy/app.yaml. See The project file.

Start

  1. If you do not have the code yet, let the CLI fetch it. The command clones the repository and starts the website. With --data it also copies the live database, with personal data replaced, and the files:

    tilizy project:setup <project> --data
  2. In a checkout you already have, start the website from its folder:

    tilizy app:start

    The 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.

  3. Open it. Your website is served at https://<project>.localhost, an address that needs no setup:

    tilizy app:open
  4. To work with real content, copy the live database. See Database and files:

    tilizy db:pull

Day-to-day commands

CommandWhat it does
tilizy app:statusShows what is running, the build progress and the address.
tilizy app:logs -fShows the recent log lines and keeps following them. Name a service to see only that one, for example tilizy app:logs php.
tilizy app:shellOpens a shell inside the running website.
tilizy db:shellOpens an SQL shell on the local database.
tilizy app:mailOpens the local mail inbox. Email your local website sends is caught there.
tilizy app:restartApplies changes in .tilizy/: it rebuilds while the website keeps serving, then restarts.
tilizy app:stopStops 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:

CommandWhat it does
tilizy app:buildRuns the build hooks from your project file.
tilizy app:composer require vendor/packageRuns 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/.env holds your local secret values, one NAME=value per line.
  • .tilizy/local/app.yaml holds 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

CommandWhat it does
tilizy dev:qaRuns every check your project is set up for: coding standards, static analysis, tests. A tool without a configuration file is skipped.
tilizy dev:fixApplies the automatic code fixers.
tilizy dev:xdebug onSwitches 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-ports to 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-build so that the CLI writes it again for the new one.
  • Docker was stopped abruptly. Run tilizy app:start again. The CLI removes leftover containers and keeps your data. Do not use --purge for this.

Next: Database and files and Framework commands.