๋ชฉ๋กInfra/CI CD (7)

suvera-dev ๐Ÿฅฆ

AWS ๋ฐฐํฌ์ž๋™ํ™” ๊ตฌ์ถ• _ 6. React ํ”„๋กœ์ ํŠธ ๋ฐฐํฌ

์ด์ „์— index.html ํŒŒ์ผํ•˜๋‚˜๋กœ ๋ฐฐํฌ ํ…Œ์ŠคํŠธ๋ฅผ ํ–ˆ์—ˆ๋Š”๋ฐ, ์‹ค์ œ๋กœ ๋ฐฐํฌํ•ด์•ผํ•˜๋Š” ํ”„๋กœ์ ํŠธ๋Š” React ํ”„๋กœ์ ํŠธ๋กœ ๊ตฌ์„ฑํ•  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— React ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  ์ž˜ ๋œจ๋Š”์ง€ ํ™•์ธํ•ด๋ณด์ž. 1. React ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ - ๋ฆฌ์•กํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๊ฐ„๋‹จํ•˜๋‹ค. - ์ด์ „์— ์ง„ํ–‰ํ–ˆ๋˜ ํด๋”์—์„œ ๊ทธ๋Œ€๋กœ React ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค์–ด์ฃผ์—ˆ๋‹ค. Node.js ์„ค์น˜ ์ž‘์—…์šฉ ํด๋” ๋งŒ๋“ค๊ธฐ ํ„ฐ๋ฏธ๋„์—์„œ npx create-react-app ํ”„๋กœ์ ํŠธ๋ช… ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์ž๋™์ ์œผ๋กœ ํ•„์š”ํ•œ ํด๋”๋“ค์ด ์„ธํŒ…๋œ๋‹ค. 2. Docker ํŒŒ์ผ ์ˆ˜์ • ์•„๋ž˜์— ๊ฐ ์ฝ”๋“œ ์„ค๋ช…์„ ์ ์–ด๋‘์—ˆ๋‹ค. # base image ์„ค์ •(as build ๋กœ ์™„๋ฃŒ๋œ ํŒŒ์ผ์„ ๋ฐ‘์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.) FROM node:14-alpine as build # ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€ ์ž‘..

Infra/CI CD 2023. 7. 14. 14:39
AWS ๋ฐฐํฌ์ž๋™ํ™” ๊ตฌ์ถ• _ 4. ECS ์ƒ์„ฑ ๋ฐ ELB ์—ฐ๊ฒฐ / ECR image ๋ฐฐํฌ

์ด๋ฒˆ ํ”„๋กœ์„ธ์Šค๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. - ECS ์ƒ์„ฑ : Cluster, Service, Task Definition - ELB ์ƒ์„ฑ , ์—ฐ๊ฒฐ - EC2 ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ : Auto Scaling Group ์‹œ์ž‘ํ•˜๊ธฐ ์ „์— ๊ฐ„๋‹จํžˆ ๊ฐœ๋…์„ ์ •๋ฆฌํ•˜๊ณ  ๋„˜์–ด๊ฐ€์ž. 1. EC2 : ๊ฐ€์ƒ ์„œ๋ฒ„์ธ EC2 ์ธ์Šคํ„ด์Šค๋ฅผ ํ”„๋กœ๋น„์ €๋‹ํ•˜๊ณ  ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. EC2 ์ธ์Šคํ„ด์Šค๋Š” ๊ฐ€์ƒ ์ปดํ“จํ„ฐ๋กœ, ๋‹ค์–‘ํ•œ ์šด์˜ ์ฒด์ œ์™€ ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. EC2 ์ธ์Šคํ„ด์Šค๋Š” ๊ฐ€์ƒ ํ”„๋ผ์ด๋น— ํด๋ผ์šฐ๋“œ(VPC) ๋‚ด์—์„œ ์‹คํ–‰๋˜๋ฉฐ, ์ธํ„ฐ๋„ท์„ ํ†ตํ•ด ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 2. Auto Scaling Group : ์˜คํ† ์Šค์ผ€์ผ๋ง ๊ทธ๋ฃน์€ EC2 ์ธ์Šคํ„ด์Šค์˜ ๊ทธ๋ฃน์ž…๋‹ˆ๋‹ค. ์ด ๊ทธ๋ฃน์€ ์‚ฌ์šฉ์ž๊ฐ€ ์ •์˜ํ•œ ์กฐ๊ฑด์— ๋”ฐ๋ผ EC2 ์ธ์Šคํ„ด์Šค๋ฅผ ์ž๋™์œผ๋กœ ํ”„๋กœ๋น„์ €๋‹ํ•˜๊ณ  ์กฐ์ •ํ•˜์—ฌ ์• ํ”Œ๋ฆฌ์ผ€..

Infra/CI CD 2023. 7. 14. 01:15
AWS ๋ฐฐํฌ์ž๋™ํ™” ๊ตฌ์ถ• _ 3. Github Actions์œผ๋กœ docker image ์—…๋กœ๋“œ ์ž๋™ํ™”

AWS ๋ฐฐํฌ์ž๋™ํ™” ๊ตฌ์ถ• _ 2. Docker ํ™˜๊ฒฝ ๊ตฌ์ถ• / ECR์— ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์ด๋ฒˆ์—๋Š” ECRํ…Œ์ŠคํŠธ ์šฉ EC2๋ฅผ ๋งŒ๋“ค๊ธฐ, ๋„์ปค ํ™˜๊ฒฝ ๊ตฌ์ถ•, ๋นŒ๋“œํ•œ ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ECR์— ์—…๋กœ๋“œ ํ•˜๋Š” ๊ณผ์ •์ด๋‹ค. - ์ตœ์ข… flow๋Š” ์œ„์™€ ๊ฐ™๋‹ค. ๊ฐœ๋ฐœ์ž๊ฐ€ github ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— Push ํ–ˆ์„ ๋•Œ github act suvera.tistory.com ์•ž์„  ํฌ์ŠคํŒ…์—์„œ ์ˆ˜๋™์œผ๋กœ ํ–ˆ๋˜ ์ž‘์—…( ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ๋นŒ๋“œํ•˜๊ณ  ECR์— ์—…๋กœ๋“œํ•˜๋Š” ๊ณผ์ • )์„ Github Actions์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐœ๋ฐœ์ž๊ฐ€ ๊นƒํ—™์— push๋ฅผ ํ–ˆ์„ ๋•Œ ์ž๋™์œผ๋กœ ์ˆ˜ํ–‰๋˜๋„๋ก ํ•˜๋Š” ๊ณผ์ •์„ ๋‹ค๋ฃฐ ๊ฒƒ์ด๋‹ค ! ์›น ์„œ๋ฒ„ : nginx ํ”„๋กœ์„ธ์Šค : ๊นƒํ—™ main ๋ธŒ๋žœ์น˜์— push ๋ช…๋ น์ด ์ผ์–ด๋‚  ๊ฒฝ์šฐ, test, formatting & code analysis๋ฅผ..

Infra/CI CD 2023. 7. 13. 21:28