Knowledgebase

Laravel Deployment and Optimisation Print

  • developersgitdeployment, developers, performance, caching, uploads, migration, cron, diskspace, errors, troubleshooting
  • 0

Getting a Laravel application running well.

THE DEPLOYMENT SEQUENCE

  1. Pull the code.
  2. Install dependencies without development packages.
  3. Run migrations.
  4. Clear and rebuild caches.
  5. Verify.

THE CACHING COMMANDS

Configuration caching, route caching and view caching each improve performance measurably on production.

Cache them during deployment, and clear them when configuration changes. A cached configuration that no longer matches the .env file causes confusing behaviour.

OPCACHE

Ensure OPcache is enabled. It is the single largest performance gain available and costs nothing.

QUEUES

Process them with a cron job running the worker with a time limit, since persistent workers are not available on shared hosting.

LOGS

Laravel writes to storage/logs. These grow; configure rotation or clear them periodically, or they consume your disk quota.

STORAGE LINK

If you serve uploaded files, create the storage symlink. Without it, uploaded files are not reachable.

COMMON PROBLEMS

500 errors with no detail: check storage permissions and the log

Blank page: check the log, since debug is off


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot