-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1133 from wellcomecollection/Ingest-inspector-sub…
…domain Make Ingest Inspector accessible from a wellcomecollection.org subdomain
- Loading branch information
Showing
26 changed files
with
193 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Deploy Ingest Inspector | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
id-token: write | ||
|
||
jobs: | ||
deploy_ingest_inspector: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: eu-west-1 | ||
role-to-assume: ${{ secrets.DEPLOY_INGEST_INSPECTOR_GHA_ROLE_ARN }} | ||
- name: Deploy Ingest Inspector backend | ||
run: | | ||
pip3 install -r ./builds/requirements.txt | ||
python3 ./builds/publish_lambda_zip.py monitoring/ingest_inspector/backend_lambda \ | ||
--bucket=wellcomecollection-storage-infra \ | ||
--key=lambdas/monitoring/ingest_inspector_backend.zip | ||
./builds/deploy_lambda_zip.sh monitoring/ingest_inspector_backend ingest_inspector_backend | ||
- name: Deploy Ingest Inspector frontend | ||
run: | | ||
cd monitoring/ingest_inspector/frontend | ||
sh deploy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Usage: ./deploy_lambda_zip.sh <project_name> <lambda_name> | ||
# Example: ./deploy_lambda_zip.sh monitoring/ingest_inspector_backend ingest_inspector_backend | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
PROJECT_NAME=$1 | ||
LAMBDA_NAME=$2 | ||
|
||
S3_BUCKET="wellcomecollection-storage-infra" | ||
S3_KEY="lambdas/$PROJECT_NAME.zip" | ||
|
||
echo "Identifying function: $LAMBDA_NAME" | ||
FUNCTION_ARN=$(aws lambda get-function-configuration \ | ||
--function-name $LAMBDA_NAME \ | ||
--query "FunctionArn" \ | ||
--output text) | ||
|
||
echo "Updating function: $FUNCTION_ARN from s3://$S3_BUCKET/$S3_KEY" | ||
REVISION_ID=$(aws lambda update-function-code \ | ||
--function-name $LAMBDA_NAME \ | ||
--s3-bucket $S3_BUCKET \ | ||
--s3-key $S3_KEY \ | ||
--query "RevisionId" \ | ||
--output text) | ||
|
||
echo "Revision id: $REVISION_ID" | ||
|
||
echo "Awaiting function update" | ||
aws lambda wait function-updated \ | ||
--function-name $LAMBDA_NAME | ||
|
||
echo "Done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
boto3 | ||
docopt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.10 | ||
# by the following command: | ||
# | ||
# pip-compile requirements.in | ||
# | ||
boto3==1.34.140 | ||
# via -r requirements.in | ||
botocore==1.34.140 | ||
# via | ||
# boto3 | ||
# s3transfer | ||
docopt==0.6.2 | ||
# via -r requirements.in | ||
jmespath==1.0.1 | ||
# via | ||
# boto3 | ||
# botocore | ||
python-dateutil==2.9.0.post0 | ||
# via botocore | ||
s3transfer==0.10.2 | ||
# via boto3 | ||
six==1.16.0 | ||
# via python-dateutil | ||
urllib3==2.2.2 | ||
# via botocore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module "ingest_inspector" { | ||
source = "./ingest_inspector" | ||
|
||
domain_name = "ingest-inspector.wellcomecollection.org" | ||
serve_frontend_bucket_name = "wellcomecollection-ingest-inspector-frontend" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module "ingest_inspector_certificate" { | ||
source = "github.com/wellcomecollection/terraform-aws-acm-certificate?ref=v1.0.0" | ||
|
||
domain_name = var.domain_name | ||
zone_id = data.aws_route53_zone.weco_zone.id | ||
|
||
providers = { | ||
# The ACM certificate must be created in the us-east-1 region to work with CloudFront | ||
aws = aws.us-east-1 | ||
aws.dns = aws.dns | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data "aws_route53_zone" "weco_zone" { | ||
provider = aws.dns | ||
name = "wellcomecollection.org." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Add an alias A record to the wellcomecollection.org hosted zone, which maps the Ingest Inspector domain name | ||
# to the CloudFront distribution | ||
resource "aws_route53_record" "cdn" { | ||
provider = aws.dns | ||
zone_id = data.aws_route53_zone.weco_zone.id | ||
name = var.domain_name | ||
type = "A" | ||
|
||
alias { | ||
name = aws_cloudfront_distribution.ingest_inspector_cloudfront_distribution.domain_name | ||
zone_id = aws_cloudfront_distribution.ingest_inspector_cloudfront_distribution.hosted_zone_id | ||
evaluate_target_health = false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
provider "aws" { | ||
region = "eu-west-1" | ||
alias = "dns" | ||
|
||
assume_role { | ||
role_arn = "arn:aws:iam::267269328833:role/wellcomecollection-assume_role_hosted_zone_update" | ||
} | ||
} | ||
|
||
provider "aws" { | ||
assume_role { | ||
role_arn = "arn:aws:iam::975596993436:role/storage-developer" | ||
} | ||
|
||
region = "us-east-1" | ||
alias = "us-east-1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
resource "aws_secretsmanager_secret" "ingest_inspector_cognito_client_id" { | ||
name = "ingest-inspector-backend/cognito-client-id" | ||
} | ||
|
||
resource "aws_secretsmanager_secret" "ingest_inspector_cognito_client_secret" { | ||
name = "ingest-inspector-backend/cognito-client-secret" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
variable "domain_name" { | ||
type = string | ||
} | ||
|
||
variable "serve_frontend_bucket_name" { | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters