Open austindebruyn opened 7 years ago
+1. I cant add strings like npm config set registry "http://xxxxx"
into 'post-deploy' command,
it would become npm config set registry ""
and cause errors.
None of the following works:
'post-deploy': '... && npm config set registry="http://xxxx" && ...'
'post-deploy': '... && npm config set registry "http://xxxx" && ...'
'post-deploy': '... && npm config set registry \'http://xxxx\' && ...'
'post-deploy': '... && npm config set registry \\"http://xxxx\\" && ...'
i will try to investigate it.
I just got this problem today on a ecosystem.config.js
anything new guys?
I used a workaround: I put the commands with the quotes in a script named restart-prod.sh
:
#!/usr/bin/env bash
docker-compose --file docker-compose.yml --file docker-compose-prod.yml exec -T front su-exec foo \
sh -c "YARN_CACHE_FOLDER=/srv/.cache/yarn yarn install && yarn next build && killall node"
I versioned it so that it would be deployed, then configured pm2
to call it when deploying:
module.exports = {
deploy: {
prod: {
'[…]': '[…]',
'post-deploy': './restart-prod.sh',
},
},
}
Then pm2 doesn't complain about the quotes and it just works.
It's impossible to have a post-deploy script like
secret='2$(8k3n!a' /bin/sh ./post-deploy.sh
You will get ash: 1: Syntax error: end of file unexpected (expecting ")")
error from the child process node tries to spawn. exampleIt looks like a couple people have run into similar issues and can manage with lots and lots of escaping, but this seems to do it for me. also solves issue https://github.com/Unitech/pm2-deploy/issues/122 .
Escaping hostJSON and wrapping it in double quotes instead:
and I can now deploy with
!
and(
and the rest of the json is preserved.Is this change in the spirit of the project?