首页 > 解决方案 > AWS 代码管道克隆问题

问题描述

我一直在尝试使用代码部署和 bitbucket 存储库创建 CI/CD。管道是成功的,但我没有在 ec2 中寻找任何代码。我只能看到ec2中的节点模块。如果有人遇到同样的问题或者可以帮助我解决这些问题,那就太好了。

应用规范.yml

version: 0.0
os: linux
files:
  - source: /
    destination: /home/ubuntu/gt
hooks:
  ApplicationStart:
    - location: scripts/start_server.sh
      runas: root

启动服务器.sh

sudo apt-get update
# install the application using npm
# we need to traverse to where the application bundle is copied too.
#some comments
#added commets
sudo su
rm -rf /home/ubuntu/gt
mkdir /home/ubuntu/gt
echo installing application with npm
cd /home/ubuntu/gt
sudo apt-get install -y npm
echo installing pm2
npm install pm2 -g
sudo yarn
pm2 delete gt
pm2 start npm --name 'gt' -- start


标签: node.jsamazon-web-servicesaws-code-deploy

解决方案


我没有在 ec2 中寻找任何代码

这可能是因为您要删除文件夹的所有内容:

rm -rf /home/ubuntu/gt

因为你ApplicationStart追赶files。所以无论你复制什么files,都会被删除ApplicationStart。执行顺序请看这里


推荐阅读