Skip to content

Commit

Permalink
Merge pull request #58 from IxxP-Girls/comment
Browse files Browse the repository at this point in the history
Chore: CD 스크립트에 deploy 추가, codedeploy 설정
  • Loading branch information
diddnwjd committed Jan 31, 2024
2 parents ec8536c + 38f0af7 commit 0e62b21
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/CD → .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ jobs:

# S3에 업로드
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip

# Deploy
- name: Deploy
run: |
aws deploy create-deployment \
--application-name culpop-project \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name culpop \
--file-exists-behavior OVERWRITE \
--s3-location bucket=culpop-bucket,bundleType=zip,key=culpop/$GITHUB_SHA.zip \
--region ap-northeast-2 \
20 changes: 20 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 0.0
os: linux
# S3에 있는 zip 파일이 EC2에 배포될 위치를 지정
files:
- source: / # CodeDeploy에서 전달해 준 파일 중 destination으로 이동시킬 대상을 루트로 지정(전체파일)
destination: /home/ubuntu/ # source에서 지정된 파일을 받을 위치, 이후 jar를 실행하는 등은 destination에서 옮긴 파일들로 진행
overwrite: yes

permissions: # CodeDeploy에서 EC2서버로 넘겨준 파일들을 모두 ubuntu 권한을 갖도록 합니다.
- object: /
pattern: "**"
owner: ubuntu
group: ubuntu

# ApplicationStart 단계에서 deploy.sh를 실행시키도록 합
hooks: # CodeDeploy 배포 단계에서 실행할 명령어를 지정합니다.
ApplicationStart: # deploy.sh를 ubuntu 권한으로 실행합니다.
- location: scripts/deploy.sh
timeout: 60 # 스크립트 실행 60초 이상 수행되면 실패가 됩니다.
runas: ubuntu

0 comments on commit 0e62b21

Please sign in to comment.