社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
生成密钥
ssh-keygen // 默认配置即可
cd ~/.ssh
cat id_rsa.pub // 复制并打开github 网址 setting/ssh页面
id_rsa.pub打开样子
将密钥添加到托管平台
ssh -T git@github.com
npm install pm2 -g
pm2
module.exports = {
apps : [{
name: 'test',
script: 'test.js',
// Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
// 远程服务器上的PM2参数配置
args: 'one two', //参数
instances: 1, //实例数量
autorestart: true, //自动启动:是
watch: false, //监视模式:否
max_memory_restart: '1G',//如果超过内存多少后,将重启实例:1G
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production'
}
}],
deploy : {
production : {
user : '远程主机用户名',
host : '远程主机的ssh-config中的别名',
port : '远程主机ssh端口',
ref : 'origin/master',//远程gitee上的分支
repo : 'git@[gitee别名]:[git库地址]',
path : '远程服务器上的部署路径',
'post-deploy' : 'npm install && pm2 reload ecosystem.config.js --env production'//部署完成后的操作
}
}
};
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!