Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App-geo-ca-v2 harvester #95

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/cloudformation/geocore-eo-rcm-ard-harvester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Resources:
GEOCORE_TEMPLATE_BUCKET_NAME: !Sub 'webpresence-geocore-template-${Environment}'
GEOCORE_TEMPLATE_NAME: 'geocore-format-null-template.json'
ITEM_LINK_BUCKET_NAME: !Sub 'eo-sg-datacube-item-links-${Environment}'
PROCESSED_DATA_BUCKET_NAME: !Ref ProcessedDataS3Bucket
PROCESSED_DATA_BUCKET_NAME: !Sub 'eo-sg-processed-data-rcm-ard-${Environment}'
API_ROOT: 'https://www.eodms-sgdot.nrcan-rncan.gc.ca/stac'
ROOT_NAME: 'EODMS Datacube API / EODMS Cube de données API'
SOURCE: 'eodms'
Expand Down Expand Up @@ -175,7 +175,7 @@ Resources:
Variables:
GEOCORE_TEMPLATE_BUCKET_NAME: !Sub 'webpresence-geocore-template-${Environment}'
GEOCORE_TEMPLATE_NAME: 'geocore-format-null-template.json'
PROCESSED_DATA_BUCKET_NAME: !Ref ProcessedDataS3Bucket
PROCESSED_DATA_BUCKET_NAME: !Sub 'eo-sg-processed-data-rcm-ard-${Environment}'
API_ROOT: 'https://www.eodms-sgdot.nrcan-rncan.gc.ca/stac'
ROOT_NAME: 'EODMS Datacube API / EODMS Cube de données API'
SOURCE: 'eodms'
Expand Down Expand Up @@ -405,7 +405,7 @@ Resources:
Timeout: 900
Environment:
Variables:
GEOJSON_BUCKET_NAME: !Ref ProcessedDataS3Bucket
GEOJSON_BUCKET_NAME: !Sub 'eo-sg-processed-data-rcm-ard-${Environment}'
PARQUET_BUCKET_NAME: !Sub 'webpresence-geocore-geojson-to-parquet-${Environment}'
DYNAMODB_TABLE: 'analytics_popularity'
PARQUET_FILENAME: 'rcm-ard.parquet'
Expand Down
108 changes: 108 additions & 0 deletions docs/cloudformation/geocore-hnap-harvest-app-geo-ca-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: Deploys HNAP JSON harvester solution + GeoNetwork to geocore translation

Parameters:
Environment:
Type: AWS::SSM::Parameter::Value<String>
Default: /webpresence/environment
Description: SSM parameter name for environment
DeploymentBucket:
Type: AWS::SSM::Parameter::Value<String>
Default: /webpresence/deployment-bucket
Description: S3 bucket where all deployment files are stored
SvelteBucketString:
Type: String
Description: Unique string generated by the svelte app.geo.ca v2 deployment

Conditions:
IsProd: !Equals [prod, !Ref Environment]
IsStage: !Equals [stage, !Ref Environment]
IsDev: !Equals [dev, !Ref Environment]

Resources:
HnapJsonHarvesterAppGeoCav2:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.9
Role: !GetAtt LambdaExecutionRole.Arn
CodeUri:
Bucket: !Ref DeploymentBucket
Key:
Fn::If:
- IsProd
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
- Fn::If:
- IsStage
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
MemorySize: 3009
Handler: app.lambda_handler
Timeout: 900
Environment:
Variables:
BUCKET_NAME: !Sub 'app-geo-ca-pv-datalake-${SvelteBucketString}/hnap'
GEOJSON_BUCKET_NAME: !Sub 'app-geo-ca-pv-datalake-${SvelteBucketString}/geojson'
BASE_URL: 'https://maps.canada.ca'
GN_JSON_RECORD_URL_START: 'https://maps.canada.ca/geonetwork/srv/api/0.1/records/'
RUN_INTERVAL_MINUTES: 11
Layers:
- arn:aws:lambda:ca-central-1:336392948345:layer:AWSSDKPandas-Python39:8

HnapJsonHarvesterRule:
Type: AWS::Events::Rule
Properties:
Name: !Sub 'harvester-10mins-app-geo-ca-v2-${Environment}'
Description: Harvester on a 10 minute interval
State: DISABLED
ScheduleExpression: 'rate(10 minutes)'
Targets:
-
Arn:
Fn::GetAtt:
- HnapJsonHarvesterAppGeoCav2
- Arn
Id: !Ref HnapJsonHarvesterAppGeoCav2

PermissionForEventsToInvokeHarvesterLambda:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !Ref HnapJsonHarvesterAppGeoCav2
Action: 'lambda:InvokeFunction'
Principal: 'events.amazonaws.com'
SourceArn: !GetAtt
- HnapJsonHarvesterRule
- Arn

LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Policies:
- PolicyName: 'policy'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 's3:*'
Resource:
- !Sub arn:aws:s3:::app-geo-ca-pv-datalake-${SvelteBucketString}
- !Sub arn:aws:s3:::app-geo-ca-pv-datalake-${SvelteBucketString}/*

LogGroup:
Type: Custom::LogGroup
Properties:
ServiceToken: !ImportValue LogGroupHelperLambdaArn
LogGroupName: !Sub '/${Environment}/webpresence/hnap_json_harvest_app-geo-ca-v2'
RetentionInDays: 3653
6 changes: 3 additions & 3 deletions docs/cloudformation/geocore-hnap-harvest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ Resources:
Key:
Fn::If:
- IsProd
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20230823-1800.zip
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
- Fn::If:
- IsStage
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20230823-1800.zip
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20230823-1800.zip
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
- cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
MemorySize: 3009
Handler: app.lambda_handler
Timeout: 900
Expand Down
4 changes: 3 additions & 1 deletion docs/cloudformation/geocore-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4139,7 +4139,9 @@ Resources:
,\r\n \"type\": \"$input.params('type')\",\r\n \"org\": \"$input.params('org')\"\
,\r\n \"min\": \"$input.params('min')\",\r\n \"max\": \"$input.params('max')\"\
,\r\n \"foundational\": \"$input.params('foundational')\"
,\r\n \"sort\": \"$input.params('sort')\"
,\r\n \"sort\": \"$input.params('sort')\"
,\r\n \"begin\": \"$input.params('begin')\"
,\r\n \"end\": \"$input.params('end')\"
,\r\n \"source_system\": \"$input.params('sourcesystemname')\"
,\r\n \"eo_collection\": \"$input.params('eocollection')\"
,\r\n \"polarization\": \"$input.params('polarization')\"
Expand Down
Binary file not shown.
Binary file not shown.
Loading