diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 38c04c5..41fac66 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,37 +4,56 @@ on: push: branches: [main] +env: + PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} + GCE_INSTANCE: ${{ secrets.GCP_INSTANCE_NAME }} + GCE_INSTANCE_ZONE: ${{ secrets.GCP_INSTANCE_ZONE }} + jobs: - build-and-deploy: + setup-build-publish-deploy: + name: Setup, Build, Publish, and Deploy runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v0 - with: - project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - export_default_credentials: true - - - name: Configure Docker - run: gcloud auth configure-docker --quiet - - - name: Build Docker image - run: docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_INSTANCE_NAME }}-image:${{ github.sha }} . - - - name: Push Docker image to GCR - run: docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_INSTANCE_NAME }}-image:${{ github.sha }} - - - name: Deploy to GCE - run: | - gcloud compute instances update-container ${{ secrets.GCP_INSTANCE_NAME }} \ - --zone ${{ secrets.GCP_INSTANCE_ZONE }} \ - --container-image gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_INSTANCE_NAME }}-image:${{ github.sha }} - - - name: Verify deployment - run: | - gcloud compute ssh --zone ${{ secrets.GCP_INSTANCE_ZONE }} ${{ secrets.GCP_INSTANCE_NAME }} -- \ - 'docker ps' \ No newline at end of file + - name: Checkout + uses: actions/checkout@v2 + + - id: 'auth' + uses: 'google-github-actions/auth@v1' + with: + credentials_json: '${{ secrets.GCP_SA_KEY }}' + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' + + - name: 'Use gcloud CLI' + run: 'gcloud info' + + - name: Configure Docker + run: | + gcloud auth configure-docker --quiet + + - name: Build + run: |- + docker build \ + --tag "gcr.io/$PROJECT_ID/$GCE_INSTANCE-image:${{ github.sha }}" \ + --build-arg DB_HOST=${{ secrets.DB_HOST }} \ + --build-arg DB_USER=${{ secrets.DB_USER }} \ + --build-arg DB_PW=${{ secrets.DB_PW }} \ + --build-arg DB_PORT=${{ secrets.DB_PORT }} \ + --build-arg DB_NAME=${{ secrets.DB_NAME }} \ + --build-arg SECRET_KEY=${{ secrets.SECRET_KEY }} \ + --build-arg NAVER_MAP_CLIENT_ID=${{ secrets.NAVER_MAP_CLIENT_ID }} \ + --build-arg VDB_HOST=${{ secrets.VDB_HOST }} \ + --build-arg VDB_PORT=${{ secrets.VDB_PORT }} \ + . + + - name: Publish + run: |- + docker push "gcr.io/$PROJECT_ID/$GCE_INSTANCE-image:${{ github.sha }}" + + - name: Deploy + run: |- + gcloud compute instances update-container "$GCE_INSTANCE" \ + --zone "$GCE_INSTANCE_ZONE" \ + --container-image "gcr.io/$PROJECT_ID/$GCE_INSTANCE-image:${{ github.sha }}" \ No newline at end of file diff --git a/controllers/profileController.js b/controllers/profileController.js index 74bb69d..f492194 100644 --- a/controllers/profileController.js +++ b/controllers/profileController.js @@ -187,7 +187,7 @@ exports.listAllDiaries = async (req, res) => { // 관심 환자인지 여부 확인 let isCounselorScrapPatient; if (role === 'counselor') { - isCounselorScrapPatient = await ScrapModel.checkCounselorScrapPatient(patientId, loginId); + isCounselorScrapPatient = await ScrapModel.checkCounselorScrapPatient(patientUser.patient_id, loginId); } // 렌더링 부분에서 변수 전달 @@ -256,7 +256,7 @@ exports.listAllGuestbooks = async (req, res) => { // `isCounselorScrapPatient` 변수 추가 let isCounselorScrapPatient; if (loginRole === 'counselor') { - isCounselorScrapPatient = await ScrapModel.checkCounselorScrapPatient(patientId, loginId); + isCounselorScrapPatient = await ScrapModel.checkCounselorScrapPatient(patientUser.patient_id, loginId); } //임의로 손댄부분(원본주석,아래코드임의작성) diff --git a/python/app.py b/python/app.py index 31cf670..1593ece 100644 --- a/python/app.py +++ b/python/app.py @@ -197,11 +197,13 @@ def delete_vectors(): idx = data['idx'] ids = data['ids'] - qdrant.delete( - collection_name=collection_name[idx], - points_selector=ids, - wait=True - ) + if len(ids) > 0: + + qdrant.delete( + collection_name=collection_name[idx], + points_selector=ids, + wait=True + ) return jsonify({'message': 'Success'}), 200 else: