pm2踩过的坑

pm2实现一键部署,能将github上的代码拉到服务器,但是死活就是起不了服务。

pm2部署命令:

pm2 deploy ecosystem.json production setup
pm2 deploy ecosystem.json production

  

配置文件:

{
/**
* Application configuration section
* PM2 - Application Declaration
*/
"apps":[
// First application
{
"name" : "worker",
"script" : "app.js",
"env": {
"COMMON_VARIABLE": "true"
},
"env_production" : {
"NODE_ENV": "production"
}
},
// Second application
{
"name" : "api-app",
"script" : "api.js",
}
],
/**
* Deployment section
* PM2 - Deployment
*/
"deploy" : {
"production" : {
"user" : "root",
"host" : "39.105.XX.XX",
"ref" : "origin/master",
"repo" : "git@github.com:kangxiaoxiao/pm2_demo.git",
"path" : "/www/pm2_ex",
"post-deploy" : "pm2 startOrRestart ecosystem.json --env production"
}
}
}

  

CentOS7 pm2 部署node错误提示pm2: command not found]

解决办法:

whereis pm2
// pm2所在的路径(/opt/nodejs/bin/pm2)
pm2: /opt/nodejs/bin/pm2 
sudo ln -s /opt/nodejs/bin/pm2 /usr/bin/pm2

 

原文链接:https://www.jianshu.com/p/defc3e7aa6c2

上一篇:更改导航栏的背景和文字Color


下一篇:IOS 改变导航栏返回按钮的标题