CircleCI๋ก SpringBoot+Postgresql ํ๋ก์ ํธ ๋น๋ ๋ฐฐํฌํ๊ธฐ(1)
๋น๋ ๋ฐฐํฌ ํ๋ฆ
์ฌ์ ์ค๋น
AWS IAM ์ญํ (Role) ์ค์
EC2CodeDeployRole ์์ฑ
CodeDeployRole ์์ฑ
AWS EC2 IAM ์ญํ ์์
AWS IAM ์ฌ์ฉ์ ์ถ๊ฐ
CircleCI๋ก SpringBoot+Postgresql ํ๋ก์ ํธ ๋น๋ ๋ฐฐํฌํ๊ธฐ(2)
AWS S3 ๋ฒํท ์์ฑ
AWS CodeDeploy ์์ฑ
AWS EC2 ์ ์ํ์ฌ CodeDeploy Agent ์ค์น
AWS EC2 Postgresql ์ค์น
CircleCI๋ก SpringBoot+Postgresql ํ๋ก์ ํธ ๋น๋ ๋ฐฐํฌํ๊ธฐ(3)
์์ค์ฝ๋ ์์
.circleci > config.ymlํ์ผ
ํ๋ก์ ํธํด๋ > appspec.yml
ํ๋ก์ ํธํด๋ > scripts > deploy.sh
ํ๋ก์ ํธํด๋ > src > main > resources > application.yml
CircleCI Context์ค์
AWS ํ๊ฒฝ๋ณ์ ์ ์ฅ
ํ๋ก์ ํธ ํ๊ฒฝ๋ณ์ ์ ์ฅ
๊นํ๋ธ ์์ค์ฝ๋ pushํ์ฌ ๋น๋ ๋ฐฐํฌ ํ์ธ
ํํํ๋ฉด์ ๊ณต๋ถํ ๋ด์ฉ์ด๋ค (์ฌ์ค ๊ณต๋ถ๋ ์๋๊ณ ์ด๋ป๊ฒ ๋์ํ๋์ง๋ง ์ฐ์ด๋จน์ด๋ณธ ์ ๋..)
์ ์ดํดํ์ง ๋ชปํ ๋ถ๋ถ๋ ๋ง๊ณ ์์ฒญ ํค๋งค์๋ค. ์ผ๋จ ์ด๋ป๊ฒ ๋์๋์๋์ง ๋จ๊ฒจ๋๋ ์ฉ๋๋ก ์์ฑํ๋ ๊ธ์ด๋ค
AWS S3 ๋ฒํท ์์ฑ
1. ๋ฒํท ๋ง๋ค๊ธฐ ํด๋ฆญ
2. ๋ฒํท ๋ง๋ค๊ธฐ
AWS CodeDeploy ์์ฑ
1. ์ ํ๋ฆฌ์ผ์ด์ ์์ฑ ํด๋ฆญ
2. ์ ํ๋ฆฌ์ผ์ด์ ์ด๋ฆ : EC2CodeDeployTest, ์ปดํจํ ํ๋ซํผ EC2/์จํ๋ ๋ฏธ์ค ์ ํ
3. ๋ฐฐํฌ๊ทธ๋ฃน ์์ฑ ํด๋ฆญ
4. ์ค์ ํ ๋ฐฐํฌ๊ทธ๋ฃน ์์ฑ
AWS EC2 ์ ์ํ์ฌ CodeDeploy Agent ์ค์น
sudo apt-get update
sudo apt-get upgrade
#์๋ฐ ์ค์น
sudo apt install openjdk-11-jdk
#aws-cli ์ค์น
sudo apt-get install awscli
#aws ์ค์
sudo aws configure
์ฌ๊ธฐ์ [AWS IAM ์ฌ์ฉ์ ์ถ๊ฐ] ์์ ์ ์ฅํ csvํ์ผ์ ๋ฉ๋ชจ์ฅ์ผ๋ก ์ด๊ณ , configure์ ์ ๋ ฅํด์ค๋ค
Default region name์ ap-northeast-2(์์ธ)
Default output format์ json์ผ๋ก ์ ๋ ฅํ๋ค
#ruby ์ค์น (agent๋ ruby๋ก ๋ง๋ค์ด์ง)
sudo apt-get install ruby
#agent ์ค์นํ์ผ ๋ค์ด
wget https://aws-codedeploy-ap-northeast-2.s3.amazonaws.com/latest/install
#์คํ๊ถํ ์์
chmod +x ./install
#agent ์ค์น
sudo ./install auto
#agent ์คํ ํ์ธ
sudo service codedeploy-agent status
AWS EC2 Postgresql ์ค์น
#postgresql ์ค์น
sudo apt-get install postgresql postgresql-contrib
#postgres ์ ์ ๋ก ๋ณ๊ฒฝ
sudo -i -u postgres
#postgresql ์ ์
psql
#postgresql postgres ๊ณ์ ๋น๋ฐ๋ฒํธ ์ค์
alter user postgres with password '1234';
'๐งฐ DevOps' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
AWS S3 SFTP๋ก ์ ์ํ๊ธฐ (0) | 2022.06.01 |
---|---|
CircleCI๋ก SpringBoot+Postgresql ํ๋ก์ ํธ ๋น๋ ๋ฐฐํฌํ๊ธฐ(3) (0) | 2022.03.18 |
CircleCI๋ก SpringBoot+Postgresql ํ๋ก์ ํธ ๋น๋ ๋ฐฐํฌํ๊ธฐ(1) (0) | 2022.03.18 |
AWS EC2 Jenkins ์ค์น (0) | 2022.03.18 |
SpringBoot, MariaDB ํ๋ก์ ํธ AWS ๋ฐฐํฌํ๊ธฐ ์ด์ ๋ฆฌ(3)โ (1) | 2022.02.19 |