bref
bref copied to clipboard
Improve the documentation about deploying a Symfony app
Hi,
I just notice something in the doc that maybe we could improve.
The Symfony guide says nothing specific for the deployment part, and so suggest doingcomposer install --prefer-dist --optimize-autoloader --no-dev
But we should probably suggest doing APP_ENV=prod composer install --prefer-dist --optimize-autoloader --no-dev
(or add --no-scripts
option) to avoid this kind of errors:
$ composer install --prefer-dist --optimize-autoloader --no-dev
...
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!! Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#63
!! #message: """
!! Attempted to load class "....Bundle" from namespace "...\...Bundle".\n
!! Did you forget a "use" statement for another namespace?
!! """
!! #code: 0
!! #file: "./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php"
!! #line: 74
!! trace: {
!! ./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:74 { …}
!! ./vendor/symfony/http-kernel/Kernel.php:371 { …}
!! ./vendor/symfony/http-kernel/Kernel.php:128 { …}
!! ./vendor/symfony/framework-bundle/Console/Application.php:168 { …}
!! ./vendor/symfony/framework-bundle/Console/Application.php:74 { …}
!! ./vendor/symfony/console/Application.php:142 { …}
!! ./bin/console:43 {
!! › $application = new Application($kernel);
!! › $application->run($input);
!! ›
!! arguments: {
!! $input: Symfony\Component\Console\Input\ArgvInput {#3 …}
!! }
!! }
!! }
!! }
!! 2020-11-19T10:35:11+00:00 [critical] Uncaught Error: Class '...\...Bundle' not found
!!
Script @auto-scripts was called via post-install-cmd
Reproductible example:
git clone [email protected]:symfony/demo.git sfdemo
cd sfdemo
composer install --prefer-dist --optimize-autoloader --no-dev # result: Script cache:clear returned with error code 255 - Attempted to load class "DebugBundle" from namespace "Symfony\Bundle\DebugBundle"
WDYT? Should I create a PR and add something about it before redirecting the user to the deployment page?
:+1: that makes sense
The docs have changed since then, I'll close this issue for cleanup.