Skip to content

Commit

Permalink
update with deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
gugzkumar committed Dec 13, 2019
1 parent b00e669 commit 7fc4662
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*.d.ts
node_modules
package-lock.json
.env
*.env
backup.env
.ipynb_checkpoints
SimpleServer.ipynb
Expand Down
5 changes: 5 additions & 0 deletions api/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sam package --s3-bucket scratch-cheetsheet-deployment --debug
sam deploy --stack-name sam-app \
--parameter-overrides LayerArn=$LAMBDA_LAYER \
--s3-prefix deploy --s3-bucket scratch-cheetsheet-deployment --debug \
--region $AWS_DEFAULT_REGION --capabilities CAPABILITY_IAM
11 changes: 6 additions & 5 deletions api/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,31 @@ Resources:
Handler: app.main
Layers:
- !Sub '${LayerArn}'
Role: arn:aws:iam::056825751459:role/service-role/scratch-cheet-sheet-lambda-role
Events:
#/sheet
Get_sheet:
GetSheet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /sheet
Method: get
Post_sheet/{sheetName}:
PostSheet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /sheet
Method: post
#/sheet/{sheetName}
Get_sheet/{sheetName}:
GetSheetSheetName:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /sheet/{sheetName}
Method: get
Delete_sheet/{sheetName}:
DeleteSheetSheetName:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /sheet/{sheetName}
Method: delete
Put_sheet/{sheetName}:
PutSheetSheetName:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /sheet/{sheetName}
Expand Down
43 changes: 43 additions & 0 deletions docker-compose.deploy.code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ------------------------------------------------------------------------------
# CODE DOCKER COMPOSE
#
# This Docker Compose is meant to deploy frontend code and backend code
# to a remote environment.
#
# What this deploys:
# - Angular code to an S3 bucket
# - Lambda Function that connects to an API Gateway
#
# Prerequisites:
# - Cognito Userpool
# - API Gateway
# - S3 Bucket for UI hosting
# - S3 Bucket for App Data Storage
#
# ------------------------------------------------------------------------------
version: '3.7'
services:
# --------------------------------------------------------------------------
# FRONTEND WRITTEN IN ANGULAR
# --------------------------------------------------------------------------
serverless-angular-client-ui:
build: ./client-ui
container_name: serverless-angular-client-ui
volumes:
- ./client-ui:/usr/src/app
- /usr/src/app/node_modules
command: sh deploy.sh
# --------------------------------------------------------------------------
# BACKEND WRITTEN IN AWS SAM LOCAL
# --------------------------------------------------------------------------
serverless-lambda-api:
build: ./api
container_name: serverless-lambda-api
volumes:
- ./api:/app
environment:
- AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
- AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- LAMBDA_LAYER:$LAMBDA_LAYER
# command: bash deploy.sh
21 changes: 21 additions & 0 deletions docker-compose.deploy.infrastructure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ------------------------------------------------------------------------------
# INFRASTRUCTURE DOCKER COMPOSE
#
# This Docker Compose is meant provision the necessary AWS resources
# for a user. This includes VPC's, Subnets, Roles and Policies.
#
# What this sets up:
# - Cognito Userpool
# - API Gateway
# - S3 Bucket for UI hosting
# - S3 Bucket for App Data Storage
# - S3 Bucket for Code Deployment Artifacts
#
# Prerequisites:
# - AWS VPC
# - Route53 Domains
# - Cloud Front CDN
#
# Note: If you don't have a Cloud Admin who can set this up for you
# it is recommended to use docker-compose.network.yml
# ------------------------------------------------------------------------------
6 changes: 6 additions & 0 deletions docker-compose.deploy.network.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ------------------------------------------------------------------------------
# NETWORK DOCKER COMPOSE
#
# This Docker Compose is meant to setup the necessary network infrastructure
# for the app. This includes VPC's, Subnets, Roles and Policies.
# ------------------------------------------------------------------------------
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ------------------------------------------------------------------------------
# LOCAL DOCKER COMPOSE
#
# This Docker Compose is meant to run the App locally on ones machine.
# Its use case is for development.
# ------------------------------------------------------------------------------
version: '3.7'
services:
# --------------------------------------------------------------------------
Expand Down

0 comments on commit 7fc4662

Please sign in to comment.