【发布时间】:2018-05-25 10:53:59
【问题描述】:
我正在尝试使用 Bitbucket Pipelines 使用 pm2 deploy production 命令进行部署。
我想知道是否可以这样做吗?因为有一个选项可以在 Bitbucket 中添加现有的 ssh 密钥,但它要求同时提供公钥和私钥,而我只有一个私钥。
deploy: {
production: {
user: "ubuntu",
host: "ec2-xx-xxx-xxx-xx.us-east-2.compute.amazonaws.com",
key: "~/.ssh/myKey.pem",
ref: "origin/master",
repo: "git@bitbucket.org:User/myProject.git",
path: "/home/ubuntu/myProject",
"post-deploy":
"npm install && pm2 startOrRestart ecosystem.config.js"
}
}
这是我的 PM2 部署配置,我在 package.json 中使用它,
"scripts": {
"deploy": "pm2 deploy ecosystem.config.js production"
}
我的 bitbucket 管道文件命令如下。
script: # Modify the commands below to build your repository.
- npm install
- npm run-script deploy
我将它托管在 AWS EC2 实例中,我只有 PEM 密钥来将它与我的 EC2 实例连接。
【问题讨论】:
标签: amazon-ec2 deployment bitbucket pm2 bitbucket-pipelines