diff --git a/.github/workflows/nest_lm copy 2.yml b/.github/workflows/nest_lm copy 2.yml new file mode 100644 index 0000000..835b431 --- /dev/null +++ b/.github/workflows/nest_lm copy 2.yml @@ -0,0 +1,92 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: nest_lm CI + +on: + push: + branches: [ "main" ] + +env: + PROJECT_NAME: ${{ secrets.PROJECT_NAME }} + BUCKET_NAME: ${{ secrets.BUCKET_NAME }} + CODE_DEPLOY_APP_NAME: ${{ secrets.CODE_DEPLOY_APP_NAME }} + DEPLOYMENT_GROUP_NAME: ${{ secrets.DEPLOYMENT_GROUP_NAME }} + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install Dependencies + run: npm ci + + - name: Build (if present) + run: npm run build --if-present + + - name: Create .env file + run: | + echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" > .env + echo "JWT_ACCESS_KEY=${{ secrets.JWT_ACCESS_KEY }}" >> .env + echo "JWT_REFRESH_KEY=${{ secrets.JWT_REFRESH_KEY }}" >> .env + echo "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" >> .env + echo "KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}" >> .env + echo "KAKAO_CALLBACK_URL=${{ secrets.KAKAO_CALLBACK_URL }}" >> .env + echo "EMAIL_USER=${{ secrets.EMAIL_USER }}" >> .env + echo "EMAIL_PASS=${{ secrets.EMAIL_PASS }}" >> .env + echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env + echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_PRIVATE_ACCESS_KEY }}" >> .env + echo "AWS_REGION=${{ secrets.AWS_REGION }}" >> .env + echo "AWS_BUCKET_NAME=${{ secrets.AWS_BUCKET_NAME }}" >> .env + echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" >> .env + echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env + echo "GOOGLE_CALLBACK_URL=${{ secrets.GOOGLE_CALLBACK_URL }}" >> .env + echo "NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}" >> .env + echo "NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}" >> .env + echo "NAVER_CALLBACK_URL=${{ secrets.NAVER_CALLBACK_URL }}" >> .env + working-directory: ./ + + # S3로 보낼 압축 파일 생성 + - name: zip file + run: | + # zip으로 압축파일 생성 + # CI.zip은 압축 파일 이름, 나머지는 압축할 코드 파일 또는 폴더를 지정합니다. + # workflow와 동일한 위치의 폴더와 파일을 압축합니다. + zip -qq -r ./$GITHUB_SHA.zip . + + # AWS 인증하기 + - name: AWS configure credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + # 엑세스 키 입력 + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # 엑세스 시크릿 키 입력 + aws-secret-access-key: ${{ secrets.AWS_PRIVATE_ACCESS_KEY }} + # 지역 설정: 서울 + aws-region: ${{ secrets.AWS_REGION }} + + # S3로 업로드하기 + - name: upload to S3 + run: aws s3 cp ./$GITHUB_SHA.zip s3://$BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip + + # codeDeploy 실행 + - name: request deploy to codedeploy + run: aws deploy create-deployment + --application-name $CODE_DEPLOY_APP_NAME + --deployment-config-name CodeDeployDefault.AllAtOnce + --deployment-group-name $DEPLOYMENT_GROUP_NAME + --s3-location bucket=$BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip diff --git a/.github/workflows/nest_lm.yml b/.github/workflows/nest_lm.yml index 765c84e..ff362df 100644 --- a/.github/workflows/nest_lm.yml +++ b/.github/workflows/nest_lm.yml @@ -90,6 +90,7 @@ jobs: echo "NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}" >> .env echo "NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}" >> .env echo "NAVER_CALLBACK_URL=${{ secrets.NAVER_CALLBACK_URL }}" >> .env + echo "MONGO_URL=${{ secrets.MONGO_URL }}" >> .env working-directory: ./ # 압축 파일 생성 - 이 부분과 s3 업로드 부분은 같은 job 에 있어야 됨 없으면 업로드 할 .zip 을 못 찾음 diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 9397532..f5e5f04 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -133,7 +133,7 @@ export class AuthService { console.log('로컬 리프레시 토큰', refreshToken); // 리다이렉션 res.redirect( - `http://localhost:5173?accessToken=${encodeURIComponent( + `https://localmingle.store?accessToken=${encodeURIComponent( accessToken )}&refreshToken=${encodeURIComponent( refreshToken diff --git a/src/chats/room.chats.gateway.ts b/src/chats/room.chats.gateway.ts index dc24e07..e5b9ce9 100644 --- a/src/chats/room.chats.gateway.ts +++ b/src/chats/room.chats.gateway.ts @@ -22,6 +22,9 @@ import { Model } from 'mongoose'; 'http://localhost:5173', 'https://d2r603zvpf912o.cloudfront.net', 'https://totobon.store', + 'https://local-mingle-fe.vercel.app', + 'https://d2k8kob2tp4v96.cloudfront.net', + 'https://localmingle.store', ], methods: ['GET', 'POST'], credentials: true, diff --git a/src/main.ts b/src/main.ts index e048b9c..ef5422e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,7 +25,7 @@ async function bootstrap() { const document = SwaggerModule.createDocument(app, config); SwaggerModule.setup('api', app, document); - // CORS 정책 + // CORS 정책 test2 app.enableCors({ origin: [ 'http://localhost:5173', diff --git a/src/searches/searches.dto/searches.dto.ts b/src/searches/searches.dto/searches.dto.ts index dc7b9d8..89bee2a 100644 --- a/src/searches/searches.dto/searches.dto.ts +++ b/src/searches/searches.dto/searches.dto.ts @@ -40,4 +40,4 @@ export class SearchesDto { @IsOptional() @IsString() keyWord: string -} \ No newline at end of file +}