Continuous deployment

You can automatically deploy all changes that you make to a fork of the nRF Asset Tracker for AWS.

Note

It is optional to keep the deployment in your AWS account automatically synchronized with your fork’s source code repository.

Fork the nRF Asset Tracker repositories

To enable continuous deployment, complete the following steps:

  1. Fork the nRF Asset Tracker for AWS repository.
  2. Update the repository.url in the package.json file in your fork. It must point to the repository URL of your fork.
  3. Fork the Cat Tracker web application repository.
  4. Update the deploy.webApp.repository in the package.json file of your nRF Asset Tracker for AWS fork. It must point to the repository URL of your fork of the Cat Tracker web application.

Provide GitHub credentials

Enabling continuous deployment creates an AWS CodePipeline project. You need to provide it with GitHub credentials to be able to register a webhook in the GitHub repository of your fork to be notified about changes. This is a manual one-time step.

You need to create a developer token with repo and admin:repo_hook permissions for an account that has write permissions to your repository.

Note

It is recommended to use a separate GitHub account instead of your personal GitHub account.

To provide this token to the nRF Asset Tracker for AWS, use the following command:

 node cli configure codebuild github token "Github Token"

Enable continuous deployment

After providing the GitHub credentials, set up the continuous deployment by enabling it before deploying the stack:

node cli configure context stack cd 1
npx cdk deploy '*'

This sets up an AWS CodePipeline, which triggers an AWS CodeBuild project for every push to the saga branch. You can customize the branch by providing the name in deploy.branch in the package.json file of your nRF Asset Tracker for AWS fork.

Another AWS CodePipeline is set up for the web application. It triggers a CodeBuild project for every push to the saga branch. Configure the repository URL and the branch for the web application in the deploy.webApp property of the package.json file of your nRF Asset Tracker for AWS fork.

Trigger a deployment

Commit a change to your fork to trigger a deployment.

Check the status of the continuous deployment

To check the status of the continuous deployment after you have made the changes, use the following CLI command:

node cli cd

The following image shows a sample output generated by the command:

Output of node cli cd

Output of the node cli cd command