dasuchin / grunt-ssh-deploy

Grunt SSH Deployment
MIT License
66 stars 45 forks source link

Running multiple ssh_deploy deployments within one task: Fatal error: Maximum call stack size exceeded #49

Closed mmukhin closed 9 years ago

mmukhin commented 9 years ago

Awesome library. I'm trying to deploy to 2 servers, behind an ELB. Since I cannot add an array of hosts to 1 environment, I have to make 2 environments (e.g. prod1, prod2), and combine them into 1 "deploy-prod" task. Unfortunately, I get a "Maximum call stack size exceeded". Running grunt with --verbose, everything looks clean.

Does not work: grunt.registerTask('deploy-prod', ['default', 'ssh_deploy:prod1', 'ssh_deploy:prod2']);

(1) Would be great to allow an array of hosts or (2) Would be great to fix the Max call stack size exceeded if deploying multiple environments

--------- logs below -----------

Connecting :: ec2-xxxxx.us-west-2.compute.amazonaws.com
Connected :: ec2-xxxxx.us-west-2.compute.amazonaws.com
--------------- CREATING NEW RELEASE
--- mkdir -p /var/www/xxxxx/prod/releases/20151027130346310
--------------- UPLOADING NEW BUILD
--- DONE UPLOADING
--------------- UPDATING SYM LINK
--- rm -rf /var/www/xxxxx/prod/v1 && ln -s /var/www/xxxxx/prod/releases/20151027130346310 /var/www/xxxxx/prod/v1
--------------- REMOVING OLD BUILDS
--- cd /var/www/xxxxx/prod/releases/ && rm -rfv `ls -r /var/www/xxxxx/prod/releases/ | awk 'NR>3'`
Running "ssh_deploy:prod2" (ssh_deploy) task
Closed :: ec2-xxxxx.us-west-2.compute.amazonaws.com

Connecting :: ec2-xxxxx.us-west-2.compute.amazonaws.com
Connected :: ec2-xxxxx.us-west-2.compute.amazonaws.com
--------------- CREATING NEW RELEASE
--- mkdir -p /var/www/xxxxxt/prod/releases/20151027130349350
--------------- UPLOADING NEW BUILD
Fatal error: Maximum call stack size exceeded
hurricane766 commented 9 years ago

In ssh_deploy.js there's a default for the max buffer that is set to 200 * 1024. I've had the same issue, I usually just change 200 to 600 and it runs fine.

I haven't tried it but you also should be able to put the max_buffer: 600 * 1024 in your ssh-deploy environment options.

It doesn't have to be 600, it just needs more space than what it currently has.

mmukhin commented 9 years ago

Thanks for the quick reply, although even max_buffer: 60000 * 1024 does not help

mmukhin commented 9 years ago

https://github.com/dasuchin/grunt-ssh-deploy/pull/48

This fixes my issue, with default max_buffer

Thanks @NOtherDev

mmukhin commented 9 years ago

Could you guys pls accept the PR