Skip to content

Deploy recipes

Use one order for every routine deploy. The Deployer recipe below was run on a fresh starter-kit application. The Forge and Ploi scripts use the same commands but were not run on those hosts, so check the result with capell:doctor on yours. Back up the database first. The server needs Node 20 or later and npm.

Terminal window
composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction
php artisan capell:upgrade --force --no-interaction
npm ci --no-audit --no-fund
php artisan capell:frontend-after-install --apply --no-interaction
php artisan capell:runtime-refresh --no-interaction

Then reload PHP-FPM, and refresh public HTML if HTML Cache is installed.

capell:upgrade runs migrations and upgrade steps. capell:frontend-after-install --apply generates the Capell frontend stylesheet and runs npm run build. Generated CSS is not kept in Git, so a deploy that skips this step fails Capell Doctor. capell:runtime-refresh rebuilds caches, warms pages, runs Doctor and restarts queues. Run capell:upgrade --dry-run first when you want to review the plan.

Run the recipe in a fresh release directory, as Deployer, Forge and Ploi do. Installing with --no-dev over a directory that was installed with development packages makes composer install stop in package:discover with Class "Laravel\Boost\BoostServiceProvider" not found, because the generated runtime caches still list the development providers. If you must convert such a directory, delete those caches first, then run the recipe:

Terminal window
rm -rf bootstrap/cache/capell-runtime bootstrap/cache/capell-*.php bootstrap/cache/filament

capell:runtime-refresh rebuilds the caches again. Reload PHP-FPM after the install so running workers do not keep serving the old provider list.

The recipe was run with Deployer 8 and its laravel recipe. Share storage and .env between releases, then add these tasks, which run before deploy:symlink:

task('capell:upgrade', fn () => run('cd {{release_path}} && {{bin/php}} artisan capell:upgrade --force --no-interaction'));
task('capell:frontend', fn () => run('cd {{release_path}} && npm ci --no-audit --no-fund && {{bin/php}} artisan capell:frontend-after-install --apply --no-interaction'));
task('capell:refresh', fn () => run('cd {{release_path}} && {{bin/php}} artisan capell:runtime-refresh --no-interaction'));
task('artisan:migrate', fn () => null);
before('deploy:symlink', 'capell:upgrade');
after('capell:upgrade', 'capell:frontend');
after('capell:frontend', 'capell:refresh');

The laravel recipe would run artisan:migrate before capell:upgrade, so the empty artisan:migrate task above leaves migrations to capell:upgrade. Reload PHP-FPM after deploy:symlink.

Open the site’s deploy script. Keep the lines your host generated to enter the site directory and pull the branch, and keep its PHP-FPM reload line at the end. Replace the host’s Composer, migrate and cache lines with these, using the host’s PHP and Composer variables if your script has them:

Terminal window
composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction
php artisan capell:upgrade --force --no-interaction
npm ci --no-audit --no-fund
php artisan capell:frontend-after-install --apply --no-interaction
php artisan capell:runtime-refresh --no-interaction

Do not leave the host’s own php artisan migrate --force or php artisan optimize lines after these.

Terminal window
php artisan capell:doctor