๐ŸŒˆCodeDeploy ๋ฐฐํฌ ์‹คํŒจ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…๐Ÿšจ

๊น€์„ฑ์ธยท2023๋…„ 9์›” 18์ผ
0

[DevOps] ๐ŸณDocker & Kubernetes

๋ชฉ๋ก ๋ณด๊ธฐ
5/62

์•„๋ฌด๋ฆฌ ๋ธ”๋กœ๊ทธ๋ฅผ ๋”ฐ๋ผํ•ด๋ด๋„ ์•ˆ๋˜์„œ .travis.yml ํŒŒ์ผ๊ณผ appspec.yml์„ ๋Š๋‹ท์—†์ด ๊ฑด๋“ค๊ธฐ๋งŒํ• ๋ฟ ๋” ๋‚˜์•„์ง€์ง€ ์•Š์•˜์Œ...

๊ทธ๋ž˜์„œ CodeDeploy์˜ ๋กœ๊ทธํŒŒ์ผ์„ ํ•œ๋ฒˆ ๋ณด์•˜๋‹ค..
AWS CodeDeploy ๋กœ๊ทธ ๋ฐ์ดํ„ฐ ํ™•์ธ (๊ณต์‹๋ฌธ์„œ)

2023-09-18T17:03:56 WARN  [codedeploy-agent(2146)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Calling PutHostCommandComplete: "Code Error"
2023-09-18T17:03:56 INFO  [codedeploy-agent(2146)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.6.0-49_deb.
2023-09-18T17:03:56 INFO  [codedeploy-agent(2146)]: [Aws::CodeDeployCommand::Client 200 0.017882 0 retries] put_host_command_complete(command_status:"Failed",diagnostics:{format:"JSON",p
ayload:"{\"error_code\":5,\"script_name\":\"\",\"message\":\"The CodeDeploy agent did not find an AppSpec file within the unpacked revision directory at revision-relative path \\\"appspec.yml\\\". The revision was unpacked to directory \\\"

๋„ˆ๋ฌด ๋งŽ์•„์„œ ํ™•์ธํ•˜๊ธฐ ์–ด๋ ค์›Œ์„œ chatGPTํ•œํ…Œ ๋ฌผ์–ด๋ณด๋‹ˆ ใ…‹ใ…‹ใ…‹

  1. AppSpec ํŒŒ์ผ ์œ„์น˜ ํ™•์ธ: ํ”„๋กœ์ ํŠธ์˜ ๋ฐฐํฌ ํŒจํ‚ค์ง€(์••์ถ• ํŒŒ์ผ) ๋‚ด์— appspec.yml ํŒŒ์ผ์ด ์œ„์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ํŒŒ์ผ์˜ ๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ํ™•์ธํ•˜๊ณ , ํ•„์š”ํ•˜๋‹ค๋ฉด ํŒŒ์ผ์„ ์˜ฌ๋ฐ”๋ฅธ ์œ„์น˜์— ์ถ”๊ฐ€ํ•˜์„ธ์š”.

  2. AppSpec ํŒŒ์ผ ๋‚ด์šฉ ํ™•์ธ: appspec.yml ํŒŒ์ผ์—๋Š” ๋ฐฐํฌ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ •์˜ํ•˜๋Š” ๋‚ด์šฉ์ด ํฌํ•จ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ•„์š”ํ•œ ๋ช…๋ น์–ด, ๋ผ์ดํ”„์‚ฌ์ดํด ํ›„ํฌ, ํŒŒ์ผ ๋ณต์‚ฌ ๋“ฑ์˜ ์ •๋ณด๊ฐ€ ์ •์˜๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

  3. AppSpec ํŒŒ์ผ ๊ฒฝ๋กœ ํ™•์ธ: CodeDeploy๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ /opt/codedeploy-agent/deployment-root///deployment-archive/appspec.yml ๊ฒฝ๋กœ์—์„œ AppSpec ํŒŒ์ผ์„ ๊ธฐ๋Œ€ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ํ•ด๋‹น ๊ฒฝ๋กœ์— ํŒŒ์ผ์ด ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

  4. AWS CodeDeploy ์„ค์ • ํ™•์ธ: AWS CodeDeploy ์ฝ˜์†”์—์„œ ๋ฐฐํฌ ๊ทธ๋ฃน ๋ฐ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ค์ •์„ ํ™•์ธํ•˜์—ฌ ์˜ฌ๋ฐ”๋ฅธ AppSpec ํŒŒ์ผ ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

  5. ๋ฐฐํฌ ํ”„๋กœ์„ธ์Šค ๊ฒ€ํ† : AppSpec ํŒŒ์ผ์— ์ •์˜๋œ ๋ฐฐํฌ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ์ง€ ๊ฒ€ํ† ํ•˜๊ณ , ํ•„์š”ํ•œ ๋ช…๋ น์ด๋‚˜ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์ œ๋Œ€๋กœ ์ž‘์„ฑ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

AppSpec ํŒŒ์ผ์„ ์˜ฌ๋ฐ”๋ฅธ ์œ„์น˜์— ์ถ”๊ฐ€ํ•˜๊ณ  ๋‚ด์šฉ์„ ์ •ํ™•ํ•˜๊ฒŒ ์ž‘์„ฑํ•˜์—ฌ ๋‹ค์‹œ ๋ฐฐํฌ๋ฅผ ์‹œ๋„ํ•˜์‹ญ์‹œ์˜ค. ํ•„์š”ํ•œ ์„ค์ •์„ ํ™•์ธํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.


โญAppSpec ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Œโญ

appspec ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค๋Š”๊ฒŒ appsec.yml ์ด๋ผ๊ณ  ๋งŒ๋“ค์—ˆ๋‹ค..
๊ทธ๋ž˜์„œ appsec.yml -> appspec.yml ์ด๋ผ๊ณ  ๊ณ ์น˜๊ณ  ๋‹ค์‹œ ์ปค๋ฐ‹ํ•˜์˜€๋”๋‹ˆ..

1. Travis CI ๋นŒ๋“œ Complete

2. CodeDeploy ๋ฐฐํฌ ์„ฑ๊ณต

3. EC2 ๋””๋ ‰ํ„ฐ๋ฆฌ์— ํ”„๋กœ์ ํŠธ ๋ฐฐํฌ ์™„๋ฃŒ..

๋จธ๋ฆฌ๊ฐ€ ๋ตํ•˜๋‹ค..ใ…Žใ…Ž

0๊ฐœ์˜ ๋Œ“๊ธ€