Magento 2 Experten — Hyvä Theme, Tailwind CSS & SEO aus einer Hand ›

Deployment Basics

Deployment Basics

~17 Min. Lesezeit Zuletzt aktualisiert am August 8, 2026

Time to actually get aufgaben-manager onto a production server – a SYSTEMATIC checklist that ties every step from this course into a working whole.

1. Installing dependencies for production

composer install --no-dev --optimize-autoloader

--no-dev skips require-dev packages (chapter 6) – maker-bundle, PHPUnit (chapter 42), and friends are NOT needed in production and would only add unnecessary attack surface and disk space. --optimize-autoloader builds a more performant, class-indexed autoloader instead of the slower default variant.

2. Setting environment variables for production

.env.local
APP_ENV=prod
APP_SECRET=A_REAL_RANDOM_VALUE_NEVER_REUSE_THE_DEV_ONE
DATABASE_URL="postgresql://production_user:secure_password@production-db-host:5432/aufgaben_manager?serverVersion=16&charset=utf8"
MAILER_DSN=smtp://real-provider.com:587

Achtung: EXACTLY as learned in chapter 4: .env.local is NEVER version-controlled. APP_SECRET MUST be REGENERATED for production (NEVER reuse the local development one) – it's used for, among other things, CSRF token generation (chapter 18) and signatures.

3. Warming up the cache ahead of time

php bin/console cache:clear --env=prod
php bin/console cache:warmup --env=prod

EXACTLY the production cache explained in chapter 4 – if it's NOT warmed up ahead of time, the FIRST user after every deployment pays the cost of building the cache (a noticeably slow first request).

4. Running database migrations

php bin/console doctrine:migrations:migrate --env=prod --no-interaction

Achtung: --no-interaction from chapter 40 is REQUIRED HERE for automated deployments. Check BEFORE every production deployment whether the new migrations are ACTUALLY compatible with the data already present in production – a column that was empty in the development database might hold real values in production that a migration must NOT damage.

5. Compiling static assets

php bin/console asset-map:compile

Builds the files referenced with asset() from chapter 14 for production, INCLUDING cache-busting hashes in the filename – if app.css changes, the new version gets a NEW filename, so browsers do NOT accidentally keep using the old, cached version.

The complete checklist at a glance

  1. composer install --no-dev --optimize-autoloader
  2. Check environment variables (APP_ENV=prod, a real APP_SECRET, a real DATABASE_URL)
  3. php bin/console cache:clear --env=prod && cache:warmup --env=prod
  4. php bin/console doctrine:migrations:migrate --env=prod --no-interaction
  5. php bin/console asset-map:compile
  6. Check file permissions for var/cache and var/log (the web server user needs write access)
  7. Check the HTTPS certificate and security headers

One last check: bin/console about

php bin/console about --env=prod

Tipp: Shows the ACTIVE environment, PHP version, and installed bundles – a quick, final look to confirm the application is ACTUALLY running in the prod environment and hasn't accidentally kept using dev configuration (which would expose debug information to EVERY visitor – a serious security risk).

With that, block 8 – and this ENTIRE course – is ALMOST complete! One closing chapter ties together everything learned and rounds off aufgaben-manager.