PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 8, 2022

[FIXED] How to unlimit PHP Deployer composer memory?

 February 08, 2022     composer-php, php-deployer     No comments   

Issue

I am running PHP deployer for a magento application from a docker-compose. The apache is inside a container and there is a memory limit for php. I have control on the Dockerfile, if needed.

Currently my issue is that when I run dep deploy it crashes:

$ dep deploy 
✈︎ Deploying master on main
✔ Executing task deploy:prepare
✔ Executing task deploy:lock
✔ Executing task deploy:release
✔ Executing task deploy:update_code
✔ Executing task deploy:shared
➤ Executing task deploy:vendors
✔ Executing task deploy:failed
✔ Executing task deploy:unlock

In Client.php line 103:
                                                                                                                                                                                                                         
  The command "cd /home/public_html/releases/20201214130007 && /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest" failed.  
                                                                                                                                                                                                                         
  Exit Code: 255 (Unknown error)                                                                                                                                                                                         
                                                                                                                                                                                                                         

If I run the composer line inside the container with the addition of unlimit of the memory, it works:

php -d memory_limit=-1 /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest

I tried to force to force deployer to use to use composer this way, but it didn't work:

# in deployer.php:
set('composer', 'php -d memory_limit=-1  /usr/local/bin/composer');

I think that it is because it is not using the composer from the set when doing deployer:vendors as can be seen from the verbose log:

➤ Executing task deploy:vendors
[main] > if hash unzip 2>/dev/null; then echo 'true'; fi
[main] < true
[main] > if hash composer 2>/dev/null; then echo 'true'; fi
[main] < true
[main] > command -v 'composer' || which 'composer' || type -p 'composer'
[main] < /usr/local/bin/composer
[main] > cd /home/public_html/releases/20201214125356 && /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest

Any suggestions how to fix this?


Solution

To change the composer binary used by deployer, you need to set bin/composer, so change this

set('composer', 'php -d memory_limit=-1  /usr/local/bin/composer');

to this

set('bin/composer', 'php -d memory_limit=-1  /usr/local/bin/composer');


Answered By - edvordo
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing