From 03aeb54c6191cbba6ce0b1009f6a43c7570ef8f6 Mon Sep 17 00:00:00 2001 From: Rakib Ansary Date: Fri, 5 Apr 2024 03:28:59 +0600 Subject: [PATCH 1/3] fix: always use strong consistency for read operations Signed-off-by: Rakib Ansary --- src/helpers/QueryHelper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/helpers/QueryHelper.ts b/src/helpers/QueryHelper.ts index d3af3ad..33ef175 100644 --- a/src/helpers/QueryHelper.ts +++ b/src/helpers/QueryHelper.ts @@ -39,6 +39,7 @@ class QueryHelper { return { Statement: statement, Parameters: parameters, + ConsistentRead: true, }; } From 117d44ee1a9f04383980bb20429d31e871589a47 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 18 Apr 2024 10:10:23 +1000 Subject: [PATCH 2/3] Back out always using strong consistency. This breaks a lookup when using the Challenge table in DynamoDB and the legacyId-index, which is a Global Secondary Index, not supported by strong consistency --- src/helpers/QueryHelper.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helpers/QueryHelper.ts b/src/helpers/QueryHelper.ts index 33ef175..d3af3ad 100644 --- a/src/helpers/QueryHelper.ts +++ b/src/helpers/QueryHelper.ts @@ -39,7 +39,6 @@ class QueryHelper { return { Statement: statement, Parameters: parameters, - ConsistentRead: true, }; } From 6b8ef33683c42680a0e60b986d0001c61f112ebe Mon Sep 17 00:00:00 2001 From: Rakib Ansary Date: Tue, 30 Apr 2024 14:09:08 +0600 Subject: [PATCH 3/3] chore: add usage & local setup guide Signed-off-by: Rakib Ansary --- README.md | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 12f4396..4713ac8 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,47 @@ This is a simple gRPC service that implements the [NoSQL](https://github.com/topcoder-platform/plat-interface-definition/blob/main/data-access-layer/nosql/parti_ql.proto) interface to provide access to DynamoDB. It uses the [PartiQL query language](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.html) to access the data. -# Roadmap +# Local Setup -- Add support for transactions -- Add support for batch operations -- Add authentication -- Add a cache layer +## Dependencies -# Note +1. NodeJS 18+ +2. Yarn 1.22+ +3. Typescript 5+ +4. dynamo-access-layer +5. anticorruption-layer -This is in the early stages of development and while it is functional and the interfaces are fully defined, it is not yet ready for production use. +## Required Environment Variables + +The following environment variables are required. Placing a .env file in the root of the project will automatically load these variables. + +```env +GRPC_SERVER_HOST="localhost" +GRPC_SERVER_PORT=50052 + +ENV=local +``` + +## Local Development + +1. Install dependencies. `dynamo-access-layer` uses topcoder-framework which is published in AWS CodeArtifact. To ensure all dependencies are correctly downloaded log into aws codeartifact first + +```bash +aws codeartifact login --tool npm --repository topcoder-framework --domain topcoder --domain-owner 409275337247 --region us-east-1 --namespace @topcoder-framework +yarn i +``` + +_Note: A valid AWS session is required for the above command to work. Ensure that you have the correct aws environment variables set_ + + +2. Start the gRPC server + +```bash +yarn start +``` + +## Deployment instructions + +The primary branch of this repo is the `main` branch. Opening a pull request to the main branch will kick off building a docker image. Check [CircleCI](https://app.circleci.com/pipelines/github/topcoder-platform/domain-challenge/717/workflows/76185a2f-9a99-4006-9fb4-71568a30fe57/jobs/744), specifically the Publish docker iamge to get the image tag. Use the tag for deploying to dev environment - see the branch deploy/dev of [domain-challenge](https://github.com/topcoder-platform/domain-challenge), buildimage.sh. + +After the PR is merged, follow the same steps. For production deploys use `deploy/prod` branch