diff --git a/.github/workflows/deploy-experimental.yml b/.github/workflows/deploy-experimental.yml index 4f869ca9cc..c130545474 100644 --- a/.github/workflows/deploy-experimental.yml +++ b/.github/workflows/deploy-experimental.yml @@ -73,49 +73,49 @@ jobs: npm install serverless deploy --stage dev${PR} popd - deploy-text-extractor: - environment: - name: "dev" - runs-on: ubuntu-20.04 - steps: - # Checkout the code - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - # Find the PR number. This is not always trivial which is why this uses an existign action - - name: Find PR number - uses: jwalton/gh-find-current-pr@v1 - id: findPr - with: - # Can be "open", "closed", or "all". Defaults to "open". - state: open - # Configure AWS credentials for GitHub Actions - - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }} - aws-region: us-east-1 - # Deploy the text extractor lambda to AWS - - name: Deploy text extractor lambda - id: deploy-text-extractor - if: success() && steps.findPr.outputs.number - env: - PR: ${{ steps.findPr.outputs.pr }} - RUN_ID: ${{ github.run_id }} - run: | - pushd solution/text-extractor - npm install serverless -g - npm install - serverless deploy --stage dev${PR} - popd + # deploy-text-extractor: + # environment: + # name: "dev" + # runs-on: ubuntu-20.04 + # steps: + # # Checkout the code + # - name: Checkout + # uses: actions/checkout@v3 + # with: + # submodules: true + # # Find the PR number. This is not always trivial which is why this uses an existign action + # - name: Find PR number + # uses: jwalton/gh-find-current-pr@v1 + # id: findPr + # with: + # # Can be "open", "closed", or "all". Defaults to "open". + # state: open + # # Configure AWS credentials for GitHub Actions + # - name: Configure AWS credentials for GitHub Actions + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }} + # aws-region: us-east-1 + # # Deploy the text extractor lambda to AWS + # - name: Deploy text extractor lambda + # id: deploy-text-extractor + # if: success() && steps.findPr.outputs.number + # env: + # PR: ${{ steps.findPr.outputs.pr }} + # RUN_ID: ${{ github.run_id }} + # run: | + # pushd solution/text-extractor + # npm install serverless -g + # npm install + # serverless deploy --stage dev${PR} + # popd deploy-django: environment: name: "dev" outputs: url: ${{ steps.deploy-regulations-site-server.outputs.url }} runs-on: ubuntu-20.04 - needs: [deploy-static, deploy-text-extractor] + needs: [deploy-static,] steps: # Checkout the code - name: Checkout diff --git a/solution/backend/content_search/functions.py b/solution/backend/content_search/functions.py index da844b8e6e..0615a42e95 100644 --- a/solution/backend/content_search/functions.py +++ b/solution/backend/content_search/functions.py @@ -39,8 +39,8 @@ def update_index(content_index, content): summary_string=content.summary, date_string=content.date, resource_type='internal', - content_type='uploadedfile', - content_id=content.id + # content_type='uploadedfile', + # content_id=content.id ) new_index.save() elif isinstance(content, SupplementalContent) or isinstance(content, FederalRegisterDocument): @@ -55,12 +55,12 @@ def update_index(content_index, content): new_index.save() if isinstance(content, SupplementalContent): new_index.supplemental_content = content - new_index.content_type = 'supplementalcontent' - new_index.content_id = content.id + # new_index.content_type = 'supplementalcontent' + # new_index.content_id = content.id else: new_index.fr_doc = content - new_index.content_type = 'federalregisterdocument' - new_index.content_id = content.id + # new_index.content_type = 'federalregisterdocument' + # new_index.content_id = content.id new_index.save() new_index.content = content_index.content new_index.locations.set(content.locations.all()) @@ -90,8 +90,8 @@ def add_to_index(content): summary_string=content.summary, date_string=content.date, resource_type='internal', - content_type='uploadedfile', - content_id=content.id + # content_type='uploadedfile', + # content_id=content.id ) content_index.save() elif isinstance(content, SupplementalContent) or isinstance(content, FederalRegisterDocument): @@ -106,12 +106,12 @@ def add_to_index(content): if isinstance(content, SupplementalContent): content_index.supplemental_content = content - content_index.content_type = 'supplementalcontent' - content_index.content_id = content.id + # content_index.content_type = 'supplementalcontent' + # content_index.content_id = content.id else: content_index.fr_doc = content - content_index.content_type = 'federalregisterdocument' - content_index.content_id = content.id + # content_index.content_type = 'federalregisterdocument' + # content_index.content_id = content.id content_index.save() content_index.locations.set(content.locations.all()) content_index.subjects.set(content.subjects.all()) diff --git a/solution/backend/content_search/migrations/0003_populate_index.py b/solution/backend/content_search/migrations/0003_populate_index.py deleted file mode 100644 index ae98e4749d..0000000000 --- a/solution/backend/content_search/migrations/0003_populate_index.py +++ /dev/null @@ -1,31 +0,0 @@ -from resources.models import FederalRegisterDocument, SupplementalContent -from file_manager.models import UploadedFile -from content_search.functions import add_to_index - -from django.db import migrations - -def populate_content(apps, schema_editor): - supplemental_content = SupplementalContent.objects.all() - fr_docs = FederalRegisterDocument.objects.all() - up_files = UploadedFile.objects.all() - - for sc in supplemental_content: - add_to_index(sc) - - for fr in fr_docs: - add_to_index(fr) - - for up in up_files: - add_to_index(up) - - - -class Migration(migrations.Migration): - - dependencies = [ - ('content_search', '0002_add_vector'), - ] - - operations = [ - migrations.RunPython(populate_content), - ] diff --git a/solution/backend/content_search/migrations/0004_contentindex_content_type.py b/solution/backend/content_search/migrations/0004_contentindex_content_type.py deleted file mode 100644 index b4855a46c0..0000000000 --- a/solution/backend/content_search/migrations/0004_contentindex_content_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# Generated by Django 3.2.22 on 2023-10-12 15:29 - -from django.db import migrations, models - -from content_search.models import ContentIndex - -def get_type(apps, schema_editor): - cont_index = ContentIndex.objects.all() - for ci in cont_index: - if ci.file: - ci.content_type = 'uploadedfile' - ci.content_id = ci.file.id - elif ci.supplemental_content: - ci.content_type = 'supplementalcontent' - ci.content_id = ci.supplemental_content.id - elif ci.fr_doc: - ci.content_type = 'federalregisterdocument' - ci.content_id = ci.fr_doc.id - ci.save() - -class Migration(migrations.Migration): - - dependencies = [ - ('content_search', '0003_populate_index'), - ] - - operations = [ - migrations.AddField( - model_name='contentindex', - name='content_type', - field=models.CharField(blank=True, max_length=50, null=True), - ), - migrations.AddField( - model_name='contentindex', - name='content_id', - field=models.IntegerField(null=True), - ), - migrations.RunPython(get_type), - ] diff --git a/solution/backend/content_search/models.py b/solution/backend/content_search/models.py index b72ed6dde5..547cb996ff 100644 --- a/solution/backend/content_search/models.py +++ b/solution/backend/content_search/models.py @@ -71,8 +71,8 @@ class ContentIndex(models.Model): ) locations = models.ManyToManyField(AbstractLocation, blank=True, related_name="content", verbose_name="Regulation Locations") resource_type = models.CharField(max_length=25, null=True, blank=True) - content_type = models.CharField(max_length=50, blank=True, null=True) - content_id = models.IntegerField(null=True) + # content_type = models.CharField(max_length=50, blank=True, null=True) + # content_id = models.IntegerField(null=True) file = models.ForeignKey(UploadedFile, blank=True, null=True, on_delete=models.CASCADE) supplemental_content = models.ForeignKey(SupplementalContent, blank=True, null=True, on_delete=models.CASCADE) fr_doc = models.ForeignKey(FederalRegisterDocument, blank=True, null=True, on_delete=models.CASCADE) diff --git a/solution/backend/content_search/serializers.py b/solution/backend/content_search/serializers.py index 61a46ba734..94202dfb1e 100644 --- a/solution/backend/content_search/serializers.py +++ b/solution/backend/content_search/serializers.py @@ -15,8 +15,8 @@ class ContentSearchSerializer(DetailsSerializer, serializers.Serializer): subjects = SubjectSerializer(many=True, read_only=True) category = serializers.SerializerMethodField() url = serializers.CharField() - content_type = serializers.CharField() - content_id = serializers.IntegerField() + # content_type = serializers.CharField() + # content_id = serializers.IntegerField() document_name_headline = HeadlineField() summary_headline = HeadlineField() @@ -31,5 +31,5 @@ class ContentListSerializer(DetailsSerializer, serializers.Serializer, ): subjects = SubjectSerializer(many=True, read_only=True) category = serializers.SerializerMethodField() url = serializers.CharField() - content_type = serializers.CharField() - content_id = serializers.IntegerField() + # content_type = serializers.CharField() + # content_id = serializers.IntegerField() diff --git a/solution/backend/serverless-experimental.yml b/solution/backend/serverless-experimental.yml index a1b4bc3fe1..3f6ec675f2 100644 --- a/solution/backend/serverless-experimental.yml +++ b/solution/backend/serverless-experimental.yml @@ -45,7 +45,7 @@ provider: OIDC_OP_USER_ENDPOINT: ${ssm:/eregulations/oidc/user_endpoint} DEPLOY_NUMBER: ${env:RUN_ID} EUA_FEATUREFLAG: ${ssm:/eregulations/eua/featureflag} - TEXT_EXTRACTOR_URL: ${self:custom.settings.text_extractor_url} + # TEXT_EXTRACTOR_URL: ${self:custom.settings.text_extractor_url} vpc: securityGroupIds: - ${ssm:/eregulations/aws/securitygroupid} @@ -78,7 +78,7 @@ custom: DB_NAME: ${self:custom.stage} USERNAME: eregsuser ALLOWED_HOST: '.amazonaws.com' - text_extractor_url: ${cf:text-extractor-${self:custom.stage}.ServiceEndpoint}/ + # text_extractor_url: ${cf:text-extractor-${self:custom.stage}.ServiceEndpoint}/ cloudfrontInvalidate: - distributionId: ${cf:cmcs-eregs-static-assets-${self:custom.stage}.CloudFrontDistributionId} items: