diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 187d1ff4..a755389f 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -21,7 +21,7 @@ jobs: contents: read runs-on: ubuntu-latest needs: tests - if: github.ref == 'refs/heads/qa-node20-es-tuning' + if: github.ref == 'refs/heads/qa' steps: - name: Checkout repo uses: actions/checkout@v3 @@ -50,13 +50,48 @@ jobs: - name: Force ECS Update run: | aws ecs update-service --cluster discovery-api-qa --service discovery-api-qa --force-new-deployment + deploy-qa2: + permissions: + id-token: write + contents: read + runs-on: ubuntu-latest + needs: tests + if: github.ref == 'refs/heads/qa2' + 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: Log in to 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-api + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:qa2-latest + docker push $ECR_REGISTRY/$ECR_REPOSITORY:qa2-latest + + - name: Force ECS Update + run: | + aws ecs update-service --cluster discovery-api-qa2 --service discovery-api-qa2 --force-new-deployment deploy-production: permissions: id-token: write contents: read runs-on: ubuntu-latest needs: tests - if: github.ref == 'refs/heads/production-node20' + if: github.ref == 'refs/heads/production' steps: - name: Checkout repo uses: actions/checkout@v3 diff --git a/README.md b/README.md index 934f1593..48bc2217 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,13 @@ This app uses a [PRs Target Main, Merge to Deployment Branches](https://github.c 1. Confirm app deploys to QA and run appropriate testing 1. Merge `main` > `production` +### Deploying + +App deploys through [GH Actions](./.github/workflows/test-and-deploy.yml) to ECS when updates are made to deployment branches: + - `qa`: discovery-api-qa.nypl.org + - `qa2`: discovery-api-qa2.nypl.org + - `production`: discovery-api-production.nypl.org + ## Testing Run all tests: diff --git a/config/production.env b/config/production.env index cd60ad74..42aee789 100644 --- a/config/production.env +++ b/config/production.env @@ -11,7 +11,7 @@ NYPL_OAUTH_URL=https://isso.nypl.org/ ENCRYPTED_NYPL_OAUTH_ID=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMLKVUQA58B6vprNcAIBEIAoaz0lI9EL2M9NyTuEwT8JDmPBt6aXfMiFs027DEuwsCN0wS0qWeFL1g== ENCRYPTED_NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyWz91LOP2YP5fg0q0CARCAQ9inO9SV1M8R0Pkkx84r7UdwlU1FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI= -NYPL_CORE_VERSION=v2.19 +NYPL_CORE_VERSION=v2.20 LOG_LEVEL=info FEATURES=on-site-edd diff --git a/config/qa.env b/config/qa.env index 31a9edc7..06eb7d13 100644 --- a/config/qa.env +++ b/config/qa.env @@ -14,7 +14,7 @@ NYPL_OAUTH_URL=https://isso.nypl.org/ ENCRYPTED_NYPL_OAUTH_ID=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMLKVUQA58B6vprNcAIBEIAoaz0lI9EL2M9NyTuEwT8JDmPBt6aXfMiFs027DEuwsCN0wS0qWeFL1g== ENCRYPTED_NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyWz91LOP2YP5fg0q0CARCAQ9inO9SV1M8R0Pkkx84r7UdwlU1FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI= -NYPL_CORE_VERSION=v2.19 +NYPL_CORE_VERSION=v2.20 LOG_LEVEL=debug FEATURES=on-site-edd diff --git a/test/fixtures/query-6ba55bf03f545e4ed0d50a48c55c94b9.json b/test/fixtures/query-6ba55bf03f545e4ed0d50a48c55c94b9.json new file mode 100644 index 00000000..11d3decf --- /dev/null +++ b/test/fixtures/query-6ba55bf03f545e4ed0d50a48c55c94b9.json @@ -0,0 +1,17 @@ +{ + "body": { + "took": 21, + "timed_out": false, + "_shards": { + "total": 3, + "successful": 3, + "failed": 0 + }, + "hits": { + "total": 0, + "max_score": null, + "hits": [] + } + }, + "statusCode": 200 +} \ No newline at end of file