Skip to content

Commit

Permalink
Merge branch 'qa' into production
Browse files Browse the repository at this point in the history
* qa: (38 commits)
  pointing qa deploy script to  branch
  Change CD to deploy production from namesake branch
  Add fix to fix use of discovery.nypl.org in redirect_uri
  Fix failing test
  Remove link import
  Replace react link with dslink on hold request page
  simple log
  Not reading from redux store was the issue
  Debugging and setting more env vars
  cleaning up npm scripts and updating branch targets for GHA deployment
  fixing dslink issue
  Updating SHEP links
  Updating SHEP links
  forgot to update qa
  Hard coding rp enabled links for now
  typo
  fixing prod name, pushing to prod
  Testing deploy branch name
  readme git branches update
  Updates based on feedback
  ...
  • Loading branch information
EdwinGuzman committed Nov 7, 2024
2 parents ee01a10 + d9a6360 commit a09c631
Show file tree
Hide file tree
Showing 47 changed files with 12,482 additions and 13,405 deletions.
8 changes: 0 additions & 8 deletions .ebextensions/00_change_npm_permissions.config

This file was deleted.

15 changes: 0 additions & 15 deletions .ebextensions/00_nypl_provisioning.config

This file was deleted.

6 changes: 0 additions & 6 deletions .ebextensions/01_loadbalancer-terminatehttps.config

This file was deleted.

14 changes: 0 additions & 14 deletions .ebextensions/02_cloudwatch_agent_config.config

This file was deleted.

5 changes: 0 additions & 5 deletions .ebextensions/03_enable_log_streaming.config

This file was deleted.

3 changes: 0 additions & 3 deletions .ebextensions/enhanced-health.config

This file was deleted.

5 changes: 0 additions & 5 deletions .ebextensions/node-settings.config

This file was deleted.

6 changes: 5 additions & 1 deletion .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ BASE_URL=/research/research-catalog
REDIRECT_FROM_BASE_URL=/research/collections/shared-collection-catalog
WEBPAC_BASE_URL=https://[fqdn]/
LOGIN_BASE_URL=https://[fqdn]/
LOGIN_URL=https://[fqdn]/
CIRCULATING_CATALOG=https://[fqdn]/
OPEN_LOCATIONS=315,300
SHEP_BIBS_LIMIT=25
TZ=America/New_York
LAUNCH_EMBED_URL=https://[fqdn]/
NYPL_HEADER_URL=https://ds-header.nypl.org
SIERRA_UPGRADE_AUG_2023=true
REVERSE_PROXY_ENABLED=false
REVERSE_PROXY_ENABLED=false
DRB_API_BASE_URL=https://[fqdn]/
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"impliedStrict": true,
"jsx": true
},
"ecmaVersion": 2019,
"sourceType": "module",
"project": "./tsconfig.json"
},
Expand Down
131 changes: 131 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Run tests and deploy to QA and Production on `nypl-digital-dev` account

name: CI

on: push

jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache and install node modules
uses: bahmutov/npm-install@v1
with:
install-command: npm install --ignore-script --force
- name: Test
run: npm run test
publish_qa:
# needs: test
if: github.ref == 'refs/heads/qa'
name: Publish image to ECR and update ECS stack
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: discovery-ui
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:qa-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:qa-latest
- name: Force ECS Update
# Deploy to the qa cluster
run: |
aws ecs update-service --cluster discovery-ui-qa --service discovery-ui-qa --force-new-deployment
publish_train:
# needs: test
if: github.ref == 'refs/heads/train'
name: Publish image to ECR and update ECS stack
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: discovery-ui
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:train-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:train-latest
- name: Force ECS Update
# Deploy to the train cluster
run: |
aws ecs update-service --cluster discovery-ui-edd --service discovery-ui-edd --force-new-deployment
publish_production:
# needs: test
if: github.ref == 'refs/heads/production'
name: Publish image to ECR and update ECS stack
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: discovery-ui
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:production-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:production-latest
- name: Force ECS Update
run: |
aws ecs update-service --cluster discovery-ui-production --service discovery-ui-production --force-new-deployment
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ log/*.log
# Local env:
.env

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

#Files with names of missing fields

# VS code Configuration Files
Expand Down
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.17.0
20
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
## CHANGE LOG

### 1.9.0

Remediation Project Update

### Adds

- Adds `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` as example env vars needed in `.env-sample`. They are required for building Docker images.
- Adds `Dockerfile` and instructions on how to use it locally.
- Adds the following npm packages:
`sass`, `webpack-dev-middleware`

### Updates

- Updates `.nvmrc` to use Node 20.
- Updates the logger file.
- Updates npm scripts to be more conventional with `build` and `dev`.
- Updates how the webpack dev server is implemented.
- Updates how the `react-number-format` package is used in the `FieldsetDate` component.
- Updates implementation of the `focus-trap-react` package.
- Updates node's Buffer implementation for KMS package usage.
- Updates the following npm packages:
`@babel/preset-env`, `@babel/preset-react`, `@babel/preset-register`, `@nypl/nypl-core-objects`, `@nypl/nypl-data-api-client`, `@typescript-eslint/eslint-plugin`, `axios`, `babel-plugin-module-resolver`, `body-parser`, `chai`, `clean-webpack-plugin`, `compression`, `cookie-parser`, `cross-env`, `css-loader`, `doctoc`, `dotenv`, `ejs`, `enzyme-adapter-react-16`, `eslint`, `eslint-config-airbnb`, `eslint-config-prettier`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-prettier`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `express`, `file-loader`, `focus-trap-react`, `jsonwebtoken`, `mini-css-extract-plugin`, `mocha`, `mock-local-storage`, `nock`, `react`, `react-autosuggest`, `react-dom`, `react-number-format`, `react-redux`, `redux`, `redux-thunk`, `prettier`, `sass-loader`, `sinon`, `sinon-chai`, `style-loader`, `supertest`, `typescript`, `webpack`, `webpack-cli`, `winston`, `underscore`, `url-parse`, `validator`

### Removals

- Removes the `.ebextensions` folder since this repos should no longer deploy to ElasticBeanstalk.
- Removes the `.travis.yml` file to not use Travis CI.
- Removes the `Procfile` since this we don't use Heroku.
- Removes the following npm packages:
`@babel/core`, `@babel/polyfill`, `@nypl/dgx-header-component`, `@nypl/dgx-react-footer`, `@typescript-eslint/parser`, `node-sass`, `node-sass-glob-importer`, `react-router-scroll`, `webpack-bundle-analyzer`, `webpack-dev-server`, `webpack-merge`

### 1.8.2

### Updates
Expand Down
Loading

0 comments on commit a09c631

Please sign in to comment.