DockHosting Docs
Deploying

Laravel

Deploy Laravel apps — Composer, the app key, migrations, and queues.

DockHosting detects Laravel from a composer.json that requires laravel/framework, installs dependencies with Composer, and serves your app with PHP-FPM behind a web server.

Requirements

  • composer.json at the repository root (or your configured root directory)
  • APP_KEY set as an environment variable — Laravel throws MissingAppKeyException on every request without one. Generate one locally with php artisan key:generate --show and paste the base64:... value into your project's environment variables
  • A database, if your app uses one — see Databases

Common deploy failures

composer install --no-dev fails

The build runs composer install --no-dev --optimize-autoloader. This step fails most often because:

  • A required PHP extension isn't available in the build image — check your composer.json's require block for extensions like ext-gd or ext-imagick that need to be declared, not assumed present
  • A private package repository (a private Packagist, a private VCS) needs credentials that aren't configured
  • composer.lock is out of sync with composer.json — regenerate it locally with composer update and commit the result

MissingAppKeyException after a successful build

The build succeeded but the app throws this on first request. APP_KEY isn't set, or it's set to an empty value. Generate a real key and add it to your project's environment variables — see Requirements above.

Stale cached views or config after a redeploy

Laravel caches compiled views and config in storage/ and bootstrap/cache/. If storage/ is a persistent volume that survives redeploys, a cache built against a previous version's config can serve stale output. Clear it after a deploy that changes config or views:

php artisan view:clear && php artisan config:clear && php artisan cache:clear

Migrations

Run migrations against your attached database from a one-off shell, or as a deploy step if your project is configured to run one:

php artisan migrate --force

--force is required in production because Laravel otherwise prompts for confirmation, which has no terminal to answer it in an automated deploy.

Queues

A php artisan queue:work process is a long-running worker, not a request handler — see the note on long-running processes under Node.js; the same reasoning applies here. It needs to run as its own always-on project rather than sharing the web app's container.

On this page