-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI/CD - ECR/ECS Python Deployment Test
Signed-off-by: David Deal <[email protected]>
- Loading branch information
Showing
4 changed files
with
98 additions
and
19 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
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,16 @@ | ||
# Copyright The Linux Foundation and each contributor to CommunityBridge. | ||
# SPDX-License-Identifier: MIT | ||
|
||
FROM public.ecr.aws/lambda/python:3.7 | ||
|
||
# Copy requirements.txt | ||
COPY requirements.txt ${LAMBDA_TASK_ROOT} | ||
|
||
# Copy function code | ||
COPY *.py cla ${LAMBDA_TASK_ROOT} | ||
|
||
# Install the specified packages | ||
RUN pip install -r requirements.txt | ||
|
||
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile) | ||
CMD [ "wsgi_handler.handler" ] |
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 |
---|---|---|
|
@@ -49,10 +49,6 @@ custom: | |
number: 3 | ||
userEventsSNSTopicARN: arn:aws:sns:us-east-2:${aws:accountId}:userservice-triggers-${sls:stage}-user-sns-topic | ||
|
||
# For the python requirements add layer:true to put them into a Lambda Layer. | ||
pythonRequirements: | ||
layer: true | ||
|
||
certificate: | ||
arn: | ||
# From env Certificate Manager - | ||
|
@@ -111,6 +107,10 @@ custom: | |
dev: [email protected] | ||
staging: [email protected] | ||
prod: [email protected] | ||
ecr_img: | ||
dev: 395594542180.dkr.ecr.us-east-1.amazonaws.com/lfx-easycla-${sls:stage}:latest | ||
staging: 844390194980.dkr.ecr.us-east-1.amazonaws.com/lfx-easycla-${sls:stage}:latest | ||
prod: 716487311010.dkr.ecr.us-east-1.amazonaws.com/lfx-easycla-${sls:stage}:latest | ||
|
||
provider: | ||
name: aws | ||
|
@@ -121,6 +121,12 @@ provider: | |
logRetentionInDays: 14 | ||
lambdaHashingVersion: '20201221' # Resolution of lambda version hashes was improved with better algorithm, which will be used in next major release. Switch to it now by setting "provider.lambdaHashingVersion" to "20201221" | ||
|
||
ecr: | ||
# In this section you can define images that will be built locally and uploaded to ECR | ||
images: | ||
easyclaPythonAppImage: | ||
uri: ${self:custom.ecr_img.${sls:stage} | ||
|
||
apiGateway: | ||
# https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE | ||
shouldStartNameWithService: true | ||
|
@@ -392,7 +398,7 @@ provider: | |
Owner: "David Deal" | ||
|
||
plugins: | ||
- serverless-python-requirements | ||
#- serverless-python-requirements | ||
- serverless-wsgi | ||
- serverless-plugin-tracing | ||
# Serverless Finch does s3 uploading. Called with 'sls client deploy'. | ||
|
@@ -596,8 +602,12 @@ functions: | |
apiv1: | ||
handler: wsgi_handler.handler | ||
description: "EasyCLA Python API handler for the /v1 endpoints" | ||
layers: | ||
- Ref: PythonRequirementsLambdaLayer | ||
image: | ||
name: easyclaPythonAppImage | ||
command: | ||
- 'wsgi_handler.handler' | ||
#entryPoint: | ||
# - '/lambda-entrypoint.sh' | ||
events: | ||
- http: | ||
method: ANY | ||
|
@@ -607,8 +617,12 @@ functions: | |
apiv2: | ||
handler: wsgi_handler.handler | ||
description: "EasyCLA Python API handler for the /v2 endpoints" | ||
layers: | ||
- Ref: PythonRequirementsLambdaLayer | ||
image: | ||
name: easyclaPythonAppImage | ||
command: | ||
- 'wsgi_handler.handler' | ||
# layers: | ||
# - Ref: PythonRequirementsLambdaLayer | ||
events: | ||
- http: | ||
method: ANY | ||
|
@@ -618,8 +632,12 @@ functions: | |
salesforceprojects: | ||
handler: cla.salesforce.get_projects | ||
description: "EasyCLA API Callback Handler for fetching all SalesForce projects" | ||
layers: | ||
- Ref: PythonRequirementsLambdaLayer | ||
image: | ||
name: easyclaPythonAppImage | ||
command: | ||
- 'cla.salesforce.get_projects' | ||
# layers: | ||
# - Ref: PythonRequirementsLambdaLayer | ||
events: | ||
- http: | ||
method: ANY | ||
|
@@ -629,8 +647,12 @@ functions: | |
salesforceprojectbyID: | ||
handler: cla.salesforce.get_project | ||
description: "EasyCLA API Callback Handler for fetching SalesForce projects by ID" | ||
layers: | ||
- Ref: PythonRequirementsLambdaLayer | ||
image: | ||
name: easyclaPythonAppImage | ||
command: | ||
- 'cla.salesforce.get_project' | ||
# layers: | ||
# - Ref: PythonRequirementsLambdaLayer | ||
events: | ||
- http: | ||
method: ANY | ||
|
@@ -641,8 +663,12 @@ functions: | |
githubinstall: | ||
handler: wsgi_handler.handler | ||
description: "EasyCLA API Callback Handler for GitHub bot installations" | ||
layers: | ||
- Ref: PythonRequirementsLambdaLayer | ||
image: | ||
name: easyclaPythonAppImage | ||
command: | ||
- 'wsgi_handler.handler' | ||
# layers: | ||
# - Ref: PythonRequirementsLambdaLayer | ||
events: | ||
- http: | ||
method: ANY | ||
|
@@ -652,14 +678,17 @@ functions: | |
githubactivity: | ||
handler: wsgi_handler.handler | ||
description: "EasyCLA API Callback Handler for GitHub activity" | ||
layers: | ||
- Ref: PythonRequirementsLambdaLayer | ||
image: | ||
name: easyclaPythonAppImage | ||
command: | ||
- 'wsgi_handler.handler' | ||
# layers: | ||
# - Ref: PythonRequirementsLambdaLayer | ||
events: | ||
- http: | ||
method: POST | ||
path: v2/github/activity | ||
|
||
|
||
resources: | ||
Conditions: | ||
# Helper functions since we conditionally create some resources | ||
|