forked from kode-krew/meta-test-be
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix: cors 설정 수정 * Add reset password * Modify cors setting * Add feature related to verify email * Modify env-example * Set env * Modify error status * Fix: 인증 토큰 부분 헤더 설정 수정 * Fix: 소셜 로그인 api 헤더 * modify oAuthLogin Service * Modify test result * Add verify token * Add http exception filter * Modify token error * Remove unnessary code * Add swagger api response * Modify create test response * Modify get test list * Modify create test * Modify base exception filter * Modify base erorr filter * Add swagger get user * Add swagger create user * Add swagger get user test list * Modify try catch block * Add get user test * Add confilct error in create user * Add swagger user entity * Added UserType(NORMAL, KAKAO, GOOGLE) * fix user for userType * Modify error filter * Modify error case * Modify swagger auth * Add swagger reset password * Add swagger email-verificiation * Add error case in creating user * Fix- user 동일성 체크 in repository with userType * change GSI in dynamoDB find unique user * Modify auth logic * Add swagger * Add pm2 * Add gitaction * Update actions version * Modify settings * Modify yml * Modify yml * Update gitaction * Add comment * Modify gitaction * Add code related to nestjs common * Test deploy * Test * Remove deploy-develop.yml * fix-calculate util * Add swagger and features related to verify auth code * Add generator random nickname * Update swagger related to update user info * Modify error response * Fix: 회원 정보 업데이트 로직 * fix-calculateScoreAndCorrectWords * Fix: user test result response 및 api path 변경 * Fix: startKey 오타 및 타입 * Fix: graph response (#15) * Fix: user-repository type error (#16) * Fix: user 관련 타입 (#17) * Test deploy * Fix: user service type 및 배포 yaml 파일 (#20) * Fix: deploy 에러 재수정 * Fix: ssh key pem debug 추가 * Fix: 임시 배포 테스트 * Fix: yaml 파일 * Feat: deveolop yml, aws, github ip 설정 등 * Fix: development yaml 수정 * Fix: dvelopment test * Fix: dvelopment yaml port 변경 * Fix: modify gitactions yml * Fix: modify gitactions yml * Fix: yaml 명령어 재수정 * Fix: docker file 추가 및 yaml 수정 (#22) * Fix: yaml 명령어 최종 수정 (#23) * Fix: 환경 변수 변경에 따른 수정 (#24) * Fix: docker yaml 설정 (#25) * Fix: 환경변수명 수정 (kode-krew#26) * Fix/env2 (kode-krew#27) * Fix: 환경변수명 수정 * Fix: yaml 파일 작업 삭제 * Fix: yaml table 명 수정 (kode-krew#28) * Fix: tableName 상수화 * Feat: sync-upstream (kode-krew#30) * Fix: sync-upstream yml * Fix: optional delete * Fix: sync-upstream yml fork url * Fix: sync-upstream yml 2차 수정 * Fix: sync-upstream yml 3차 수정 * Update README.md * Update README.md * Feat: dependa bot sync (kode-krew#31) * Fix: sync-upstream yml * Fix: optional delete * Fix: sync-upstream yml fork url * Fix: sync-upstream yml 2차 수정 * Fix: sync-upstream yml 3차 수정 * Update README.md * Update README.md * Fix: sync-upstream dependa-bot * Fix: sync-upstream dependa-bot * Fix: installing gh cli * Update README.md test 중 * Fix: sync-form yaml * Fix: sync-form yaml2 * Fix: sync-form yaml3 * Fix: sync-form yaml4 * Fix: fork yaml 파일 (kode-krew#33) * Fix: sync-form yaml * Fix: sync-form yaml2 * Fix: sync-form yaml3 * Fix: sync-form yaml4 --------- Co-authored-by: minchodang <[email protected]> * Fix: sync-form yaml final --------- Co-authored-by: Young <[email protected]> Co-authored-by: youngxdev <[email protected]> Co-authored-by: junghyunPark <[email protected]> Co-authored-by: minchodang <[email protected]>
- Loading branch information
1 parent
2c276d1
commit 750d0a5
Showing
70 changed files
with
5,247 additions
and
581 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Dependabot 업데이트 PR | ||
|
||
이 PR은 Dependabot에 의해 자동으로 생성되었습니다. | ||
|
||
### 체크리스트 | ||
|
||
- [ ] 변경된 패키지의 변경 로그를 확인했습니까? | ||
- [ ] 주요 변경 사항이 있는 경우, 애플리케이션에 미치는 영향을 검토했습니까? | ||
- [ ] 필요한 경우, 관련 테스트를 실행하고 통과했습니까? | ||
|
||
### 추가 정보 | ||
|
||
(필요한 경우 여기에 추가 정보를 기재해 주세요) |
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,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
commit-message: | ||
prefix: 'sync' | ||
open-pull-requests-limit: 5 | ||
target-branch: 'main' | ||
source: | ||
repo: 'kode-krew/meta-test-be' | ||
branch: 'main' |
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,18 @@ | ||
name: Dependabot PR Notification | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
notify: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' | ||
steps: | ||
- name: Notify team about Dependabot PR | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
text: 'New Dependabot PR opened: ${{ github.event.pull_request.html_url }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,73 @@ | ||
name: dev-deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
docker build -t meta-test . | ||
docker tag meta-test:latest ${{ secrets.DOCKER_USERNAME }}/meta-test:latest | ||
docker push ${{ secrets.DOCKER_USERNAME }}/meta-test:latest | ||
- name: SSH and deploy to EC2 | ||
run: | | ||
echo "$SSH_KEY" > key.pem | ||
chmod 600 key.pem | ||
ssh -i key.pem -o StrictHostKeyChecking=no ${USER}@${HOST} << 'EOF' | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/meta-test:latest | ||
docker stop meta-test-container || true | ||
docker rm meta-test-container || true | ||
docker run -d --name meta-test-container \ | ||
-e NODE_ENV=production \ | ||
-e JWT_SECRET=${{ secrets.JWT_SECRET }} \ | ||
-e ACCESS_TOKEN_EXPIRATION=1h \ | ||
-e REFRESH_TOKEN_EXPIRATION=3y \ | ||
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY }} \ | ||
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | ||
-e REGION=ap-northeast-2 \ | ||
-e AWS_DYNAMODB_TABLE_NAME=Dev-Metacognition-Test \ | ||
-e AWS_DYNAMODB_EMAIL_VERIFICATION_TABLE_NAME=Dev-Metacognition-Email-Verification \ | ||
-e [email protected] \ | ||
-e KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }} \ | ||
-e KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }} \ | ||
-e KAKAO_CALLBACK_URL=https://www.meta-cognition.site/auth \ | ||
-e GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} \ | ||
-e GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} \ | ||
-e GOOGLE_CALLBACK_URL=https://www.meta-cognition.site/auth \ | ||
-e GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }} \ | ||
-p 8080:8080 \ | ||
${{ secrets.DOCKER_USERNAME }}/meta-test:latest | ||
docker logs meta-test-container | ||
EOF | ||
env: | ||
USER: ${{ secrets.EC2_USER }} | ||
HOST: ${{ secrets.EC2_HOST }} | ||
SSH_KEY: ${{ secrets.EC2_SSH_KEY }} | ||
|
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,74 @@ | ||
name: main-deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# 깃허브 액션 러너의 아이피를 얻어온다. | ||
- name: Get Github action IP | ||
id: ip | ||
uses: haythem/[email protected] | ||
|
||
|
||
# AWS 설정 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
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: Add Github Actions IP to Security group | ||
run: | | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup SSH key | ||
run: | | ||
echo "$SSH_KEY" > key.pem | ||
chmod 600 key.pem | ||
# Debugging: Verify the key file is correctly created and permissions are set | ||
echo "SSH key file content:" | ||
cat key.pem | ||
echo "SSH key file permissions:" | ||
ls -l key.pem | ||
- name: Connect and run script on remote host | ||
run: | | ||
ssh -v -i key.pem -o StrictHostKeyChecking=no ${USER}@${HOST} "bash git-action.sh" | ||
env: | ||
USER: ${{ secrets.USER }} | ||
HOST: ${{ secrets.HOST }} | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
AWS_DEFAULT_REGION: ap-northeast-2 | ||
AWS_REGION: ap-northeast-2 | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
NODE_ENV: ${{ secrets.NODE_ENV }} | ||
JWT_SECRET: ${{ secrets.JWT_SECRET }} | ||
ACCESS_TOKEN_EXPIRATION: ${{ secrets.ACCESS_TOKEN_EXPIRATION }} | ||
REFRESH_TOKEN_EXPIRATION: ${{ secrets.REFRESH_TOKEN_EXPIRATION }} | ||
AWS_DYNAMODB_TABLE_NAME: ${{ secrets.AWS_DYNAMODB_TABLE_NAME }} | ||
AWS_DYNAMODB_EMAIL_VERIFICATION_TABLE_NAME: ${{ secrets.AWS_DYNAMODB_EMAIL_VERIFICATION_TABLE_NAME }} | ||
AWS_SES_EMAIL: ${{ secrets.AWS_SES_EMAIL }} | ||
KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }} | ||
KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }} | ||
KAKAO_CALLBACK_URL: ${{ secrets.KAKAO_CALLBACK_URL }} | ||
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | ||
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | ||
GOOGLE_CALLBACK_URL: ${{ secrets.GOOGLE_CALLBACK_URL }} | ||
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | ||
|
||
- name: Remove Github Actions IP From Security Group | ||
run: | | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 |
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,80 @@ | ||
name: Sync Upstream and Create PR | ||
|
||
on: | ||
schedule: | ||
- cron: '*/1 * * * *' # 매 분마다 실행 | ||
workflow_dispatch: # 수동으로도 실행 가능하게 설정 | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Fork | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ${{ github.repository }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
path: fork | ||
|
||
- name: Install GitHub CLI | ||
run: | | ||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
sudo apt-get update | ||
sudo apt-get install gh | ||
- name: Sync with Upstream | ||
uses: dabreadman/[email protected] | ||
with: | ||
upstream_repo: 'https://github.com/kode-krew/meta-test-be.git' | ||
upstream_branch: 'main' | ||
downstream_branch: 'main' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Configure Git | ||
run: | | ||
cd fork | ||
git config user.name "minchodang" | ||
git config user.email "[email protected]" | ||
- name: Add Upstream Remote | ||
run: | | ||
cd fork | ||
git remote add upstream https://github.com/kode-krew/meta-test-be.git | ||
- name: Check for Changes | ||
id: changes | ||
run: | | ||
cd fork | ||
git fetch upstream main | ||
git diff --exit-code upstream/main -- . ':(exclude).github/workflows/sync-upstream.yml' || echo "changes=true" >> $GITHUB_OUTPUT | ||
if [ ! -f $GITHUB_OUTPUT ]; then | ||
echo "changes=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Pull latest changes from forked-repo | ||
if: steps.changes.outputs.changes == 'true' | ||
run: | | ||
cd fork | ||
git pull origin main --rebase | ||
- name: Push changes to forked-repo | ||
if: steps.changes.outputs.changes == 'true' | ||
run: | | ||
cd fork | ||
git merge upstream/main --no-commit --no-ff || true | ||
git push origin main | ||
- name: Create Pull Request | ||
if: steps.changes.outputs.changes == 'true' | ||
run: | | ||
cd fork | ||
git checkout -b sync-upstream-$(date +%Y%m%d%H%M%S) | ||
git add -A | ||
git commit -m 'Sync with upstream' | ||
git push origin sync-upstream-$(date +%Y%m%d%H%M%S) | ||
gh pr create --title 'Sync with upstream' --body 'This PR syncs the fork with upstream repository' --base main --head sync-upstream-$(date +%Y%m%d%H%M%S) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 @@ | ||
# 베이스 이미지 설정 | ||
FROM node:20 | ||
|
||
# 작업 디렉토리 설정 | ||
WORKDIR /app | ||
|
||
# 의존성 파일 복사 | ||
COPY package*.json ./ | ||
|
||
# 의존성 설치 | ||
RUN npm install | ||
|
||
# 애플리케이션 소스 복사 | ||
COPY . . | ||
|
||
# 애플리케이션 빌드 | ||
RUN npm run build | ||
|
||
# 애플리케이션 실행 | ||
CMD ["npm", "start"] | ||
|
||
# 포트 설정 | ||
EXPOSE 8080 |
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.