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

fix: change output file type #396

Merged
merged 5 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Ignore any zip files
*.zip

Info_Output.yml
Info_Output.log
dist
.build
.idea
Expand Down
8 changes: 4 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ You can also use their abbreviations:
docker run -it -l install-container fhir-server-install -r <REGION> -s <STAGE>
```

If you would like to retrieve `Info_Output.yml` file from the container, use the following commands:
If you would like to retrieve `Info_Output.log` file from the container, use the following commands:

```sh
container_id=$(docker ps -f "label=install-container" --format "{{.ID}}")
docker cp ${container_id}:/home/node/fhir-works-on-aws-deployment/Info_Output.yml .
docker cp ${container_id}:/home/node/fhir-works-on-aws-deployment/Info_Output.log .
```

To remove container:
Expand Down Expand Up @@ -353,7 +353,7 @@ and execute the following command:
ACCESS_KEY=<ACCESS_KEY> SECRET_KEY=<SECRET_KEY> ES_DOMAIN_ENDPOINT=<ES_DOMAIN_ENDPOINT> node elasticsearch-operations.js <REGION> "<function to execute>" "<optional additional params>"
```

These parameters can be found by checking the `INFO_OUTPUT.yml` file generated by the installation script, or by running the previously mentioned `serverless info --verbose` command.
These parameters can be found by checking the `Info_Output.log` file generated by the installation script, or by running the previously mentioned `serverless info --verbose` command.

### Optional installation configurations

Expand All @@ -365,7 +365,7 @@ Accessing the Kibana server requires you to set up a Cognito user. The installat

The installation script will print the URL to the Kibana server after setup completes. Navigate to this URL and enter your login credentials to access the Kibana server.

If you lose this URL, it can be found in the `INFO_OUTPUT.yml` file under the "ElasticsearchDomainKibanaEndpoint" entry.
If you lose this URL, it can be found in the `Info_Output.log` file under the "ElasticsearchDomainKibanaEndpoint" entry.

##### Accessing Elasticsearch Kibana server

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This project is licensed under the Apache-2.0 license.

### Retrieving user variables

After installation, all user-specific variables (such as `USER_POOL_APP_CLIENT_ID`) can be found in the `INFO_OUTPUT.yml` file. You can also retrieve these values by running the following command:
After installation, all user-specific variables (such as `USER_POOL_APP_CLIENT_ID`) can be found in the `Info_Output.log` file. You can also retrieve these values by running the following command:
```
serverless info --verbose --region <REGION> --stage <STAGE>.
```
Expand Down Expand Up @@ -101,7 +101,7 @@ Set up the following three environment variables:

