Hi,
deployer 5.1.3
deployer recipes dev-master
Local Mac Os Sierra
Remote Ubuntu 16.04
<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'recipe/npm.php';
...
task('deploy', [
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
/* 'deploy:shared', */
/* 'deploy:vendors', */
/* 'deploy:writable', */
/* 'artisan:storage:link', */
/* 'artisan:view:clear', */
/* 'artisan:cache:clear', */
/* 'artisan:config:cache', */
/* 'artisan:optimize', */
/* 'deploy:symlink', */
/* 'deploy:unlock', */
/* 'cleanup', */
]);
after('deploy:update_code', 'npm:install');
For an unknown reason I receive the following trace:
➤ Executing task deploy:update_code
✔ Ok [19s 945ms]
➤ Executing task npm:install
[xxx] > which npm
[xxx] < /usr/bin/npm
[xxx] > cd /var/www/test-deploy/releases/1 && /usr/bin/npm install
➤ Executing task deploy:failed
• done on [xxx]
✔ Ok [1ms]
[Deployer\Exception\RuntimeException (-1)]
The command "cd /var/www/test-deploy/releases/1 && /usr/bin/npm install" failed.
Exit Code: -1 (Unknown error)
Host Name: xxx
================
Exception trace:
() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/deployer/src/Ssh/Client.php:95
Deployer\Ssh\Client->run() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/deployer/src/functions.php:297
Deployer\run() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/recipes/npm.php:23
Deployer\Deployer::Deployer\{closure}() at n/a:n/a
call_user_func() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/deployer/src/Task/Task.php:82
Deployer\Task\Task->run() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/deployer/src/Executor/SeriesExecutor.php:63
Deployer\Executor\SeriesExecutor->run() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/deployer/src/Console/TaskCommand.php:142
Deployer\Console\TaskCommand->execute() at /Volumes/xxx/code/xxx/xxx/vendor/symfony/console/Command/Command.php:264
Symfony\Component\Console\Command\Command->run() at /Volumes/xxx/code/xxx/xxx/vendor/symfony/console/Application.php:869
Symfony\Component\Console\Application->doRunCommand() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/deployer/src/Console/Application.php:132
Deployer\Console\Application->doRunCommand() at /Volumes/xxx/code/xxx/xxx/vendor/symfony/console/Application.php:223
Symfony\Component\Console\Application->doRun() at /Volumes/xxx/code/xxx/xxx/vendor/symfony/console/Application.php:130
Symfony\Component\Console\Application->run() at /Volumes/xxx/code/xxx/xxx/vendor/deployer/deployer/src/Deployer.php:320
Deployer\Deployer::run() at phar:///usr/local/bin/dep/bin/dep:119
require() at /usr/local/bin/dep:4
When I ssh on the remote server and cd into /var/www/test-deploy/release, I can see the node_modules directory with the packages inside.
If I run the very first deploy without the npm task, everything is running smooth and the second deploy will be successfully achieved with npm install and npm run production tasks.
Can I get some light, please?
The only hint I found is Deployer\Deployer::Deployer\{closure}() at n/a:n/a
Note: Using the yarn recipe (require 'recipe/yarn.php';) instead of npm works properly.
@jrean this was bugging me for a while.
Then I remembered I am running a DigitalOcean 512MB System, so you need to 'create' more RAM:
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
It works now :)
@qerim, smart!
I didn't think about it and it makes complete sense.
@antonmedv do you still consider it as a bug. Is there something that could be improved on the package side to give more details when such error happens?
Thxs
I think will be cool to detect stuff like this and inform user what to do. Will be completely awesome.
@jrean , Can you post result config? With npm run production (or yarn)
@antonmedv I don't think this should be classed as Deployer bug.
You could detect this issue by checking if the server has less than 1GB RAM and issue a message instructing them to either allocate virtual RAM or install more RAM.
what do you guys think about showing the actual used RAM by php besides the timing information like
➤ Executing task deploy:update_code
✔ Ok [19s 945ms, 63MB memory]
➤ Executing task npm:install
[xxx] > which npm
[xxx] < /usr/bin/npm
[xxx] > cd /var/www/test-deploy/releases/1 && /usr/bin/npm install
➤ Executing task deploy:failed
• done on [xxx]
✔ Ok [1ms, 112MB memory]
?
Thats not the perfect solution for the problem but will give the user a hint about memory consumption.
Most helpful comment
@jrean this was bugging me for a while.
Then I remembered I am running a DigitalOcean 512MB System, so you need to 'create' more RAM:
It works now :)