Skip to content

Commit

Permalink
standardizing environements
Browse files Browse the repository at this point in the history
  • Loading branch information
gugzkumar committed Dec 23, 2019
1 parent fdbefe5 commit 17dba4f
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import 'source-map-support/register';
import cdk = require('@aws-cdk/core');
import { CheetSheetInfrastructureStack } from '../lib/CheetSheetInfrastructure-stack';
import { CheetSheetNetworkStack } from '../lib/CheetSheetNetwork-stack';
const ENVIRONMENT = process.env['ENVIRONMENT'] || '';

if (ENVIRONMENT === '') {
Expand All @@ -18,3 +19,12 @@ new CheetSheetInfrastructureStack(
}
}
);
new CheetSheetNetworkStack(
app,
`CheetSheetNetworkStack-${ENVIRONMENT}`,
{
env: {
'region': process.env['AWS_DEFAULT_REGION']
}
}
);
2 changes: 1 addition & 1 deletion .aws-infrastructure/cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "npx ts-node bin/CheetSheetInfrastructure.ts"
"app": "npx ts-node bin/cdk.ts"
}
2 changes: 1 addition & 1 deletion .aws-infrastructure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cheet-sheet-infrastructure",
"version": "0.1.0",
"bin": {
"src": "bin/CheetSheetInfrastructure.js"
"src": "bin/cdk.js"
},
"scripts": {
"build": "tsc",
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ DO NOT TRY REPLICATING SERVICES
- https://aws.amazon.com/premiumsupport/knowledge-center/decode-verify-cognito-json-token/
- https://github.com/jpadilla/pyjwt/issues/359

## Run Infrastructure Deploy Environment
```
docker-compose -f docker-compose.deploy.infrastructure.yml down -v && docker-compose -f docker-compose.deploy.infrastructure.yml up --build -d
```

## Run Code Deploy Environment
```
docker-compose -f docker-compose.deploy.code.yml down -v && docker-compose -f docker-compose.deploy.code.yml up --build -d
docker-compose -f docker-compose.deploy.infrastructure.yml down -v && docker-compose -f docker-compose.deploy.infrastructure.yml up --build -d
```



Expand Down
1 change: 0 additions & 1 deletion api/src/__core__/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from os import environ
from __core__.utilities import decode_base64_to_json

AVAILABLE_FILE_TYPES = [
'abap', 'abc', 'actionscript', 'ada', 'apache_conf', 'apex', 'applescript', 'asciidoc', 'asl',
Expand Down
6 changes: 2 additions & 4 deletions api/standup-api.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Starts the API with SAM LOCAL
# sam build --use-container
# sam local start-api --host 0.0.0.0 -p 3000 -v $SAM_LOCAL_ABSOLUTE_PATH
# pip install -r ./requirements.txt -t src/__dependencies__
sam local start-api --skip-pull-image --host 0.0.0.0 -p 3000 -v $SAM_LOCAL_ABSOLUTE_PATH \
--parameter-overrides LayerArn=$LAMBDA_LAYER
--parameter-overrides LayerArn=$LAMBDA_LAYER RoleArn=$LAMBDA_IAM_ROLE SheetDataBucket=$SHEET_DATA_S3_BUCKET \
CognitoClientId=$COGNITO_CLIENT_ID CognitoJWKSBase64=$COGNITO_JWKS_BASE64
23 changes: 16 additions & 7 deletions api/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ Parameters:
LayerArn:
Type: String
Default: Override This Variable from the CLI
RoleArn:
Type: String
Default: Override This Variable from the CLI
SheetDataBucket:
Type: String
Default: Override This Variable from the CLI
CognitoClientId:
Type: String
Default: Override This Variable from the CLI
CognitoJWKSBase64:
Type: String
Default: Override This Variable from the CLI


# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Expand All @@ -19,12 +31,9 @@ Globals:
MemorySize: 512
Environment:
Variables:
CLIENT_UI_SUBDOMAIN: $CLIENT_UI_SUBDOMAIN
SHEET_DATA_S3_BUCKET: $SHEET_DATA_S3_BUCKET
COGNITO_CLIENT_ID: $COGNITO_CLIENT_ID
COGNITO_JWKS_BASE64: $COGNITO_JWKS_BASE64
APP_ADMIN_USER: $APP_ADMIN_USER
PUBLIC_SHEETS_FOLDER: $PUBLIC_SHEETS_FOLDER
SHEET_DATA_S3_BUCKET: !Sub '${SheetDataBucket}'
COGNITO_CLIENT_ID: !Sub '${CognitoClientId}'
COGNITO_JWKS_BASE64: !Sub '${CognitoJWKSBase64}'
Api:
Cors:
AllowMethods: "'*'"
Expand All @@ -40,7 +49,7 @@ Resources:
Handler: app.main
Layers:
- !Sub '${LayerArn}'
Role: arn:aws:iam::056825751459:role/service-role/scratch-cheet-sheet-lambda-role
Role: !Sub '${RoleArn}'
Events:
#/sheet
GetSheet:
Expand Down
2 changes: 1 addition & 1 deletion client-ui/src/app/index-card/index-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</mat-card-content>
<mat-card-actions *ifEditMode style="z-index: 200;">
<button mat-raised-button (click)="clickEdit($event)">EDIT</button>
<button mat-raised-button color="warn">DELETE</button>
<button mat-raised-button color="warn">REMOVE</button>
</mat-card-actions>
</mat-card>
</div>
34 changes: 0 additions & 34 deletions docker-compose.utils.yml

This file was deleted.

0 comments on commit 17dba4f

Please sign in to comment.