-
Notifications
You must be signed in to change notification settings - Fork 0
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 #26 from NYPL-discovery/tgr-main
Tgr main
- Loading branch information
Showing
24 changed files
with
10,543 additions
and
5,392 deletions.
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,57 @@ | ||
name: Test and deploy | ||
on: push | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
- name: npm install | ||
run: npm ci | ||
- name: Unit Tests | ||
run: npm test | ||
deploy-qa: | ||
permissions: | ||
id-token: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: github.ref == 'refs/heads/qa' | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1-node16 | ||
with: | ||
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole | ||
aws-region: us-east-1 | ||
- uses: actions/checkout@v3 | ||
- uses: hashicorp/setup-terraform@v2 | ||
- name: npm install | ||
run: npm ci | ||
- name: Deploy app to QA | ||
run: | | ||
terraform -chdir=provisioning/qa init -input=false | ||
terraform -chdir=provisioning/qa apply -auto-approve -input=false | ||
deploy-production: | ||
permissions: | ||
id-token: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: github.ref == 'refs/heads/production' | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1-node16 | ||
with: | ||
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole | ||
aws-region: us-east-1 | ||
- uses: actions/checkout@v3 | ||
- uses: hashicorp/setup-terraform@v2 | ||
- name: npm install | ||
run: npm ci | ||
- name: Deploy app to Production | ||
run: | | ||
terraform -chdir=provisioning/production init -input=false | ||
terraform -chdir=provisioning/production apply -auto-approve -input=false |
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
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 @@ | ||
20 |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -38,42 +38,38 @@ To run against environment dependencies: | |
|
||
Because of the dependencies in this app, we need to run our deployments from EC2. Always run deployments from an EC2 instance on the sandbox account. | ||
|
||
To find the ec2 address, log in to the AWS console, and go to EC2 instances. Look for a recent instance that has a public IP you can access with the dgdvteam.pem (ask a coworker). You will likely want to use the instance's private IP to connect. | ||
To find the ec2 address, log in to the AWS console, and go to EC2 instances. Look for a recent instance that has a public IP you can access with the dgdvteam.pem (ask a coworker). You will likely want to use the instance's private IP to connect. | ||
|
||
`ssh -i path/to/dgdvteam.pem [email protected]` | ||
`ssh -i path/to/dgdvteam.pem [email protected]` | ||
|
||
Then change to the directory that you will be running the deployment scripts from. | ||
Then change to the directory that you will be running the deployment scripts from. | ||
|
||
`cd /home/ec2-user/temp` | ||
|
||
If this directory doesn't exist, you're in for more fun. Create the temp directory, then cd into it and clone this repo. | ||
If this directory doesn't exist, you're in for more fun. Create the temp directory, then cd into it and clone this repo. | ||
|
||
It is possible you may also need to install git. If you do, this should work: | ||
It is possible you may also need to install git. If you do, this should work: | ||
|
||
`sudo yum install git` | ||
|
||
After cloning the repo, you should finally be able to | ||
After cloning the repo, you should finally be able to | ||
|
||
`cd scsb-ongoing-accessions` | ||
|
||
Once cloned, you will need to setup the following: | ||
Once cloned, you will need to setup the following: | ||
|
||
* AWS credentials at ~/.aws/credentials (needs two profiles for qa and production deployment, named 'nypl-sandbox' and 'nypl-digital-dev' respectively -- best to get this from a coworker, too. (if you need to upload them from local to aws, use `scp -i path/to-dgdvteam.pem credentials [email protected]:~/.` then `mv credentials .aws/credentials`) | ||
* nvm via `curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash` ... then reconnect. | ||
* nvm via `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash` ... then reconnect. | ||
* node 6.10.3 via `nvm install 6.10.3` , then `nvm use 6.10.3` | ||
* copy your appropriate config/environment.env file to the server a la your credentails file. .env files are currently not in source control so need to be manually put in place, as well. | ||
|
||
It's also possible you may need to install make. Or gcc. Or a bunch of other things. If you do, maybe these will work. | ||
It's also possible you may need to install make. Or gcc. Or a bunch of other things. If you do, maybe these will work. | ||
|
||
`yum install make glibc-devel gcc patch` | ||
`yum install gcc-c++` | ||
|
||
Once that's all in place, `npm install`. If it works, you should be good to go with deployment. | ||
|
||
### Important Notes About convert-2-scsb-module | ||
|
||
When there are updates to the convert-2-scsb-module, the module will need to be updated by hand. You may need to specify the exact commit / tag from github in order to update it. | ||
|
||
### Running Deploy Scripts | ||
|
||
Two deploy scripts are registered in `package.json`: | ||
|
@@ -89,8 +85,6 @@ The test suite uses [lambda-tester](https://www.npmjs.com/package/lambda-tester) | |
|
||
`npm test` | ||
|
||
Note that `event.json` contains a sample API Gateway event that can, in theory, be used with `node-lambda` to emulate a lambda invocation locally, but that won't work until `node-lambda` supports `--profile` due to a quirk in aws global credential management. In practice, running the app as a persistent express server via `npm run run-[environment]` feels more natural for local ad hoc testing anyway. | ||
|
||
### Test Fixtures | ||
|
||
A series of local test fixtures representing responses from the nypl data api, maintained in `./test/data/*.json`. These allow the test suite to run against a fixed set of data. If any fixtures need to be updated or added, a script is provided: | ||
|
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,4 +1,3 @@ | ||
|
||
const app = require('./app') | ||
const port = 3000 | ||
|
||
|
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
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
Oops, something went wrong.