Skip to content
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

๐Ÿ”€ :: code-deploy๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ์œผ๋กœ ์ธํ•œ CD ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ • #385

Merged
merged 17 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions .github/workflows/sms_backend_master_cd.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: sms-production-CD

on:
push:
branches: [ "master" ]
workflow_dispatch:

jobs:
CD:
name: CD
cd:
runs-on: ubuntu-latest
environment: production

steps:
- name: SMS-Backend-CD Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ success() }}
with:
title: โ„น๏ธ SMS-Backend-CD ์‹œ์ž‘! โ„น๏ธ
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
Expand Down Expand Up @@ -63,30 +62,34 @@ jobs:
docker tag ${{ secrets.ECR_REPOSITORY }}:${{ secrets.IMAGE_TAG }} ${{ secrets.REPO_URL }}:${{ secrets.IMAGE_TAG }}
docker push ${{ secrets.REPO_URL }}:${{ secrets.IMAGE_TAG }}

- name : CodeDeploy Create Deployment
run: |
aws deploy create-deployment \
--application-name codedeploy-application \
--deployment-group-name codedeploy-group \
--deployment-config-name CodeDeployDefault.OneAtATime \
--github-location repository=${{ github.repository }},commitId=${{ github.sha }}
- name: Execute remote SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
key: ${{ secrets.REMOTE_SSH_KEY }}
port: ${{ secrets.REMOTE_SSH_PORT }}
script: |
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin ${{secrets.ECR_REPO_PATH}}
docker pull ${{ secrets.REPO_URL }}:${{ secrets.IMAGE_TAG }}
Copy link
Collaborator

@HumanIearning HumanIearning Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ…Œ์ŠคํŠธํ•ด๋ณด์…จ๋‚˜์š”?
์ˆ˜๋™์œผ๋กœ ์ ‘์†ํ–ˆ์„๋•Œ๋Š” ์™œ์ธ์ง€ ๋ชจ๋ฅด๊ฒ ๋Š”๋ฐ aws credential ์—๋Ÿฌ๊ฐ€ ๋– ์„œ loginํ•˜๊ณ  pullํ–ˆ์—ˆ๋Š”๋ฐ
์•ˆ ๋œฐ ์ˆ˜๋„ ์žˆ์–ด์„œ ์ผ๋‹จ์€ ๋ƒ…๋‘๊ณ  ๊ด€๋ จ ์—๋Ÿฌ ๋ฐœ์ƒํ•˜๋ฉด ecr์— ์žˆ๋Š” aws ecr login ๋ช…๋ น์–ด ํ•œ์ค„ ๋ณต์‚ฌํ•ด์„œ ๋ฏผ๊ฐํ•œ ๋ถ€๋ถ„ secret์œผ๋กœ ๊ฐ€๋ฆฌ๊ณ  ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ๋ ๊ฑฐ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ…Œ์ŠคํŠธ๋Š” ํ•ด๋ดค๋Š”๋ฐ local์—์„œ credentail ์—๋Ÿฌ๊ฐ€ ๋œจ๋Š” ๊ฒฝ์šฐ๋ฅผ ๊ณ ๋ คํ•˜์ง€ ๋ชปํ–ˆ๋„ค์š” :( ์ถ”๊ฐ€ํ•˜๊ณ  ๋ฉ˜์…˜๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค

docker compose restart

- name: SMS-Backend-CD Discord Notification
- name: SMS-Backend-CD Discord Notification (Success)
uses: sarisia/actions-status-discord@v1
if: ${{ success() }}
if: success()
with:
title: โœ… SMS-Backend-CD ์„ฑ๊ณต! โœ…
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
status: ${{ job.status }}
image: ${{ secrets.CD_SUCCESS_IMAGE }}
description: ์˜์—ญ์ „๊ฐœ CD ์„ฑ๊ณต
description: ํ”„๋กœ๋•์…˜ CD ์„ฑ๊ณต
color: 00FF00
username: SMS CD ๋ด‡
url: https://github.com/GSM-MSG/SMS-BackEnd

- name: SMS-Backend-CD Discord Notification
- name: SMS-Backend-CD Discord Notification (Failure)
uses: sarisia/actions-status-discord@v1
if: ${{ failure() }}
if: failure()
with:
title: โ—๏ธ SMS-Backend-CD ์‹คํŒจ! โ—๏ธ
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
Expand All @@ -95,4 +98,4 @@ jobs:
description: ๋ฌด๋ก€ํ•˜๊ธด, ์‹คํŒจ๋‹ค.
color: FF0000
username: SMS CD ๋ด‡
url: https://github.com/GSM-MSG/SMS-BackEnd
url: https://github.com/GSM-MSG/SMS-BackEnd
Loading