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

Commit 805daf4

Browse files
ahl27rsmaydabnurzhanov
authored
[Code Review] Installation Script (#7)
* Added script to install FHIR Solution on OSX/Linux, tested on OSX and CentOS (on a Cloud9 instance). Minor known bug in IAM creation when run from a Cloud9 instance. Commit also includes two files required for the install script, CF-IAMUser.yaml and iam_policy.json. * Added capability to detect if FHIR server is already running, and if it is, to ask the user if they want to redeploy the server. * Updated README.md with documentation of new installation script. * Added informational output when user reruns install script and chooses not to redeploy server. * fixed major bug with installing depedencies on Ubuntu systems. * aliased node for systems that install nodejs as 'nodejs' * Working through errors installing dependencies on Ubuntu. This version successfully installs all dependencies except yarn (currently resolving) * fixed bug with yarn, all dependencies now correctly installing on Ubuntu * Attempted to fix the problem, still causing issues on systems that already have installed. * Fixed issue with yarn, now experiencing issues with node being outdated (Ubuntu installs node 8.x, 9.x is required). * Fixed bugs with Ubuntu--all is now working properly (tested on Ubuntu 18.04). Will later add functionality for users to manually install dependencies but use install script for the rest. * Fixed redeployment--no need to remove server if it already exists. * Update scripts/CF-IAMUser.yaml Updated wording on YAML file as per Robert's suggestion Co-authored-by: Robert Smayda <[email protected]> * resolved most issues brought up by Robert in PR CR * minor fixes * Update README.md Co-authored-by: Bakha <[email protected]> * Update README.md Minor changes * Added windows installation script. * Minor change, inaccurate path reference when deploying DynamoDB Backups * Added documentation in README for Windows install, and added validation of AWS credentials to Unix install. * minor grammatical changes * Update .gitignore Info_Output.yml has personal information generated during installation, and thus it's a good idea to ignore it for commits. * Fixed some issues brought up by Robert * Added a request for confirmation from user that installing dependencies is okay [Unix script] * fixed minor bug in Install-Dependencies, and redirected error output to alternate stream in cases that fail on purpose. * Update CF-IAMUser.yaml * Update README.md Fixed minor errors in README * added y/n support for shell script, fixed issues with regions on both scripts * fixed a minor bug where the linux script couldn't find the yaml file for backups, and changed jest testing mode to --silent * Fixed bugs found while reviewing code with Robert. Added password text masking during input, checking for AWSPowerShell module on Windows, correctly changing directory on Windows, plus some other minor bug fixes. * Update README.md Co-authored-by: Robert Smayda <[email protected]> * Update README.md Co-authored-by: Robert Smayda <[email protected]> * Update scripts/win_install.ps1 Co-authored-by: Robert Smayda <[email protected]> * minor typos and fixess * changed README to be more concise in manual IAM User Creation step, referencing iam_policy.json instead of writing out the whole policy in the README doc * Update install.sh fixed minor bug in get_valid_pass() introduced in previous commit * Update README.md Co-authored-by: Robert Smayda <[email protected]> * fixed issue with Cognito IDP signup, changed relative paths to absolute paths * Install script container (#16) * Add container to perform isolated install * Minor fix to add new line between password prompts * remove vim * Update README.md Merged by Aidan Lakshman ([email protected]) Co-authored-by: Robert Smayda <[email protected]> Co-authored-by: Bakha <[email protected]> Co-authored-by: Bakha <[email protected]>
1 parent 1bffbef commit 805daf4

9 files changed

+1388
-222
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Ignore any zip files
77
*.zip
88

9+
Info_Output.yml
910
dist
1011
.build
1112
.idea

README.md

+298-221
Large diffs are not rendered by default.

docker/Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM node:14.4
2+
3+
RUN apt-get update && apt-get install -yq less
4+
5+
# Required dependencies
6+
RUN curl -fsSL --compressed "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip && unzip -q /tmp/awscliv2.zip -d /tmp && /tmp/aws/install && npm install serverless -g
7+
8+
WORKDIR /home/node
9+
10+
# git checkout current repository
11+
# RUN git clone https://github.com/awslabs/aws-fhir-solution.git aws-fhir-solution
12+
# Temporary use local copy
13+
RUN mkdir aws-fhir-solution
14+
COPY ./ ./aws-fhir-solution/
15+
RUN chown -R node:node .
16+
17+
USER node
18+
ENV DOCKER=true
19+
20+
ENTRYPOINT [ "aws-fhir-solution/scripts/install.sh" ]
21+
# CMD [ "aws-fhir-solution/scripts/install.sh" ]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint-fix": "eslint --fix . --ext .ts,.tsx",
1212
"build": "tsc",
1313
"watch": "tsc -w",
14-
"test": "jest",
14+
"test": "jest --silent",
1515
"test-coverage": "jest --coverage",
1616
"release": "yarn run build && yarn run lint && yarn run test",
1717
"clean": "rm -rf build/* node_modules/* dist/* .serverless/* .nyc_output/*",

scripts/CF-IAMUser.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Metadata:
3+
License: Apache-2.0
4+
Description: 'AWS CloudFormation to create an IAM User with the required permissions to create the FHIR Solution'
5+
Resources:
6+
FHIRUser:
7+
Type: AWS::IAM::User
8+
Properties:
9+
Policies:
10+
- PolicyName: FHIR_policy
11+
PolicyDocument: #Note: this is the same as iam_policy.json
12+
Version: 2012-10-17
13+
Statement:
14+
- Effect: Allow
15+
Action:
16+
- 'cloudwatch:*'
17+
- 'dynamodb:*'
18+
- 'events:*'
19+
- 'iam:*'
20+
- 'lambda:*'
21+
- 'logs:*'
22+
- 's3:*'
23+
- 'xray:PutTelemetryRecords'
24+
- 'xray:PutTraceSegments'
25+
- 'tag:GetResources'
26+
- 'logs:*'
27+
- 'cognito-identity:*'
28+
- 'cognito-idp:*'
29+
- 'cognito-sync:*'
30+
- 'es:*'
31+
- 'cloudformation:*'
32+
- 'kms:*'
33+
- 'states:*'
34+
- 'backup:*'
35+
- 'backup-storage:MountCapsule'
36+
Resource: '*'
37+
- Effect: Allow
38+
Action:
39+
- 'apigateway:*'
40+
Resource: 'arn:aws:apigateway:*::/*'
41+
42+
CFNKeys:
43+
Type: AWS::IAM::AccessKey
44+
Properties:
45+
UserName: !Ref 'FHIRUser'
46+
47+
48+
Outputs:
49+
IAMUserARN:
50+
Value: !GetAtt 'FHIRUser.Arn'
51+
Description: IAM User ARN
52+
AccessKey:
53+
Value: !Ref 'CFNKeys'
54+
Description: AWSAccessKeyId of new user
55+
SecretKey:
56+
Value: !GetAtt [CFNKeys, SecretAccessKey]
57+
Description: AWSSecretAccessKey of new user
58+
MyStacksRegion:
59+
Value: !Ref 'AWS::Region'
60+
Description: The Deployed AWS Region

scripts/iam_policy.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Effect": "Allow",
6+
"Action": [
7+
"cloudwatch:*",
8+
"dynamodb:*",
9+
"events:*",
10+
"iam:*",
11+
"lambda:*",
12+
"logs:*",
13+
"s3:*",
14+
"xray:PutTelemetryRecords",
15+
"xray:PutTraceSegments",
16+
"tag:GetResources",
17+
"logs:*",
18+
"cognito-identity:*",
19+
"cognito-idp:*",
20+
"cognito-sync:*",
21+
"es:*",
22+
"cloudformation:*",
23+
"kms:*",
24+
"states:*",
25+
"backup:*",
26+
"backup-storage:MountCapsule"
27+
],
28+
"Resource": "*"
29+
},
30+
{
31+
"Effect": "Allow",
32+
"Action": ["apigateway:*"],
33+
"Resource": "arn:aws:apigateway:*::/*"
34+
}
35+
]
36+
}

0 commit comments

Comments
 (0)