-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from nasa/KMS-511
KMS-511: Deploying basic serverless app to house KMS functionality
- Loading branch information
Showing
25 changed files
with
22,468 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
.eslintrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
// Let eslint know were working as a browser to allow the standard globals (document, window, etc.) | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
|
||
"overrides": [ | ||
{ | ||
"files": [ "**/__tests__/**/*.js?(x)" ], | ||
"extends": ["plugin:testing-library/react"] | ||
} | ||
], | ||
|
||
"extends": [ | ||
"@edsc" | ||
], | ||
|
||
// Define version settings | ||
"settings": { | ||
"react": { | ||
"pragma": "React", | ||
"version": "detect" | ||
}, | ||
"import/resolver": { | ||
"alias": { | ||
"map": [ | ||
[ "@", "./static/src" ] | ||
], | ||
"extensions": [ | ||
".js", | ||
".jsx", | ||
".json" | ||
] | ||
} | ||
} | ||
}, | ||
|
||
"parserOptions": { | ||
"requireConfigFile": false, | ||
"babelOptions": { | ||
"presets": [ | ||
"@babel/preset-react" | ||
] | ||
} | ||
}, | ||
|
||
// Define any global variables to avoid no-undef errors | ||
"globals": { | ||
"vi": "readonly" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Project build files | ||
.dockerignore | ||
.DS_Store | ||
.serverless | ||
.esbuild | ||
.vite | ||
coverage | ||
dist | ||
doc | ||
Dockerfile | ||
node_modules | ||
secret.config.json | ||
tmp | ||
.env | ||
|
||
# VSCode Settings | ||
.vscode | ||
|
||
# CI Outputs | ||
junit.xml | ||
|
||
cmr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/hydrogen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs/**/*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"customSyntax": "postcss-scss", | ||
"extends": [ | ||
"stylelint-config-standard", | ||
"stylelint-config-idiomatic-order" | ||
], | ||
"plugins": [ | ||
"stylelint-scss" | ||
], | ||
"rules": { | ||
"at-rule-no-unknown": null, | ||
"import-notation": "string", | ||
"keyframes-name-pattern": "[a-zA-Z]", | ||
"no-invalid-position-at-import-rule": null, | ||
"property-no-unknown": [ | ||
true, | ||
{ | ||
"ignoreProperties": ["composes", "compose-with"] | ||
} | ||
], | ||
"scss/at-rule-no-unknown": true, | ||
"selector-class-pattern": "[a-zA-Z]", | ||
"selector-pseudo-class-no-unknown": [ | ||
true, | ||
{ | ||
"ignorePseudoClasses": ["global"] | ||
} | ||
], | ||
"value-keyword-case": [ | ||
"lower", | ||
{ | ||
"ignoreKeywords": ["/[a-zA-Z]/"] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,41 @@ | ||
Simple README for deploying KMS | ||
# KMS 2.0 | ||
|
||
Keyword Management System (KMS) is a application for maintaining keywords (science keywords, platforms, instruments, data centers, locations, projects, services, resolution, etc.) in the earthdata/IDN system. | ||
|
||
## Links | ||
|
||
## Getting Started | ||
|
||
### Requirements | ||
|
||
- [Node](https://nodejs.org/) (check .nvmrc for correct version) | ||
- [nvm](https://github.com/nvm-sh/nvm) is highly recommended | ||
|
||
### Setup | ||
|
||
To install the necessary components, run: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
### Usage | ||
|
||
In order to run KMS locally, you first need to setup a RDF database. | ||
|
||
#### Running Serverless Offline (API Gateway/Lambdas) | ||
|
||
In order to run serverless-offline, which is used for mimicking API Gateway to call lambda functions, run: | ||
|
||
```bash | ||
npm run offline | ||
``` | ||
|
||
## Local Testing | ||
|
||
To run the test suite, run: | ||
|
||
```bash | ||
npm run test | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
# Bail on unset variables, errors and trace execution | ||
set -eux | ||
|
||
# Set up Docker image | ||
##################### | ||
|
||
cat <<EOF > .dockerignore | ||
node_modules | ||
.DS_Store | ||
.git | ||
.github | ||
.serverless | ||
cmr | ||
coverage | ||
dist | ||
node_modules | ||
tmp | ||
EOF | ||
|
||
cat <<EOF > Dockerfile | ||
FROM node:18-bullseye | ||
COPY . /build | ||
WORKDIR /build | ||
RUN npm ci --omit=dev && npm run build | ||
EOF | ||
export bamboo_STAGE_NAME=sit | ||
dockerTag=kms-$bamboo_STAGE_NAME | ||
docker build -t $dockerTag . | ||
|
||
# Convenience function to invoke `docker run` with appropriate env vars instead of baking them into image | ||
dockerRun() { | ||
docker run \ | ||
--env "AWS_ACCESS_KEY_ID=$bamboo_AWS_ACCESS_KEY_ID" \ | ||
--env "AWS_SECRET_ACCESS_KEY=$bamboo_AWS_SECRET_ACCESS_KEY" \ | ||
--env "AWS_SESSION_TOKEN=$bamboo_AWS_SESSION_TOKEN" \ | ||
--env "LAMBDA_TIMEOUT=$bamboo_LAMBDA_TIMEOUT" \ | ||
--env "NODE_ENV=sit" \ | ||
--env "NODE_OPTIONS=--max_old_space_size=4096" \ | ||
--env "SUBNET_ID_A=$bamboo_SUBNET_ID_A" \ | ||
--env "SUBNET_ID_B=$bamboo_SUBNET_ID_B" \ | ||
--env "SUBNET_ID_C=$bamboo_SUBNET_ID_C" \ | ||
--env "VPC_ID=$bamboo_VPC_ID" \ | ||
$dockerTag "$@" | ||
} | ||
|
||
# Execute serverless commands in Docker | ||
####################################### | ||
|
||
stageOpts="--stage $bamboo_STAGE_NAME" | ||
|
||
# Deploy AWS Infrastructure Resources | ||
echo 'Deploying AWS Infrastructure Resources...' | ||
dockerRun npx serverless deploy $stageOpts --config serverless-infrastructure.yml | ||
|
||
# Deploy AWS Application Resources | ||
echo 'Deploying AWS Application Resources...' | ||
dockerRun npx serverless deploy $stageOpts |
Oops, something went wrong.