Cloud backend for hello.nrfcloud.com
developed using AWS CDK in
TypeScript.
npm ci
The CoAP simulator is written in Golang, which needs to be present on the local system.
To setup MQTT bridge, you have to run the below command to generate a certificate used by MQTT broker to connect nRF Cloud under your account. So, you need to prepare nRF Cloud API key.
./cli.sh configure-nrfcloud-account <account> apiKey <API key>
./cli.sh initialize-nrfcloud-account <account>
./cli.sh create-health-check-device <account>
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.
Some of the feature are run from docker containers, ensure they have been built and published before deploying the solutions.
export MQTT_BRIDGE_CONTAINER_TAG=$(./cli.sh build-container mqtt-bridge)
# You can add these outputs to your .env file
echo MQTT_BRIDGE_CONTAINER_TAG=$MQTT_BRIDGE_CONTAINER_TAG
npx cdk bootstrap # if this is the first time you use CDK in this account
npx cdk deploy --all
According to nRF Cloud documentation,
Setting up a message bridge,
all messages under <stage>/<team id>/m/#
are bridged. Since the messages are
forwarded from nRF Cloud, therefore all messages are following the protocol
described
here.
Note Shadow data will NOT be forwarded to MQTT bridge since they are
using topic as $aws/things/${deviceId}/shadow/update
The backend supports the integration with multiple nRF Cloud accounts.
Follow the steps above to set up the MQTT bridge for another account, then trigger a deployment.
npx cdk deploy --all
List the configured accounts:
./cli.sh list-nrfcloud-accounts
After deploying the stack manually once,
- configure a GitHub Actions environment named
production
- create the secret
AWS_ROLE
with the valuearn:aws:iam::<account ID>:role/<stack name>-cd
and a variable (use thecdRoleArn
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.
Message received from MQTT bridge will be published to websocket connection that associates with the same device id.
Messages will be converted using
@hello.nrfcloud.com/proto
.