Skip to content

Commit

Permalink
EREGSC-2263 Migration was causing issues, removing, not needed (#1002)
Browse files Browse the repository at this point in the history
* Migration was causing issues, removing, not needed

* remove deploy text extractor

* d

* text extractor removal

* text extractor for deplo
  • Loading branch information
thwalker6 authored Oct 19, 2023
1 parent 2de991d commit 4bd654e
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 127 deletions.
74 changes: 37 additions & 37 deletions .github/workflows/deploy-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions solution/backend/content_search/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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())
Expand Down Expand Up @@ -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):
Expand All @@ -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())
Expand Down
31 changes: 0 additions & 31 deletions solution/backend/content_search/migrations/0003_populate_index.py

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions solution/backend/content_search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions solution/backend/content_search/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
4 changes: 2 additions & 2 deletions solution/backend/serverless-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4bd654e

Please sign in to comment.