Install Symfony Composer without clearing the cache

We use a different cache server for the standard one and use build agents for deployment. We start the composer installation in the build agent, where there is no cache directory, and then rsync it on the web servers, where we then run the command to clear and warm the cache (everything is done from the Bamboo deployment).

Of course, an error appears in the logs, since it cannot create a cache cache when the composer is installed on the agent (and we do not want this to be the way we do it after).

Is there a way that when I start the installation of the composer, I can make it skip the cache? I can not consider this as a parameter for the composer.

+4
source share
2 answers

As many others say this is not the case, Sensio \ Bundle \ DistributionBundle \ Composer \ ScriptHandler :: installAssets will make the cache transparent if necessary, which will cause problems if you cannot write to the cache (I do this after rsynced from the build agent to live server).

The only way I can find at the moment to get around this is to remove 2 lines from composer.json:

"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",

and then, when you are on a server with access to your cache, execute the following 2 commands (at this point you should already have installed / updated the composer):

php bin/console cache:clear --env=prod --no-debug
php bin/console assets:install --env=prod

: . , "" , , /web/bundles/bundleName. .

, (git clone composer install) , rsync , . / ( -, , ) , - , .

+1

, , :

"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",

post-install-cmd / post-update-cmd composer.json.

, install, update, post-update-cmd .

+4

Source: https://habr.com/ru/post/1659675/


All Articles