-
[CodeDeploy] appspec.yml의 destination 설정인프라/aws 2024. 3. 17. 18:07
Code Deploy 사용 중에 만난 이슈 사항입니다.
나중에도 참고할 일이 생길 수 있을 것 같아 남겨봅니다.
문제의 appspec.yml 입니다.
ec2 터미널에서 cd ~/ 를 할 경우 유저의 홈으로 이동하기에 destination을 ~/ 으로 설정하였습니다.
원하는 건 홈에 빌드에 필요한 파일들이 설치되는 것이 었습니다.
version: 0.0 os: linux files: - source: / destination: ~/ hooks: ApplicationStop: - location: deploy_scripts/new_script.sh timeout: 300 runas: root
Code Deploy 배포가 실패해서 로그를 찾아봤습니다. (/var/log/aws/codedeploy-agent/codedeploy-agent.log)
mdkir 하면서 에러가 발생한다고 하네요??
~/ 는 시스템의 최 상단 경로인 / 로 destination을 설정합니다. (runas를 ec2-user로 변경하여도 /를 바라봅니다.)
따라서 원하는 경로를 직접 입력해주어야합니다.
version: 0.0 os: linux files: - source: / destination: /home/ec2-user/user_service hooks: AfterInstall: - location: deploy_scripts/new_script.sh timeout: 300 runas: root
직접 원하는 경로를 설정해주니 잘 작동하는 것을 확인할 수 있습니다.
destination 설정에 주의가 필요할 것 같습니다.
'인프라 > aws' 카테고리의 다른 글
[CodePipeline]Unable to access the artifact with Amazon S3 object key (0) 2024.03.19 CodePipeline으로 CI/CD 구축하기 (0) 2024.03.19 CodeDepoly로 EC2에 배포하기 (2) 2024.03.18 CodeBuild로 ECR 갱신하기 (0) 2024.03.18 Elastic Container Registry (ECR) 로 도커 이미지 관리하기 (0) 2024.03.16