Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit acc124b

Browse files
authored
Deploy to Test Env on merge to mainline (#35)
1 parent e01e0f0 commit acc124b

File tree

6 files changed

+102
-30
lines changed

6 files changed

+102
-30
lines changed

.github/workflows/deploy.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Unit Tests and Deploy
2+
on:
3+
push:
4+
branches:
5+
- mainline
6+
jobs:
7+
unit-test:
8+
name: Unit Test and Linting
9+
runs-on: ubuntu-18.04
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Use Node.js
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: 12
18+
19+
- name: Install dependencies
20+
run: |
21+
cd auditLogMover
22+
yarn install
23+
cd ..
24+
yarn install
25+
- name: Lint
26+
run: |
27+
cd auditLogMover
28+
yarn lint
29+
cd ..
30+
yarn lint
31+
- name: Unit tests
32+
run: yarn test
33+
deploy:
34+
needs: unit-test
35+
name: Deploy to Dev
36+
runs-on: ubuntu-18.04
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v2
40+
- name: Use Node.js
41+
uses: actions/setup-node@v1
42+
with:
43+
node-version: 12
44+
- name: Setup config file
45+
env:
46+
DEV_AWS_USER_ACCOUNT_ARN: ${{ secrets.DEV_AWS_USER_ACCOUNT_ARN }}
47+
run: sed "s#<dev-arn>#$DEV_AWS_USER_ACCOUNT_ARN#g" serverless_config.template.json > serverless_config.json
48+
- name: Install serverless
49+
run: npm install -g serverless
50+
- name: Deploy FHIR Server and ddbToEs
51+
env:
52+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID}}
53+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
54+
run: |
55+
yarn install
56+
serverless deploy --stage dev --region us-west-2 --conceal
57+
- name: Deploy auditLogMover
58+
env:
59+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID}}
60+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
61+
run: |
62+
cd auditLogMover
63+
yarn install
64+
serverless deploy --stage dev --region us-west-2 --conceal
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
name: Test
1+
name: Unit Test
22
on:
3-
push:
4-
branches:
5-
- mainline
63
pull_request:
74
branches:
85
- mainline
96
jobs:
107
unit-test:
118
name: Unit Test and Linting
12-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-18.04
1310
steps:
1411
- name: Checkout
1512
uses: actions/checkout@v2
@@ -18,8 +15,16 @@ jobs:
1815
with:
1916
node-version: 12
2017
- name: Install dependencies
21-
run: yarn install
22-
- name: linter
23-
run: yarn lint
18+
run: |
19+
cd auditLogMover
20+
yarn install
21+
cd ..
22+
yarn install
23+
- name: Lint
24+
run: |
25+
cd auditLogMover
26+
yarn lint
27+
cd ..
28+
yarn lint
2429
- name: Unit tests
2530
run: yarn test

auditLogMover/serverless.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ resources:
9898
Type: AWS::CloudWatch::Alarm
9999
Properties:
100100
AlarmDescription: Alarm when there is a exportCloudwatchLogs-Failure'
101-
AlarmName: FhirSolution.AuditLogMover.ExportFailureAlarm
101+
AlarmName: FhirSolution.${self:custom.stage}.AuditLogMover.ExportFailureAlarm
102102
ActionsEnabled: False
103103
ComparisonOperator: GreaterThanOrEqualToThreshold
104104
EvaluationPeriods: 1
@@ -117,7 +117,7 @@ resources:
117117
Type: AWS::CloudWatch::Alarm
118118
Properties:
119119
AlarmDescription: Alarm when there is a deleteCloudwatchLogs-Failure'
120-
AlarmName: FhirSolution.AuditLogMover.DeleteFailureAlarm
120+
AlarmName: FhirSolution.${self:custom.stage}.AuditLogMover.DeleteFailureAlarm
121121
ActionsEnabled: False
122122
ComparisonOperator: GreaterThanOrEqualToThreshold
123123
EvaluationPeriods: 1

cloudformation/alarms.yaml

