๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ›  Infrastructure39

Github Action ๊ณผ Elastic Beanstalk ๋กœ ์„œ๋ฒ„ ๋ฐฐํฌํ•˜๊ธฐ - Github Actions ์ •์˜ํ•˜๊ธฐ ํ•ด๋‹น ์‹œ๋ฆฌ์ฆˆ๋Š” 3๊ฐœ์˜ ๊ธ€๋กœ ๊ตฌ์„ฑ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ ๋‹จ๊ณ„์˜ ์ž์„ธํ•œ ์‚ฌํ•ญ์€ ์•„๋ž˜ ๋งํฌ๋ฅผ ์ฐธ์กฐํ•ด์ฃผ์„ธ์š” 1ํŽธ Spring Boot ์„œ๋ฒ„ ์ƒ์„ฑํ•˜๊ธฐ 2ํŽธ Elastic Beanstalk ์ƒ์„ฑํ•˜๊ธฐ 3ํŽธ Github Actions ์ •์˜ํ•˜๊ธฐ ํ•ด๋‹น ๊ธ€์˜ ์‹ค์Šต ์ฝ”๋“œ ๋ฐ github repository ์ง€๋‚œ ์‹œ๊ฐ„... ์ง€๋‚œ ์‹œ๊ฐ„ ์šฐ๋ฆฌ๋Š” Spring Boot ๋ฅผ ์ด์šฉํ•ด์„œ Application ์„œ๋ฒ„๋ฅผ ์ƒ์„ฑํ–ˆ๊ณ  Elastic Beanstalk ๋ฅผ ์ƒ์„ฑ ํ–ˆ๋‹ค. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” Github Actions ๋ฅผ ์ด์šฉํ•˜์—ฌ Master branch ์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์žˆ๋‹ค๋ฉด ์ž๋™์œผ๋กœ ๋ฐฐํฌํ•˜๋Š” ๋ฐฐํฌ ์ž๋™ํ™”์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด์ž. Github Actions ์— ๋Œ€ํ•ด์„œ ๋” ์ž์„ธํžˆ Github Actions ๋Š” ๊นƒํ—ˆ๋ธŒ์—์„œ ๊ณต์‹์ ์œผ๋กœ ์ œ๊ณตํ•˜๋Š” workflow ์ž.. 2022. 1. 23.
Github Action ๊ณผ Elastic Beanstalk ๋กœ ์„œ๋ฒ„ ๋ฐฐํฌํ•˜๊ธฐ - EB ์ƒ์„ฑํ•˜๊ธฐ ํ•ด๋‹น ์‹œ๋ฆฌ์ฆˆ๋Š” 3๊ฐœ์˜ ๊ธ€๋กœ ๊ตฌ์„ฑ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ ๋‹จ๊ณ„์˜ ์ž์„ธํ•œ ์‚ฌํ•ญ์€ ์•„๋ž˜ ๋งํฌ๋ฅผ ์ฐธ์กฐํ•ด์ฃผ์„ธ์š” 1ํŽธ Spring Boot ์„œ๋ฒ„ ์ƒ์„ฑํ•˜๊ธฐ 2ํŽธ Elastic Beanstalk ์ƒ์„ฑํ•˜๊ธฐ 3ํŽธ Github Actions ์ •์˜ํ•˜๊ธฐ ํ•ด๋‹น ๊ธ€์˜ ์‹ค์Šต ์ฝ”๋“œ ๋ฐ github repository ์ง€๋‚œ ์‹œ๊ฐ„... ์ง€๋‚œ ์‹œ๊ฐ„ ์šฐ๋ฆฌ๋Š” Spring Boot ๋ฅผ ์ด์šฉํ•ด์„œ Application ์„œ๋ฒ„๋ฅผ ์ƒ์„ฑํ–ˆ๊ณ  github ์— push ํ•˜๋Š” ์ž‘์—…๊นŒ์ง€ ๋งˆ์ณค๋‹ค. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” Elastic Beanstalk ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๊ณ  ์‹ค์ œ๋กœ ์ƒ์„ฑ์„ ํ•ด๋ณด๋„๋ก ํ•˜์ž. Elastic Beanstalk ์— ๋Œ€ํ•ด์„œ ๋” ์ž์„ธํžˆ Elastic Beanstalk ์— ๋Œ€ํ•ด์„œ ๋‹ค์‹œ ํ•œ ๋ฒˆ ์ •์˜ํ•ด๋ณด์ž. Elastic Beanstalk ๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•˜๋Š” .. 2022. 1. 23.
Github Action ๊ณผ Elastic Beanstalk ๋กœ ์„œ๋ฒ„ ๋ฐฐํฌํ•˜๊ธฐ - Spring Boot ์„œ๋ฒ„ ์ƒ์„ฑํ•˜๊ธฐ ํ•ด๋‹น ์‹œ๋ฆฌ์ฆˆ๋Š” 3๊ฐœ์˜ ๊ธ€๋กœ ๊ตฌ์„ฑ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ ๋‹จ๊ณ„์˜ ์ž์„ธํ•œ ์‚ฌํ•ญ์€ ์•„๋ž˜ ๋งํฌ๋ฅผ ์ฐธ์กฐํ•ด์ฃผ์„ธ์š” 1ํŽธ Spring Boot ์„œ๋ฒ„ ์ƒ์„ฑํ•˜๊ธฐ 2ํŽธ Elastic Beanstalk ์ƒ์„ฑํ•˜๊ธฐ 3ํŽธ Github Actions ์ •์˜ํ•˜๊ธฐ ํ•ด๋‹น ๊ธ€์˜ ์‹ค์Šต ์ฝ”๋“œ ๋ฐ github repository ๋™๊ธฐ ์ตœ๊ทผ ์‚ฌ๋‚ด์—์„œ ์ƒˆ๋กญ๊ฒŒ ๊ฐœ๋ฐœํ•˜๋Š” ์„œ๋ฒ„๋ฅผ EB ์™€ Github Action ์„ ์ด์šฉํ•˜์—ฌ ๋ฐฐํฌ ์ž๋™ํ™” ๊ตฌ์„ฑ์„ ํ•˜๋Š” ๊ธฐํšŒ๊ฐ€ ์ƒ๊ฒผ์—ˆ๋‹ค. ์ง€๊ธˆ๊นŒ์ง€ ํ•ด๋ดค๋˜ CI/CD, ๋ฐฐํฌ ์ž๋™ํ™”๋Š” ๋‹ค์Œ 2๊ฐœ์ด๋‹ค. Travis CI + CodeDeploy EC2 + Jenkins ์ฒ˜์Œ ์ž๋™ํ™”์— ๋Œ€ํ•ด์„œ ํ•™์Šตํ•  ๋•Œ Elastic Beanstalk ์— ๋Œ€ํ•œ ํ›„๊ธฐ๋Š” ๊ฑฐ์˜ ๋ชป๋ณด๋‹ค ์‹ถ์ด ํ–ˆ์ง€๋งŒ ํ˜„์žฌ๋Š” EB ์™€ Github Action ์— ๋Œ€ํ•œ ์„ฑ๊ณต ์ผ€์ด์Šค๊ฐ€ ๋งŽ์•„.. 2022. 1. 23.
Docker Timezone์œผ๋กœ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ(UTC to KST) ํ•ด๊ฒฐํ•˜๊ธฐ ๋ฌธ์ œ ์ƒํ™ฉ ๋ฌธ์ œ ์ƒํ™ฉ์€ ์ด๋žฌ๋‹ค. ๋‚ด๊ฐ€ Spring Boot Application ์œผ๋กœ Backend API ๋ฅผ ์ œ๊ณตํ•˜๋Š” ์„œ๋ฒ„๋ฅผ Dockerizing ํ•˜์˜€๋‹ค. ํ•ด๋‹น Application ์€ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ํ…Œ์ŠคํŠธ ์ด๋ฏธ์ง€์—์„œ ์ดˆ๊ธฐ initial data ๋ฅผ ์œ„ํ•ด์„œ import.sql ๋กœ ๊ฐ€์งœ ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ์–ด์ฃผ๊ณ  ์žˆ์—ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  Controller ์—์„œ ์ œ๊ณตํ•˜๋Š” API ์ค‘ ํ•˜๋‚˜๊ฐ€ ํ˜„์žฌ ์‹œ๊ฐ„์„ ๊ธฐ์ค€์œผ๋กœ -24์‹œ๊ฐ„ ๊นŒ์ง€์˜ ํŠน์ • ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ๋˜๋Š”๋ฐ, ๋งŒ์•ฝ ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์œผ๋ฉด ์˜ˆ์™ธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚จ๋‹ค. ๊ทธ๋ž˜์„œ ๊ณ„์†ํ•ด์„œ 500 Internal Server Error ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค. ๊ทธ๋ž˜์„œ ์–ด๋–ค ๋ฌธ์ œ์ธ์ง€ ์ •ํ™•ํžˆ ํŒŒ์•…ํ•˜๊ธฐ ์œ„ํ•ด์„œ docker logs ๋ฅผ ํ†ตํ•ด์„œ ๋‚ด๋ถ€๋กœ ๋“ค์–ด์˜ค๋Š” ํŠธ๋ž˜ํ”ฝ์˜ Application Layer ์˜ ๋กœ๊ทธ๋ฅผ ์ฐ.. 2021. 8. 18.