-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CD 구축 #90
Merged
Merged
CD 구축 #90
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2b705eb
chore: sidepeek_backend_secret PULL
uijin-j 5116ee8
chore: 모든 설정 정보를 sidepeek_backend_secret 하위 파일에서 import
uijin-j 0821e5f
chore: ci 시 active-profile을 local로 설정
uijin-j 0121f54
chore: cd를 위한 github actions 워크플로우 생성
uijin-j f1d647d
chore: CodeDeploy 설정 파일 (Appspec.yml) 작성
uijin-j f003580
chore: 배포 쉘 스크립트(deploy.sh) 작성
uijin-j 75ffbf9
fix: Github Actions 레디스 설정 오류 해결
uijin-j 9e330f4
fix: cd 시 권한이 없어 실행되지 않는 오류 해결
uijin-j 43044da
fix: ec2에서 sidepeek_backend_secret 서브모듈을 읽지 못하는 오류 해결
uijin-j 0ad6443
chore: sidepeek_backend_secret PULL
uijin-j 3a4a1cc
chore: 배포 쉘 스크립트(deploy.sh) 수정
uijin-j a529844
chore: application.yml 제거
uijin-j 73ebb5e
chore: deploy.sh 불필요한 \n 제거
uijin-j 56d35b1
chore: application-dev.yml import 파일 절대 경로로 변경
uijin-j 9d68436
fix: secret 파일을 읽지 못하는 오류 해결
uijin-j ac31c6b
chore: 애플리케이션이 백그라운드로 실행되지 않는 오류 해결
uijin-j c742bb3
chore: dev 브랜치에 push 시 CD가 적용되도록 변경
uijin-j e050058
chore: sidepeek_backend_secret PULL
uijin-j File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: SidePeek CD with Gradle | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
redis-version: [ latest ] | ||
|
||
steps: | ||
- name: Repository Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.ACTION_TOKEN }} | ||
submodules: true | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: Set up Redis | ||
uses: supercharge/[email protected] | ||
with: | ||
redis-version: ${{ matrix.redis-version }} | ||
redis-port: ${{ secrets.TEST_REDIS_PORT }} | ||
|
||
- name: Set up MySQL | ||
uses: samin/[email protected] | ||
with: | ||
mysql user: ${{ secrets.TEST_DB_USER }} | ||
mysql password: ${{ secrets.TEST_DB_PASSWORD }} | ||
mysql database: ${{ secrets.TEST_DB }} | ||
host port: ${{ secrets.TEST_DB_PORT }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build -Dspring.profiles.active=dev | ||
|
||
- name: Make Zip File | ||
run: zip -qq -r ./$GITHUB_SHA.zip . | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
- name: Upload to S3 | ||
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://${{ secrets.S3_BUCKET_NAME }}/deploy/$GITHUB_SHA.zip | ||
|
||
- name: Deploy with AWS codeDeploy | ||
run: aws deploy create-deployment | ||
--application-name ${{ secrets.CODE_DEPLOY_APP_NAME }} | ||
--deployment-config-name CodeDeployDefault.AllAtOnce | ||
--deployment-group-name ${{ secrets.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} | ||
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=deploy/$GITHUB_SHA.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[submodule "sidepeek_backend_secret"] | ||
path = sidepeek_backend_secret | ||
url = https://github.com/side-peek/sidepeek_backend_secret.git | ||
branch = dev | ||
url = git@github.com:side-peek/sidepeek_backend_secret.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: 0.0 | ||
os: linux | ||
|
||
files: | ||
- source: / | ||
destination: /home/ubuntu/app | ||
overwrite: yes | ||
|
||
permissions: | ||
- object: / | ||
pattern: "**" | ||
owner: ubuntu | ||
group: ubuntu | ||
|
||
hooks: | ||
AfterInstall: | ||
- location: scripts/deploy.sh | ||
timeout: 60 | ||
runas: ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
REPOSITORY=/home/ubuntu/app | ||
echo "👀 [$REPOSITORY] 경로로 이동합니다." | ||
cd $REPOSITORY | ||
|
||
APP_NAME=sidepeek | ||
JAR_NAME=$(ls $REPOSITORY/build/libs/ | grep '.jar' | tail -n 1) | ||
JAR_PATH=$REPOSITORY/build/libs/$JAR_NAME | ||
|
||
CURRENT_PID=$(pgrep -f $APP_NAME) | ||
|
||
if [ -z "$CURRENT_PID" ] | ||
then | ||
echo "👀 실행 중인 애플리케이션이 없어 곧바로 실행합니다." | ||
else | ||
echo "❌ 실행 중인 애플리케이션이 있어 이를 종료합니다. [PID = $CURRENT_PID]" | ||
kill -15 "$CURRENT_PID" | ||
sleep 5 | ||
fi | ||
|
||
echo "👀 $JAR_PATH 배포합니다!" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 메시지가 귀엽군요,,👀 |
||
nohup java -jar -Dspring.profiles.active=dev build/libs/$JAR_NAME > $REPOSITORY/nohup.out 2>&1 & |
Submodule sidepeek_backend_secret
updated
from 4a3a6e to fe3e29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
spring: | ||
config: | ||
import: /home/ubuntu/app/sidepeek_backend_secret/application-dev.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
spring: | ||
config: | ||
import: file:./sidepeek_backend_secret/application-local.yml | ||
jpa: | ||
show-sql: true | ||
open-in-view: false | ||
hibernate: | ||
ddl-auto: validate | ||
flyway: | ||
enabled: true | ||
locations: classpath:db/migration, classpath:db/data |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
spring: | ||
config: | ||
import: file:./sidepeek_backend_secret/application-test.yml | ||
jpa: | ||
show-sql: true | ||
open-in-view: false | ||
hibernate: | ||
ddl-auto: validate | ||
flyway: | ||
enabled: true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 요거는 문법이 따로 있는건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존에는 HTTP로 서브모듈 연결(ex. https://XXX ) 했는데, EC2에서는 HTTP가 아니라 SSH로 연결을 해야되서 url만 변경한 것입니당!
branch는 제가 실수로 서브모듈 브랜치가 아니라, 저희 개발 레포 브랜치를 적었어서 수정했습니당!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아아아 ssh 였군요! 알려주셔서 감사합니당! :)