Skip to content

Commit

Permalink
Merge pull request #87 from Canadian-Geospatial-Platform/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
bo-lu authored Sep 24, 2024
2 parents 7f749e9 + a48aef6 commit 59afa3f
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 89 deletions.
123 changes: 36 additions & 87 deletions docs/cloudformation/geocore-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1686,35 +1686,6 @@ Resources:
Layers:
- arn:aws:lambda:ca-central-1:336392948345:layer:AWSSDKPandas-Python39:8
LambdaImageProcessor:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.10
Role: !GetAtt LambdaExecutionRole.Arn
CodeUri:
Bucket: !Ref DeploymentBucket
Key:
Fn::If:
- IsProd
- cloudformation-templates/lambda/image-processor/image-processor-20240619-1400.zip
- Fn::If:
- IsStage
- cloudformation-templates/lambda/image-processor/image-processor-20240619-1400.zip
- cloudformation-templates/lambda/image-processor/image-processor-20240619-1400.zip
MemorySize: 3009
Handler: app.lambda_handler
Timeout: 60
Events:
ApiEvent:
Type: Api
Properties:
RestApiId: !Ref RestApi
Path: /image-processor
Method: any
Layers:
- arn:aws:lambda:ca-central-1:770693421928:layer:Klayers-p310-Pillow:7
- arn:aws:lambda:ca-central-1:770693421928:layer:Klayers-p310-requests:11
KeepCollectionsWarmScheduleRule:
Type: AWS::Events::Rule
Properties:
Expand Down Expand Up @@ -1777,11 +1748,11 @@ Resources:
Key:
Fn::If:
- IsProd
- cloudformation-templates/lambda/viewer-config-service/viewer-config-service-20231218-1200.zip
- cloudformation-templates/lambda/viewer-config-service/viewer-config-service-20240924-1200.zip
- Fn::If:
- IsStage
- cloudformation-templates/lambda/viewer-config-service/viewer-config-service-20231218-1200.zip
- cloudformation-templates/lambda/viewer-config-service/viewer-config-service-20231218-1200.zip
- cloudformation-templates/lambda/viewer-config-service/viewer-config-service-20240924-1200.zip
- cloudformation-templates/lambda/viewer-config-service/viewer-config-service-20240924-1200.zip
MemorySize: 3009
Handler: app.lambda_handler
Timeout: 15
Expand Down Expand Up @@ -1974,9 +1945,8 @@ Resources:
Format: '<request id="$context.requestId"> <ip>$context.identity.sourceIp</ip> <caller>$context.identity.caller</caller> <user>$context.identity.user</user> <requestTime>$context.requestTime</requestTime> <httpMethod>$context.httpMethod</httpMethod> <resourcePath>$context.resourcePath</resourcePath> <status>$context.status</status> <protocol>$context.protocol</protocol> <responseLength>$context.responseLength</responseLength><errorMessage>$context.error.message</errorMessage></request>'
EndpointConfiguration:
Type: REGIONAL
OpenApiVersion: "2.0"
OpenApiVersion: "2.0"
StageName: live
BinaryMediaTypes: ["*/*"]
DefinitionBody:
swagger: "2.0"
info:
Expand Down Expand Up @@ -2874,58 +2844,6 @@ Resources:
application/json: "{\"statusCode\": 200}"
passthroughBehavior: "when_no_match"
type: "mock"
/image-processor:
get:
consumes:
- "application/json"
produces:
- "application/json"
responses:
"200":
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
x-amazon-apigateway-integration:
uri: !Sub "arn:aws:apigateway:ca-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ca-central-1:${AWS::AccountId}:function:${LambdaImageProcessor}/invocations"
httpMethod: "POST"
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
type: "aws_proxy"
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
"200":
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
method.response.header.Access-Control-Allow-Origin: "'*'"
requestTemplates:
application/json: "{\"statusCode\": 200}"
passthroughBehavior: "when_no_match"
type: "mock"
/community/add:
post:
produces:
Expand Down Expand Up @@ -4452,11 +4370,42 @@ Resources:
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
requestTemplates:
application/json: "{\r\n \"lang\" : \"$input.params('lang')\",\r\n \
application/json: "{\r\n \"method\" : \"GET\",\r\n \
\ \"lang\" : \"$input.params('lang')\",\r\n \
\ \"metadata\" : \"$input.params('metadata')\",\r\n \
\ \"id\" : \"$input.params('id')\"\r\n}"
passthroughBehavior: "when_no_templates"
contentHandling: "CONVERT_TO_TEXT"
post:
produces:
- "application/json"
responses:
"200":
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
security:
- api_key: []
x-amazon-apigateway-integration:
type: "aws"
httpMethod: "POST"
uri: !Sub "arn:aws:apigateway:ca-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ca-central-1:${AWS::AccountId}:function:${LambdaViewerConfigService}/invocations"
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
requestTemplates:
application/json: |
{
"method" : "POST",
"body" : "$util.base64Encode($input.body)"
}
passthroughBehavior: "when_no_match"
contentHandling: "CONVERT_TO_TEXT"
options:
consumes:
- "application/json"
Expand Down
103 changes: 101 additions & 2 deletions docs/cloudformation/tiler-web-presence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ Parameters:
- "true"
- "false"

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

Resources:
TiTiler:
Expand Down Expand Up @@ -108,6 +110,51 @@ Resources:
Method: any
Layers:
- arn:aws:lambda:ca-central-1:552819999234:layer:titiler:8

LambdaImageProcessor:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.10
Role: !GetAtt LambdaExecutionRole.Arn
CodeUri:
Bucket: !Ref DeploymentBucket
Key:
Fn::If:
- IsProd
- cloudformation-templates/lambda/image-processor/image-processor-20240619-1400.zip
- Fn::If:
- IsStage
- cloudformation-templates/lambda/image-processor/image-processor-20240619-1400.zip
- cloudformation-templates/lambda/image-processor/image-processor-20240619-1400.zip
MemorySize: 3009
Handler: app.lambda_handler
Timeout: 60
Events:
ApiEvent:
Type: Api
Properties:
RestApiId: !Ref RestApi
Path: /image-processor
Method: any
Layers:
- arn:aws:lambda:ca-central-1:770693421928:layer:Klayers-p310-Pillow:7
- arn:aws:lambda:ca-central-1:770693421928:layer:Klayers-p310-requests:11


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

VerificationHeaderSecret:
Type: AWS::SecretsManager::Secret
Expand Down Expand Up @@ -231,7 +278,7 @@ Resources:
Type: REGIONAL
OpenApiVersion: '2.0'
StageName: live
BinaryMediaTypes: ["image/*","application/vnd.oai.openapi+json"]
BinaryMediaTypes: ["*/*","application/vnd.oai.openapi+json"]
DefinitionBody:
swagger: '2.0'
info:
Expand Down Expand Up @@ -265,6 +312,58 @@ Resources:
httpMethod: POST
uri: !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${TiTiler.Arn}/invocations'
responses: {}
/image-processor:
get:
consumes:
- "application/json"
produces:
- "application/json"
responses:
"200":
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
x-amazon-apigateway-integration:
uri: !Sub "arn:aws:apigateway:ca-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ca-central-1:${AWS::AccountId}:function:${LambdaImageProcessor}/invocations"
httpMethod: "POST"
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
type: "aws_proxy"
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
"200":
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
method.response.header.Access-Control-Allow-Origin: "'*'"
requestTemplates:
application/json: "{\"statusCode\": 200}"
passthroughBehavior: "when_no_match"
type: "mock"

LogGroup:
Type: Custom::LogGroup
Expand Down
Binary file not shown.

0 comments on commit 59afa3f

Please sign in to comment.