diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d00002..1ae4975 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: "3.9" + python-version: "3.11" cache: pip cache-dependency-path: | requirements/base.txt @@ -29,9 +29,9 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@main - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: "3.9" + python-version: "3.11" - run: pip install -r requirements/local.txt - run: python -m pytest ds-caselaw-ingester/tests.py diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2c07333 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11 diff --git a/Makefile b/Makefile index 8789b4e..3e46a99 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,5 @@ build: - @mkdir -p dist - @STATIC_DEPS=true python3 -m pip install -t package -r requirements/base.txt - @rm dist/lambda.zip & 2>&1 - @cd package && zip -r ../dist/lambda.zip * && cd .. - @zip -g dist/lambda.zip ds-caselaw-ingester/lambda_function.py - @echo 'Built dist/lambda.zip' + samlocal build --use-container -m requirements/base.txt ifeq (setup,$(firstword $(MAKECMDGOALS))) # use the rest as arguments for "setup" diff --git a/docker-compose.yml b/docker-compose.yml index f9e04a0..9ba459c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,6 @@ -version: "3.8" - services: localstack: - image: localstack/localstack + image: localstack/localstack:2.3.2 network_mode: bridge environment: SERVICES: lambda,sns,s3,sqs,iam diff --git a/scripts/setup-localstack.sh b/scripts/setup-localstack.sh index d1120b3..0437031 100755 --- a/scripts/setup-localstack.sh +++ b/scripts/setup-localstack.sh @@ -8,7 +8,7 @@ awslocal lambda create-function \ --function-name te-lambda \ --zip-file fileb://dist/lambda.zip \ --handler ds-caselaw-ingester/lambda_function.handler \ - --runtime python3.9 \ + --runtime python3.11 \ --environment "Variables={MARKLOGIC_HOST=$MARKLOGIC_HOST,MARKLOGIC_USER=$MARKLOGIC_USER,MARKLOGIC_PASSWORD=$MARKLOGIC_PASSWORD,AWS_BUCKET_NAME=$AWS_BUCKET_NAME,AWS_SECRET_KEY=$AWS_SECRET_KEY,AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID,AWS_ENDPOINT_URL=$AWS_ENDPOINT_URL,SQS_QUEUE_URL=$SQS_QUEUE_URL,ROLLBAR_TOKEN=$ROLLBAR_TOKEN,ROLLBAR_ENV=$ROLLBAR_ENV,NOTIFY_API_KEY=$NOTIFY_API_KEY,NOTIFY_EDITORIAL_ADDRESS=$NOTIFY_EDITORIAL_ADDRESS,NOTIFY_NEW_JUDGMENT_TEMPLATE_ID=$NOTIFY_NEW_JUDGMENT_TEMPLATE_ID,EDITORIAL_UI_BASE_URL=$EDITORIAL_UI_BASE_URL,PUBLIC_ASSET_BUCKET=$PUBLIC_ASSET_BUCKET}" \ --role arn:aws:iam::000000000000:role/lambda-role \ @@ -19,7 +19,7 @@ awslocal sns create-topic \ awslocal sns subscribe \ --topic-arn arn:aws:sns:us-east-1:000000000000:judgments \ --protocol lambda \ - --notification-endpoint arn:aws:lambda:us-east-1:000000000000:function:te-lambda + --notification-endpoint arn:aws:lambda:eu-west-2:000000000000:function:ds-caselaw-ingester-TNACaselawIngesterFuncti-b824e251 awslocal s3api create-bucket \ --bucket te-editorial-out-int diff --git a/scripts/update-lambda.sh b/scripts/update-lambda.sh index b6eabe8..627c2ee 100755 --- a/scripts/update-lambda.sh +++ b/scripts/update-lambda.sh @@ -1,6 +1,6 @@ source .env -awslocal lambda update-function-code --function-name te-lambda --zip-file fileb://dist/lambda.zip +samlocal deploy --no-confirm-changeset --no-fail-on-empty-changeset --stack-name ds-caselaw-ingester --resolve-s3 --capabilities CAPABILITY_IAM --region us-east-1 -awslocal lambda update-function-configuration --function-name te-lambda \ +awslocal lambda update-function-configuration --function-name te-lambda --region=us-east-1 \ --environment "Variables={MARKLOGIC_HOST=$MARKLOGIC_HOST,MARKLOGIC_USER=$MARKLOGIC_USER,MARKLOGIC_PASSWORD=$MARKLOGIC_PASSWORD,AWS_BUCKET_NAME=$AWS_BUCKET_NAME,AWS_SECRET_KEY=$AWS_SECRET_KEY,AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID,AWS_ENDPOINT_URL=$AWS_ENDPOINT_URL,SQS_QUEUE_URL=$SQS_QUEUE_URL,ROLLBAR_TOKEN=$ROLLBAR_TOKEN,ROLLBAR_ENV=$ROLLBAR_ENV,NOTIFY_API_KEY=$NOTIFY_API_KEY,NOTIFY_EDITORIAL_ADDRESS=$NOTIFY_EDITORIAL_ADDRESS,NOTIFY_NEW_JUDGMENT_TEMPLATE_ID=$NOTIFY_NEW_JUDGMENT_TEMPLATE_ID,EDITORIAL_UI_BASE_URL=$EDITORIAL_UI_BASE_URL,PUBLIC_ASSET_BUCKET=$PUBLIC_ASSET_BUCKET}" diff --git a/template.yml b/template.yml index 573f78b..95df7fa 100644 --- a/template.yml +++ b/template.yml @@ -1,4 +1,4 @@ -AWSTemplateFormatVersion: '2010-09-09' +AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: > ds-caselaw-ingester @@ -16,7 +16,7 @@ Resources: Properties: CodeUri: ds-caselaw-ingester/ Handler: lambda_function.handler - Runtime: python3.9 + Runtime: python3.11 Architectures: - x86_64