error to install composer on AWS
I'm trying to deploy the Laravel app to AWS EB via Pipeline when I deploy the app I got this error in log EB
2020/10/18 00:43:08.443797 [INFO] Executing instruction: Install composer dependencies
2020/10/18 00:43:08.443819 [INFO] installing composer dependencies...
2020/10/18 00:43:08.443859 [INFO] Running command /bin/sh -c composer.phar install --no-ansi --no-interaction
2020/10/18 00:43:08.482582 [ERROR] An error occurred during execution of command [app-deploy] - [Install composer dependencies]. Stop running the command. Error: installing composer dependencies failed with error: Command /bin/sh -c composer.phar install --no-ansi --no-interaction failed with error exit status 254. Stderr:Sun Oct 18 00:43:08 2020 (12045): Fatal Error Insufficient shared memory!
I have file called 01_deploy.config in .ebextensions/01_deploy.config conatins this:
option_settings:
# Point the app root to the public/ folder.
- namespace: aws:elasticbeanstalk:container:php:phpini
option_name: document_root
value: /public
# Set here your php.ini `memory_limit` value.
- namespace: aws:elasticbeanstalk:container:php:phpini
option_name: memory_limit
value: 256M
container_commands:
01_install_composer_dependencies:
command: "sudo php /usr/bin/composer.phar install --no-dev --no-interaction --prefer-dist --optimize-autoloader"
cwd: "/var/app/current"
02_install_node_dependencies:
command: "sudo npm install"
cwd: "/var/app/current"
03_build_node_assets:
command: "sudo npm run prod"
cwd: "/var/app/current"
04_link_storage_folder:
command: "php artisan storage:link"
cwd: "/var/app/current"
05_run_migrations:
command: "php artisan migrate --force"
cwd: "/var/app/current"
leader_only: true
Where is the problem ?
Looks like you are running out of memory when running composer.
try changing step 01 to
sudo php -d memory_limit=-1 /usr/bin/composer.phar install --no-dev --no-interaction --prefer-dist --optimize-autoloader
This will set the memory limit to unlimited for this one command.
Please or to participate in this conversation.