-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from TEAM-MONGDOL/develop
[merge] main <- develop
- Loading branch information
Showing
29 changed files
with
213 additions
and
131 deletions.
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ on: | |
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
@@ -27,31 +26,39 @@ jobs: | |
echo "tag=$latest_tag" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Deploy to Web Servers | ||
env: | ||
BASTION_IP: ${{ secrets.BASTION_IP }} | ||
USER: ${{ secrets.BASTION_USER }} | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
KCR_USERNAME: ${{ secrets.ACCESS_KEY }} | ||
KCR_PASSWORD: ${{ secrets.ACCESS_SECRET_KEY }} | ||
WEB_IPS: ${{ secrets.WEB_IPS }} | ||
DEPLOY_TAG: ${{ steps.get_tag.outputs.tag }} | ||
run: | | ||
echo "$SSH_KEY" > ssh_key | ||
chmod 600 ssh_key | ||
ssh -i ssh_key -o StrictHostKeyChecking=no $USER@$BASTION_IP << 'EOF' | ||
IFS=',' read -ra WEB_IP_ARRAY <<< "$WEB_IPS" | ||
for WEB_IP in "${WEB_IP_ARRAY[@]}"; do | ||
ssh -i ssh_key -o StrictHostKeyChecking=no $USER@$WEB_IP << 'ENDSSH' | ||
echo $KCR_PASSWORD | docker login dkation.kr-central-2.kcr.dev -u $KCR_USERNAME --password-stdin | ||
- name: Setup SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_KEY }} | ||
|
||
- name: Deploy to FE | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.BASTION_HOST }} | ||
username: ${{ secrets.USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
IFS=',' read -r -a HOSTS <<< "${{ secrets.WEB_IPS }}" | ||
for host in "${HOSTS[@]}" | ||
do | ||
echo "$host" | ||
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ubuntu@$host << EOF | ||
echo "Stopping and removing existing containers" | ||
docker ps -q --filter ancestor=dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe | xargs -r docker stop | ||
docker ps -aq --filter ancestor=dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe | xargs -r docker rm | ||
echo "Removing old Docker images" | ||
docker images dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe --format '{{.ID}}' | xargs -r docker rmi | ||
docker pull dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe:${DEPLOY_TAG} | ||
docker run -d -p 80:3000 dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe:${DEPLOY_TAG} | ||
ENDSSH | ||
done | ||
EOF | ||
rm ssh_key | ||
echo "Login to KCR" | ||
docker login dkation.kr-central-2.kcr.dev --username ${{ secrets.ACCESS_KEY }} --password ${{ secrets.ACCESS_SECRET_KEY }} | ||
echo "Pulling new Docker image" | ||
docker pull dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe:${{ steps.get_tag.outputs.tag }} | ||
echo "Running new Docker container" | ||
docker run -d -p 80:3000 dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe:${{ steps.get_tag.outputs.tag }} | ||
EOF | ||
done |
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
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 |
---|---|---|
|
@@ -15,5 +15,6 @@ declare module 'next-auth' { | |
accessToken: string; | ||
accountId: number; | ||
isAdmin: boolean; | ||
expiredAt: number; | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.