Skip to content

Deploying ​

The deploy command ​

sh
npm ci && npm run build          # or pass --assets to deploy
composer install --no-dev --optimize-autoloader
php bin/console deploy           # in DDEV: ddev console deploy

deploy runs its steps in order: optimize the autoloader, rebuild var/cache (routes, posts, translations, templates, the Vite manifest), publish post files, refresh the web server's Opcache, and purge the CDN when CDN caching is on.

Run it after every change: code, templates, content or configuration. In production, changes aren't picked up until then.

Options ​

Option
--list-stepsshow the steps in order and exit
--skip=a,bleave steps out
--assetsrun npm run build first
--opcache=cachetool|reload|nonehow to refresh Opcache (default: APP_OPCACHE, else cachetool)
--fcgi=…PHP-FPM socket or host:port, for cachetool (default: APP_FPM_SOCKET, else /run/php-fpm.sock)
--cachetool=…the cachetool binary (default: APP_CACHETOOL, else cachetool)
--reload-cmd=…the command for --opcache=reload (default: APP_OPCACHE_RELOAD_CMD)
--composer=…the Composer binary
--no-devexclude require-dev packages from the autoloader
--skip-composersame as --skip=composer
--skip-opcachesame as --opcache=none

Set the Opcache variables once per server in its .env, and a plain php bin/console deploy does the right thing everywhere.

After deploying, locally ​

deploy makes the Composer autoloader authoritative: new classes in src/ aren't found until the next deploy. When you go back to development:

sh
php bin/console cache:clear

It empties the caches, rebuilds the normal autoloader with composer dump-autoload (only when a deploy left it authoritative; --composer=<path> if Composer isn't on your PATH), and removes the post and page files published to public/media/, which would otherwise shadow the originals in content/.

Production checklist ​

  • [ ] Keep var/images/ between deploys (encoded images are reused from there)

  • [ ] MAILER_DSN, MAILER_FROM and CONTACT_TO for the contact form (send yourself a test message)

  • [ ] .env (or real environment variables) with APP_URL, APP_SECRET; APP_DEBUG unset

  • [ ] PHP 8.4 with intl, mbstring, opcache; display_errors=Off, log_errors=On

  • [ ] web server root at public/, everything else routed to public/index.php

  • [ ] var/cache writable by the deploy user and readable by PHP; var/log writable by PHP

  • [ ] Behind a CDN: CDN_CACHE=1 and CDN_PURGE with its credentials (CDN caching), and the CDN in your privacy policy

  • [ ] LOG_ALERT_TO to hear about errors by email (Logging), and the web server's access log turned off or without IP addresses (Access logs)

  • [ ] the Opcache mode for this server (APP_OPCACHE), see Servers & Opcache

  • [ ] HTTPS, and APP_TRUSTED_PROXIES if behind a proxy or load balancer

TinyTank documentation