For instructions on importing the environment JSON, click [here](https://thinkster.io/tutorials/testing-backend-apis-with-postman/managing-environments-in-postman).

The following variables required in the Postman collection can be found in `Info_Output.yml` or by running `serverless info --verbose`:
The following variables required in the Postman collection can be found in `Info_Output.log` or by running `serverless info --verbose`:
+ API_URL: from Service Information:endpoints: ANY
+ API_KEY: from Service Information: api keys: developer-key
+ CLIENT_ID: from Stack Outputs: UserPoolAppClientId
Expand Down Expand Up @@ -138,7 +138,7 @@ To access the FHIR API, an access token is required. This can be obtained by fol

**Retrieving an access token using aws.cognito.signin.user.admin**

A Cognito OAuth access token can be obtained using the following command substituting all variables with their values from `INFO_OUTPUT.yml` or by using the `serverless info --verbose` command.
A Cognito OAuth access token can be obtained using the following command substituting all variables with their values from `Info_Output.log` or by using the `serverless info --verbose` command.
+ For Windows, enter:
```sh
scripts/init-auth.py <CLIENT_ID> <REGION>
Expand Down
26 changes: 13 additions & 13 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ function install_dependencies(){
return 0
}

#Function to parse YAML files
##Usage: eval $(parse_yaml <FILE_PATH> <PREFIX>)
##Output: adds variables from YAML file to namespace of script
#Function to parse log files
##Usage: eval $(parse_log <FILE_PATH> <PREFIX>)
##Output: adds variables from log file to namespace of script
## variable names are prefixed with <PREFIX>, if supplied
## sublists are marked with _
##
Expand All @@ -115,7 +115,7 @@ function install_dependencies(){
##Example Output:
## testLeve1_testLevel2=3
##
function parse_yaml() {
function parse_log() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
Expand Down Expand Up @@ -237,11 +237,11 @@ if $already_deployed; then
echo -e "\nOkay, let's redeploy the server.\n"
else
if ! $fail; then
eval $( parse_yaml Info_Output.yml )
eval $( parse_log Info_Output.log )
echo -e "\n\nSetup completed successfully."
echo -e "You can now access the FHIR APIs directly or through a service like POSTMAN.\n\n"
echo "For more information on setting up POSTMAN, please see the README file."
echo -e "All user details were stored in 'Info_Output.yml'.\n"
echo -e "All user details were stored in 'Info_Output.log'.\n"
echo -e "You can obtain new Cognito authorization tokens by using the init-auth.py script.\n"
echo "Syntax: "
echo "AWS_ACCESS_KEY_ID=<ACCESS_KEY> AWS_SECRET_ACCESS_KEY=<SECRET-KEY> python3 scripts/init-auth.py <USER_POOL_APP_CLIENT_ID> <REGION>"
Expand Down Expand Up @@ -299,15 +299,15 @@ echo -e "\n\nFHIR Works is deploying. A fresh install will take ~20 mins\n\n"
## Deploy to stated region
yarn run serverless deploy --region $region --stage $stage || { echo >&2 "Failed to deploy serverless application."; exit 1; }

## Output to console and to file Info_Output.yml. tee not used as it removes the output highlighting.
## Output to console and to file Info_Output.log. tee not used as it removes the output highlighting.
echo -e "Deployed Successfully.\n"
touch Info_Output.yml
SLS_DEPRECATION_DISABLE=* yarn run serverless info --verbose --region $region --stage $stage && SLS_DEPRECATION_DISABLE=* yarn run serverless info --verbose --region $region --stage $stage > Info_Output.yml
touch Info_Output.log
SLS_DEPRECATION_DISABLE=* yarn run serverless info --verbose --region $region --stage $stage && SLS_DEPRECATION_DISABLE=* yarn run serverless info --verbose --region $region --stage $stage > Info_Output.log
#The double call to serverless info was a bugfix from Steven Johnston
#(may not be needed)

#Read in variables from Info_Output.yml
eval $( parse_yaml Info_Output.yml )
#Read in variables from Info_Output.log
eval $( parse_log Info_Output.log )


## Cognito Init
Expand Down Expand Up @@ -350,7 +350,7 @@ if [ $stage == 'dev' ]; then
echo -e "\nSuccess: Created a cognito user.\n\n \
You can now log into the Kibana server using the email address you provided (username) and your temporary password.\n \
You may have to verify your email address before logging in.\n \
The URL for the Kibana server can be found in ./Info_Output.yml in the 'ElasticSearchDomainKibanaEndpoint' entry.\n\n \
The URL for the Kibana server can be found in ./Info_Output.log in the 'ElasticSearchDomainKibanaEndpoint' entry.\n\n \
This URL will also be copied below:\n \
$ElasticSearchDomainKibanaEndpoint"
break
Expand Down Expand Up @@ -399,7 +399,7 @@ fi
echo -e "\n\nSetup completed successfully."
echo -e "You can now access the FHIR APIs directly or through a service like POSTMAN.\n\n"
echo "For more information on setting up POSTMAN, please see the README file."
echo -e "All user details were stored in 'Info_Output.yml'.\n"
echo -e "All user details were stored in 'Info_Output.log'.\n"
echo -e "You can obtain new Cognito authorization tokens by using the init-auth.py script.\n"
echo "Syntax: "
echo "python3 scripts/init-auth.py <USER_POOL_APP_CLIENT_ID> <REGION>"
Expand Down
36 changes: 18 additions & 18 deletions scripts/win_install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ function Install-Dependencies {
return
}

#Function to get a value from YAML files
## Usage: GetFrom-Yaml "AttributeName"
## GetFrom-Yaml "UserClientId"
## Output: value stored in YAML
## Note: This function only reads single lines of YAML files
function GetFrom-Yaml {
#Function to get a value from Log files
## Usage: GetFrom-Log "AttributeName"
## GetFrom-Log "UserClientId"
## Output: value stored in Info_Output.log
## Note: This function only reads single lines of log files
function GetFrom-Log {
Param($valName)
gc Info_Output.yml | % { if($_ -match "^[`t` ]*$valName") {Return $_.split(": ")[-1]}}
gc Info_Output.log | % { if($_ -match "^[`t` ]*$valName") {Return $_.split(": ")[-1]}}
}

function Get-ValidPassword {
Expand Down Expand Up @@ -274,16 +274,16 @@ if (-Not ($?) ) {
}
Write-Host "Deployed Successfully.`n"

rm Info_Output.yml
fc >> Info_Output.yml
yarn run serverless info --verbose --region $region --stage $stage | Out-File -FilePath .\Info_Output.yml
rm Info_Output.log
fc >> Info_Output.log
yarn run serverless info --verbose --region $region --stage $stage | Out-File -FilePath .\Info_Output.log

#Read in variables from Info_Output.yml
$UserPoolId = GetFrom-Yaml "UserPoolId"
$UserPoolAppClientId = GetFrom-Yaml "UserPoolAppClientId"
$region = GetFrom-Yaml "Region"
$ElasticSearchKibanaUserPoolAppClientId = GetFrom-Yaml "ElasticSearchKibanaUserPoolAppClientId"
$ElasticSearchDomainKibanaEndpoint = GetFrom-Yaml "ElasticSearchDomainKibanaEndpoint"
#Read in variables from Info_Output.log
$UserPoolId = GetFrom-Log "UserPoolId"
$UserPoolAppClientId = GetFrom-Log "UserPoolAppClientId"
$region = GetFrom-Log "Region"
$ElasticSearchKibanaUserPoolAppClientId = GetFrom-Log "ElasticSearchKibanaUserPoolAppClientId"
$ElasticSearchDomainKibanaEndpoint = GetFrom-Log "ElasticSearchDomainKibanaEndpoint"

#refresh environment variables without exiting script
Refresh-Environment
Expand Down Expand Up @@ -352,7 +352,7 @@ if ($stage -eq "dev"){
Write-Host "`nSuccess: Created a cognito user.`n`n \
You can now log into the Kibana server using the email address you provided (username) and your temporary password.`n \
You may have to verify your email address before logging in.`n \
The URL for the Kibana server can be found in ./Info_Output.yml in the 'ElasticSearchDomainKibanaEndpoint' entry.`n`n \
The URL for the Kibana server can be found in ./Info_Output.log in the 'ElasticSearchDomainKibanaEndpoint' entry.`n`n \
This URL will also be copied below:`n \
https:$ElasticSearchDomainKibanaEndpoint"
}
Expand Down Expand Up @@ -417,7 +417,7 @@ for(;;) {
Write-Host "`n`nSetup completed successfully."
Write-Host "You can now access the FHIR APIs directly or through a service like POSTMAN.`n`n"
Write-Host "For more information on setting up POSTMAN, please see the README file."
Write-Host "All user details were stored in 'Info_Output.yml'.`n"
Write-Host "All user details were stored in 'Info_Output.log'.`n"
Write-Host "You can obtain new Cognito authorization tokens by using the init-auth.py script.`n"
Write-Host "Syntax: "
Write-Host "python3 scripts/init-auth.py <USER_POOL_APP_CLIENT_ID> <REGION>"
Expand Down