Skip to content

hello-nrfcloud/map-backend

hello.nrfcloud.com/map backend

GitHub Actions semantic-release Renovate @commitlint/config-conventional code style: prettier ESLint: TypeScript

Cloud backend for hello.nrfcloud.com/map developed using AWS CDK in TypeScript.

Installation in your AWS account

Setup

Provide your AWS credentials.

Install the dependencies:

npm ci

nRF Cloud Location Services Service Key

The single-cell geo-location features uses the nRF Cloud Ground Fix API which requires the service to be enabled in the account's plan. Manage the account at https://nrfcloud.com/#/manage-plan.

Provide your nRF Cloud API key:

./cli.sh configure-nrfcloud-account apiKey <API key>

Build the docker images

Some of the feature are run from docker containers, ensure they have been built and published before deploying the solutions.

export OPENSSL_LAMBDA_CONTAINER_TAG=$(./cli.sh build-container openssl-lambda)

# You can add these outputs to your .env file
echo OPENSSL_LAMBDA_CONTAINER_TAG=$OPENSSL_LAMBDA_CONTAINER_TAG

Deploy

npx cdk bootstrap # if this is the first time you use CDK in this account
npx cdk deploy

Custom domain name

You can specify a custom domain name for the deployed API using the environment variable API_DOMAIN_NAME.

If you do so, make sure to create a certificate in the region for this domain name.

After deploying the stack, make sure to set up a CNAME record for this domain that points to the hostname of the deployed API (available in the stack output gatewayDomainName).

Continuous Deployment using GitHub Actions

After deploying the stack manually once,

  • configure a GitHub Actions environment named production
  • create the secret AWS_ROLE with the value arn:aws:iam::<account ID>:role/<stack name>-cd and a variable (use the cdRoleArn stack output)
  • create the variable AWS_REGION with the value <region> (your region)
  • create the variable STACK_NAME with the value <stack name> (your stack name)

to enable continuous deployment.