-
Notifications
You must be signed in to change notification settings - Fork 2
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 #4 from avantifellows/set_ci_cd
Initializes CI CD setup
- Loading branch information
Showing
13 changed files
with
260 additions
and
75 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,54 @@ | ||
# This workflow will update the code for the production environment | ||
|
||
on: | ||
push: | ||
branches: ["release"] | ||
|
||
name: Deploy to production | ||
|
||
jobs: | ||
build_and_deploy: | ||
name: Deploy | ||
environment: | ||
name: Production | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: Set up SAM | ||
uses: aws-actions/setup-sam@v1 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-south-1 | ||
|
||
- name: Build | ||
run: sam build --use-container -t templates/prod.yaml | ||
|
||
- name: Deploy | ||
env: | ||
DYNAMODB_URL: ${{ secrets.DYNAMODB_URL }} | ||
DYNAMODB_REGION: ${{ secrets.DYNAMODB_REGION }} | ||
DYNAMODB_ACCESS_KEY: ${{ secrets.DYNAMODB_ACCESS_KEY }} | ||
DYNAMODB_SECRET_KEY: ${{ secrets.DYNAMODB_SECRET_KEY }} | ||
run: > | ||
sam deploy | ||
--stack-name ReportingProduction | ||
--s3-bucket reporting-engine-production | ||
--no-confirm-changeset | ||
--no-fail-on-empty-changeset | ||
--region ap-south-1 | ||
--capabilities CAPABILITY_IAM | ||
--parameter-overrides | ||
DynamodbUrl=$DYNAMODB_URL | ||
DynamodbRegion=$DYNAMODB_REGION | ||
DynamodbAccessKey=$DYNAMODB_ACCESS_KEY | ||
DynamodbSecretKey=$DYNAMODB_SECRET_KEY |
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,55 @@ | ||
# This workflow will update the code for the staging environment | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: ["main"] | ||
|
||
name: Deploy to staging | ||
|
||
jobs: | ||
build_and_deploy: | ||
name: Deploy | ||
environment: | ||
name: Staging | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: Set up SAM | ||
uses: aws-actions/setup-sam@v1 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-south-1 | ||
|
||
- name: Build | ||
run: sam build --use-container -t templates/staging.yaml | ||
|
||
- name: Deploy | ||
env: | ||
DYNAMODB_URL: ${{ secrets.DYNAMODB_URL }} | ||
DYNAMODB_REGION: ${{ secrets.DYNAMODB_REGION }} | ||
DYNAMODB_ACCESS_KEY: ${{ secrets.DYNAMODB_ACCESS_KEY }} | ||
DYNAMODB_SECRET_KEY: ${{ secrets.DYNAMODB_SECRET_KEY }} | ||
run: > | ||
sam deploy | ||
--stack-name ReportingStaging | ||
--s3-bucket reporting-engine-staging | ||
--no-confirm-changeset | ||
--no-fail-on-empty-changeset | ||
--region ap-south-1 | ||
--capabilities CAPABILITY_IAM | ||
--parameter-overrides | ||
DynamodbUrl=$DYNAMODB_URL | ||
DynamodbRegion=$DYNAMODB_REGION | ||
DynamodbAccessKey=$DYNAMODB_ACCESS_KEY | ||
DynamodbSecretKey=$DYNAMODB_SECRET_KEY |
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,24 @@ | ||
anyio==3.6.1 | ||
autopep8==1.6.0 | ||
boto3==1.24.35 | ||
botocore==1.27.35 | ||
click==8.1.3 | ||
fastapi==0.79.0 | ||
h11==0.13.0 | ||
idna==3.3 | ||
Jinja2==3.1.2 | ||
jmespath==1.0.1 | ||
MarkupSafe==2.1.1 | ||
pycodestyle==2.8.0 | ||
pydantic==1.9.1 | ||
python-dateutil==2.8.2 | ||
python-dotenv==0.20.0 | ||
s3transfer==0.6.0 | ||
six==1.16.0 | ||
sniffio==1.2.0 | ||
starlette==0.19.1 | ||
toml==0.10.2 | ||
typing_extensions==4.3.0 | ||
urllib3==1.26.10 | ||
uvicorn==0.18.2 | ||
mangum==0.14.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
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -21,3 +21,4 @@ toml==0.10.2 | |
typing_extensions==4.3.0 | ||
urllib3==1.26.10 | ||
uvicorn==0.18.2 | ||
mangum==0.14.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
Transform: AWS::Serverless-2016-10-31 | ||
Description: Reporting Engine - Production - FastAPI on Lambda | ||
|
||
Parameters: | ||
DynamodbUrl: | ||
Type: String | ||
Description: Url of Dynamodb instance | ||
DynamodbRegion: | ||
Type: String | ||
Description: Region of Dynamodb instance | ||
DynamodbAccessKey: | ||
Type: String | ||
Description: Access key credentials of Dynamodb instance | ||
DynamodbSecretKey: | ||
Type: String | ||
Description: Secret key credentials of Dynamodb instance | ||
|
||
Resources: | ||
Function: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
FunctionName: "ReportingProduction" | ||
CodeUri: ../app | ||
Handler: main.handler | ||
Runtime: python3.9 | ||
Environment: | ||
Variables: | ||
DYNAMODB_URL: !Ref DynamodbUrl | ||
DYNAMODB_REGION: !Ref DynamodbRegion | ||
DYNAMODB_ACCESS_KEY: !Ref DynamodbAccessKey | ||
DYNAMODB_SECRET_KEY: !Ref DynamodbSecretKey | ||
Events: | ||
Api: | ||
Type: HttpApi | ||
Properties: | ||
ApiId: !Ref Api | ||
|
||
Api: | ||
Type: AWS::Serverless::HttpApi | ||
|
||
Outputs: | ||
ApiUrl: | ||
Description: URL of your API | ||
Value: | ||
Fn::Sub: "https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/" |
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,46 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
Transform: AWS::Serverless-2016-10-31 | ||
Description: Reporting Engine - Staging - FastAPI on Lambda | ||
|
||
Parameters: | ||
DynamodbUrl: | ||
Type: String | ||
Description: Url of Dynamodb instance | ||
DynamodbRegion: | ||
Type: String | ||
Description: Region of Dynamodb instance | ||
DynamodbAccessKey: | ||
Type: String | ||
Description: Access key credentials of Dynamodb instance | ||
DynamodbSecretKey: | ||
Type: String | ||
Description: Secret key credentials of Dynamodb instance | ||
|
||
Resources: | ||
Function: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
FunctionName: "ReportingStaging" | ||
CodeUri: ../app | ||
Handler: main.handler | ||
Runtime: python3.9 | ||
Environment: | ||
Variables: | ||
DYNAMODB_URL: !Ref DynamodbUrl | ||
DYNAMODB_REGION: !Ref DynamodbRegion | ||
DYNAMODB_ACCESS_KEY: !Ref DynamodbAccessKey | ||
DYNAMODB_SECRET_KEY: !Ref DynamodbSecretKey | ||
Events: | ||
Api: | ||
Type: HttpApi | ||
Properties: | ||
ApiId: !Ref Api | ||
|
||
Api: | ||
Type: AWS::Serverless::HttpApi | ||
|
||
Outputs: | ||
ApiUrl: | ||
Description: URL of your API | ||
Value: | ||
Fn::Sub: "https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/" |