+19-19
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Resources:
44
Type: AWS::CloudWatch::Alarm
55
Properties:
66
AlarmDescription: Alarm when the Stream errors is more than 1 unit for 15 minutes out of the past 25 minutes. Streams do have retry logic
7-
AlarmName: FhirSolution.High.DDBToESLambdaErrorAlarm
7+
AlarmName: FhirSolution.${self:custom.stage}.High.DDBToESLambdaErrorAlarm
88
ActionsEnabled: False
99
ComparisonOperator: GreaterThanOrEqualToThreshold
1010
EvaluationPeriods: 5
@@ -24,7 +24,7 @@ Resources:
2424
Type: AWS::CloudWatch::Alarm
2525
Properties:
2626
AlarmDescription: Alarm when Fhir errors is more than 1
27-
AlarmName: FhirSolution.High.FhirLambdaErrorAlarm
27+
AlarmName: FhirSolution.${self:custom.stage}.High.FhirLambdaErrorAlarm
2828
ActionsEnabled: False
2929
ComparisonOperator: GreaterThanOrEqualToThreshold
3030
EvaluationPeriods: 2
@@ -44,7 +44,7 @@ Resources:
4444
Type: AWS::CloudWatch::Alarm
4545
Properties:
4646
AlarmDescription: Alarm when Fhir average latency is more than 2.5s; 2 times
47-
AlarmName: FhirSolution.Low.FhirLambdaLatencyAlarm
47+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirLambdaLatencyAlarm
4848
ActionsEnabled: False
4949
ComparisonOperator: GreaterThanOrEqualToThreshold
5050
EvaluationPeriods: 5
@@ -64,7 +64,7 @@ Resources:
6464
Type: AWS::CloudWatch::Alarm
6565
Properties:
6666
AlarmDescription: Alarm when Api GW has more than 1 5xx errors; 3 times
67-
AlarmName: FhirSolution.High.ApiGateway5XXErrorAlarm
67+
AlarmName: FhirSolution.${self:custom.stage}.High.ApiGateway5XXErrorAlarm
6868
ActionsEnabled: False
6969
ComparisonOperator: GreaterThanOrEqualToThreshold
7070
EvaluationPeriods: 5
@@ -84,7 +84,7 @@ Resources:
8484
Type: AWS::CloudWatch::Alarm
8585
Properties:
8686
AlarmDescription: Alarm when Api GW has more than 1 4xx errors; 3 times
87-
AlarmName: FhirSolution.Low.ApiGateway4XXErrorAlarm
87+
AlarmName: FhirSolution.${self:custom.stage}.Low.ApiGateway4XXErrorAlarm
8888
ActionsEnabled: False
8989
ComparisonOperator: GreaterThanOrEqualToThreshold
9090
EvaluationPeriods: 5
@@ -104,7 +104,7 @@ Resources:
104104
Type: AWS::CloudWatch::Alarm
105105
Properties:
106106
AlarmDescription: Alarm when Api GW average latency is more than 3s; 2 times
107-
AlarmName: FhirSolution.Low.ApiGatewayLatencyAlarm
107+
AlarmName: FhirSolution.${self:custom.stage}.Low.ApiGatewayLatencyAlarm
108108
ActionsEnabled: False
109109
ComparisonOperator: GreaterThanOrEqualToThreshold
110110
EvaluationPeriods: 5
@@ -122,7 +122,7 @@ Resources:
122122
ClusterStatusRedAlarm:
123123
Type: 'AWS::CloudWatch::Alarm'
124124
Properties:
125-
AlarmName: FhirSolution.High.FhirESClusterStatusRedAlarm
125+
AlarmName: FhirSolution.${self:custom.stage}.High.FhirESClusterStatusRedAlarm
126126
AlarmDescription: 'Primary and replica shards of at least one index are not allocated to nodes in a cluster.'
127127
ComparisonOperator: GreaterThanThreshold
128128
Dimensions:
@@ -141,7 +141,7 @@ Resources:
141141
Type: 'AWS::CloudWatch::Alarm'
142142
Condition: isNotDev
143143
Properties:
144-
AlarmName: FhirSolution.Low.FhirESClusterStatusYellowAlarm
144+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterStatusYellowAlarm
145145
AlarmDescription: 'Replica shards for at least one index are not allocated to 2 nodes in a cluster.'
146146
ComparisonOperator: GreaterThanThreshold
147147
Dimensions:
@@ -158,7 +158,7 @@ Resources:
158158
ClusterCPUUtilizationTooHighAlarm:
159159
Type: 'AWS::CloudWatch::Alarm'
160160
Properties:
161-
AlarmName: FhirSolution.High.FhirESClusterCPUUtilAlarm
161+
AlarmName: FhirSolution.${self:custom.stage}.High.FhirESClusterCPUUtilAlarm
162162
AlarmDescription: 'Average CPU utilization over last 10 minutes too high.'
163163
ComparisonOperator: GreaterThanThreshold
164164
Dimensions:
@@ -176,7 +176,7 @@ Resources:
176176
Type: 'AWS::CloudWatch::Alarm'
177177
Condition: isNotDev
178178
Properties:
179-
AlarmName: FhirSolution.Low.FhirESClusterMasterCPUUtilAlarm
179+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterMasterCPUUtilAlarm
180180
AlarmDescription: 'Average CPU utilization over last 10 minutes too high.'
181181
ComparisonOperator: GreaterThanThreshold
182182
Dimensions:
@@ -193,7 +193,7 @@ Resources:
193193
ClusterFreeStorageSpaceTooLowAlarm:
194194
Type: 'AWS::CloudWatch::Alarm'
195195
Properties:
196-
AlarmName: FhirSolution.Low.FhirESClusterFreeStorageSpaceTooLowAlarm
196+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterFreeStorageSpaceTooLowAlarm
197197
AlarmDescription: 'Cluster is running out of storage space.'
198198
ComparisonOperator: LessThanThreshold
199199
Dimensions:
@@ -210,7 +210,7 @@ Resources:
210210
ClusterIndexWritesBlockedTooHighAlarm:
211211
Type: 'AWS::CloudWatch::Alarm'
212212
Properties:
213-
AlarmName: FhirSolution.Low.FhirESClusterIndexWritesBlockedTooHighAlarm
213+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterIndexWritesBlockedTooHighAlarm
214214
AlarmDescription: 'Cluster is blocking incoming write requests.'
215215
ComparisonOperator: GreaterThanThreshold
216216
Dimensions:
@@ -227,7 +227,7 @@ Resources:
227227
ClusterJVMMemoryPressureTooHighAlarm:
228228
Type: 'AWS::CloudWatch::Alarm'
229229
Properties:
230-
AlarmName: FhirSolution.Low.FhirESClusterJVMMemoryAlarm
230+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterJVMMemoryAlarm
231231
AlarmDescription: 'Average JVM memory pressure over last 10 minutes too high.'
232232
ComparisonOperator: GreaterThanThreshold
233233
Dimensions:
@@ -245,7 +245,7 @@ Resources:
245245
Type: 'AWS::CloudWatch::Alarm'
246246
Condition: isNotDev
247247
Properties:
248-
AlarmName: FhirSolution.Low.FhirESClusterMasterJVMMemoryAlarm
248+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterMasterJVMMemoryAlarm
249249
AlarmDescription: 'Average JVM memory pressure over last 10 minutes too high.'
250250
ComparisonOperator: GreaterThanThreshold
251251
Dimensions:
@@ -263,7 +263,7 @@ Resources:
263263
Type: 'AWS::CloudWatch::Alarm'
264264
Condition: isNotDev
265265
Properties:
266-
AlarmName: FhirSolution.Low.FhirESClusterMasterNotReachableFromNodeAlarm
266+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterMasterNotReachableFromNodeAlarm
267267
AlarmDescription: 'Master node stopped or not reachable. Usually the result of a network connectivity issue or AWS dependency problem.'
268268
ComparisonOperator: LessThanThreshold
269269
Dimensions:
@@ -281,7 +281,7 @@ Resources:
281281
Type: 'AWS::CloudWatch::Alarm'
282282
Condition: isNotDev
283283
Properties:
284-
AlarmName: FhirSolution.Low.FhirESClusterSnapshotFailureAlarm
284+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterSnapshotFailureAlarm
285285
AlarmDescription: 'No automated snapshot was taken for the domain in the previous 36 hours.'
286286
ComparisonOperator: GreaterThanThreshold
287287
Dimensions:
@@ -299,7 +299,7 @@ Resources:
299299
Type: 'AWS::CloudWatch::Alarm'
300300
Condition: isDev
301301
Properties:
302-
AlarmName: FhirSolution.Low.FhirESClusterKibanaAlarm
302+
AlarmName: FhirSolution.${self:custom.stage}.Low.FhirESClusterKibanaAlarm
303303
AlarmDescription: 'Kibana is inaccessible.'
304304
ComparisonOperator: LessThanThreshold
305305
Dimensions:
@@ -316,7 +316,7 @@ Resources:
316316
ClusterKMSKeyErrorAlarm:
317317
Type: 'AWS::CloudWatch::Alarm'
318318
Properties:
319-
AlarmName: FhirSolution.High.FhirESClusterKMSErrorAlarm
319+
AlarmName: FhirSolution.${self:custom.stage}.High.FhirESClusterKMSErrorAlarm
320320
AlarmDescription: 'KMS customer master key used to encrypt data at rest has been disabled.'
321321
ComparisonOperator: GreaterThanThreshold
322322
Dimensions:
@@ -333,7 +333,7 @@ Resources:
333333
ClusterKMSKeyInaccessibleAlarm:
334334
Type: 'AWS::CloudWatch::Alarm'
335335
Properties:
336-
AlarmName: FhirSolution.High.FhirESClusterKMSInaccessibleAlarm
336+
AlarmName: FhirSolution.${self:custom.stage}.High.FhirESClusterKMSInaccessibleAlarm
337337
AlarmDescription: 'KMS customer master key used to encrypt data at rest has been deleted or revoked its grants to Amazon ES.'
338338
ComparisonOperator: GreaterThanThreshold
339339
Dimensions:

serverless.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ provider:
2828
ELASTICSEARCH_DOMAIN_ENDPOINT: !Join ['', ['https://', !GetAtt ElasticSearchDomain.DomainEndpoint]]
2929
OAUTH2_DOMAIN_ENDPOINT: !Join ['', ['https://', !Ref UserPoolDomain, '.auth.${self:custom.region}.amazoncognito.com/oauth2']]
3030
apiKeys:
31-
- name: developer-key
31+
- name: 'developer-key-${self:custom.stage}'
3232
description: Key for developer to access the FHIR Api
3333
usagePlan:
3434
throttle:

serverless_config.template.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"devAwsUserAccountArn": "<dev-arn>"
3+
}

0 commit comments

Comments
 (0)