Amazon web services AWS Codedeploy没有这样的文件或目录
我在通过AWS CodeDeploy部署时遇到两个问题。 我正在尝试将CodeCommit的代码部署到EC2 ubuntu实例 在appspec.ymlAmazon web services AWS Codedeploy没有这样的文件或目录,amazon-web-services,Amazon Web Services,我在通过AWS CodeDeploy部署时遇到两个问题。 我正在尝试将CodeCommit的代码部署到EC2 ubuntu实例 在appspec.yml version: 0.0 os: linux files: - source: / destination: /home/ubuntu hooks: ApplicationStart: - location: scripts/ApplicationStart.sh timeout: 300 run
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu
hooks:
ApplicationStart:
- location: scripts/ApplicationStart.sh
timeout: 300
runas: ubuntu
在启动pm2之前,我需要将几个配置文件放在应用程序的正确位置。我还假设,由于我将appspec.yml中的runas设置为ubuntu,bash脚本将位于/home/ubuntu
my/home/ubuntu
config/ backend/ frontend/
看起来Code deploy不会覆盖以前的部署,所以如果我在目录中有backend/和frontend/文件夹,它将在安装阶段失败
在ApplicationStart.sh中
#!bin/bash
sudo cp config/config1.json backend/config/config1.json
sudo cp config/config2.json backend/config/environments/development/config2.json
sudo cp config/config3.json frontend/config3.json
sudo pm2 kill
cd backend
sudo npm install
sudo pm2 start "strapi start" --name backend
cd ../frontend
sudo npm install
sudo pm2 start "npm start" --name frontend
在ApplicationStart阶段,它给出了以下错误
LifecycleEvent - ApplicationStart
Script - scripts/ApplicationStart.sh
[stderr]bash: /opt/codedeploy-agent/path/to/deployment/scripts/ApplicationStart.sh: bin/bash:
bad interpreter: No such file or directory
我在/home/ubuntu上运行相同的bash文件。它很好用
问题1。
-如何在没有错误的情况下运行BeforeInstall.sh?是否存在路径问题或其他我试图做但不应该做的事情
问题2。
-当目录(/home/ubuntu)中已经有应用程序文件夹时,如何让代码部署覆盖以前的部署?
-是否在安装前阶段手动删除目录 在
#中的bin/bash
前面缺少斜杠!bin/bash
它应该是
#/bin/bash
在#中的bin/bash
前面缺少斜杠!bin/bash
它应该是#/bin/bash