Skip to content

Commit

Permalink
docs: update deployment instructions
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
coderbyheart committed Apr 12, 2024
1 parent 54be1a6 commit 73a6551
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ jobs:
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: github-action-hello-nrfcloud-backend
aws-region: ${{ vars.AWS_REGION }}

- name: Get credentials for ECR
Expand Down Expand Up @@ -139,7 +138,6 @@ jobs:
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: github-action-hello-nrfcloud-backend
aws-region: ${{ vars.AWS_REGION }}

- run: npx cdk diff
Expand Down
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,46 @@ Provide your AWS credentials, for example using the `.envrc` (see
npm ci
```

### Deploy
#### nRF Cloud Location Services Service Key

The single-cell geo-location features uses the nRF Cloud
[Ground Fix API](https://api.nrfcloud.com/v1#tag/Ground-Fix) 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:

```bash
npx cdk bootstrap # if this is the first time you use CDK in this account
npx cdk deploy --all
./cli.sh configure-nrfcloud-account apiKey <API key>
```

## Continuous Integration
### Build the docker images

To run continuous integration tests, deploy the CI application **in a seperate
account**:
Some of the feature are run from docker containers, ensure they have been built
and published before deploying the solutions.

```bash
npx cdk --app 'npx tsx --no-warnings cdk/ci.ts' deploy
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
```

and provide the Role ARN to GitHub Actions:
### Deploy

```bash
CI_ROLE=`aws cloudformation describe-stacks --stack-name ${STACK_NAME:-hello-nrfcloud-map-backend}-ci | jq -r '.Stacks[0].Outputs[] | select(.OutputKey == "ciRoleArn") | .OutputValue'`
gh secret set AWS_ROLE --env ci --body $CI_ROLE
npx cdk bootstrap # if this is the first time you use CDK in this account
npx cdk deploy
```

## 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)

to enable continuous deployment.

0 comments on commit 73a6551

Please sign in to comment.