Code deploy works on running machines - fails on new server from autoscale

0

Took me a bit to narrow down the issue, but what I have is an auto-scaling group with a Java application. The process is quite simply but does the following. When a new WAR file is deployed to CodeCommit repo, the pipeline takes that update, sends to each server. The appspec.yml file is quite simple;

version: 0.0
os: linux
files:
  - source: /
    destination: /opt/deploy
    file_exists_behavior: OVERWRITE
hooks:
   AfterInstall:
     - location: /scripts/update.sh
       timeout: 600
       runas: root

The /scripts/update.sh is nothing more than a java deployment, some logging, etc. and when this is pushed to the server cluster, each machine updates and works perfect.

The problem is when the auto-scaling group triggers and says "we need a new server". There is a lifecycle hook on instance start, so the machine starts, a code-deploy does fire, it gives a success on all the items but it fails to deploy. As I dig deeper, when I look on the instance, I can find the deployID here -> /opt/codedeploy-agent/deployment-root/ and then that deployment. There is a bundle.tar, but more important the deployment-archive which has all the files, etc.

So, when I push an update, code-deploy/pipeline uses the /opt/deploy folder, but when a new instance starts, it is putting it in the above and not respecting that appspec location, so java deploy is failing saying that /opt/deploy/file.war doesn't exist (as it never put it there).

Any help on what I am doing wrong or needs to be updated is appreciated.

질문됨 10달 전73회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