doc-pm2 icon indicating copy to clipboard operation
doc-pm2 copied to clipboard

Easy Deploy With SSH | Guide | PM2 Documentation

Open rmonnier9 opened this issue 6 years ago • 14 comments

https://pm2.io/doc/en/runtime/guide/easy-deploy-with-ssh/

PM2 - Guide, References, Tutorials and Best Practices about PM2 and Node.js.

rmonnier9 avatar May 30 '18 14:05 rmonnier9

"git --version " can print "git version 2.9.5" at remote server ,but when i use "pm2 deploy ecosystem.js production setup",it happen a error "bash: git: command not found "

bfc846958672 avatar Sep 11 '18 10:09 bfc846958672

i use "yum install git -y " again. it is Okay now .

bfc846958672 avatar Sep 11 '18 10:09 bfc846958672

Please put as simple as posible how to use pm2 to run a node appliaction as sudo It must be possible to use inline keyword pm2 start sudo myap

daverathbone avatar Oct 05 '18 23:10 daverathbone

hello Excuse me, when I try to deploy my api with pm2 I receive this error: spawn sh ENOENT I know the problem come from my ecosystem file but i don't know why.

Please help me with this. Thank you!

ghost avatar Oct 16 '18 16:10 ghost

Hi, on my system I get "unexpected token -" until I quote the ecosystem.config.js file options that contain "-", like:

pre-setup: "ls -la" won't work until I make it "pre-setup": "ls -la"

justinphilpott avatar Oct 29 '18 13:10 justinphilpott

Message:

when you want to pull the latest version of commit at host, you need to config like this:

'post-deploy': 'git pull origin master;',

only config in 'post-deploy', git pull latest version of commit works.

NextZeus avatar Nov 20 '18 09:11 NextZeus

I don't get it, how can you all forget about the webpack or gulp, we do not deploy full source code from github to remote server, is there any ways we can use the webpack or gulp (build system) before it deploys to the remote server. Any suggestions will be welcome, thanks in advance.

kangchen avatar Dec 11 '18 14:12 kangchen

@kangchen I don't get it, how can you all forget about the webpack or gulp, we do not deploy full source code from github to remote server, is there any ways we can use the webpack or gulp (build system) before it deploys to the remote server. Any suggestions will be welcome, thanks in advance.

Yep you are right, there must be a way out to deploy using webpack or gulp. I'll be looking into this, and update here, if got some success.

muneebrbaig avatar Dec 19 '18 11:12 muneebrbaig

@kangchen I don't get it, how can you all forget about the webpack or gulp, we do not deploy full source code from github to remote server, is there any ways we can use the webpack or gulp (build system) before it deploys to the remote server. Any suggestions will be welcome, thanks in advance.

I just build in my local workspace first, and use command npm run ftp to upload files to the remote server with a ftp plugin.

Crazymuyang avatar Feb 25 '19 10:02 Crazymuyang

can 'pm2 start ecosystem.config.js' specify a host like 'pm2 start ecosystem.config.js --host ... ' ? or shold I use deploy to specify a host?

luotiantian66 avatar Mar 07 '19 09:03 luotiantian66

What if the apps are in different repos, how to deploy them by using one ecosystem file ? Or should I write a ecosystem file for each app ?

luotiantian66 avatar Mar 08 '19 03:03 luotiantian66

hi i get sh: 1: Syntax error: Unterminated quoted string on my remote host, you have any idea why you could be?

Exspiravit avatar May 14 '19 15:05 Exspiravit

@kangchen I don't get it, how can you all forget about the webpack or gulp, we do not deploy full source code from github to remote server, is there any ways we can use the webpack or gulp (build system) before it deploys to the remote server. Any suggestions will be welcome, thanks in advance.

@muneebrbaig

@kangchen I don't get it, how can you all forget about the webpack or gulp, we do not deploy full source code from github to remote server, is there any ways we can use the webpack or gulp (build system) before it deploys to the remote server. Any suggestions will be welcome, thanks in advance.

Yep you are right, there must be a way out to deploy using webpack or gulp. I'll be looking into this, and update here, if got some success.

People might not like what I have to say, but coming from 10 years in SysAdmin, Operations, DevOps, and JS Coding...I wouldn't be deploying anything other than an already-transpiled/bundled JS build to my target systems. I'd simply invoke pm2 for deployment after building.

In your head, just so that I don't sound insensitive or like the assholes on StackOverflow, where would you see gulp/webpack fitting into the pm2 flow?

armenr avatar May 17 '19 20:05 armenr

@justinphilpott Hi, on my system I get "unexpected token -" until I quote the ecosystem.config.js file options that contain "-", like:

pre-setup: "ls -la" won't work until I make it "pre-setup": "ls -la"

because JSON doens't support hyphens in key names until you make them in quotes :)

arkus7 avatar Jun 08 '19 11:06 arkus7