Skip to content

Commit 7a5aa57

Browse files
authored
Add LocalStack auth token requirement and standardize setup (#8)
- Add license requirement bullet to Prerequisites - Add auth guard to start target in Makefile - Add Start LocalStack section to README - Upgrade actions/checkout and setup-node to v4 - Add LOCALSTACK_AUTH_TOKEN to main.yml workflow - Replace LOCALSTACK_API_KEY with LOCALSTACK_AUTH_TOKEN in pods.yml
1 parent d4669a6 commit 7a5aa57

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424

2525
- name: Setup Node.js
26-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
2727
with:
2828
node-version: 20
2929

@@ -38,6 +38,7 @@ jobs:
3838
3939
- name: Start LocalStack
4040
env:
41+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
4142
DNS_ADDRESS: 0
4243
run: |
4344
pip install localstack awscli-local[ver1]

.github/workflows/pods.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
image-tag: 'latest'
2828
use-pro: 'true'
2929
env:
30-
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
30+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
3131

3232
- name: Load the Cloud Pod
3333
uses: LocalStack/setup-localstack/cloud-pods@main
3434
with:
3535
name: loan-broker-infra
3636
action: load
3737
env:
38-
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
38+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
3939

4040
- name: Run integration tests
4141
run: |

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ deploy:
2020

2121
## Start LocalStack in detached mode
2222
start:
23-
localstack start -d
23+
@test -n "${LOCALSTACK_AUTH_TOKEN}" || (echo "LOCALSTACK_AUTH_TOKEN is not set. Find your token at https://app.localstack.cloud/workspace/auth-token"; exit 1)
24+
@LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d
2425

2526
## Stop the Running LocalStack container
2627
stop:

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,20 @@ The following diagram shows the architecture that this sample application builds
3434

3535
## Prerequisites
3636

37-
- LocalStack Pro with the [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli).
37+
- A valid [LocalStack for AWS license](https://localstack.cloud/pricing). Your license provides a [`LOCALSTACK_AUTH_TOKEN`](https://docs.localstack.cloud/getting-started/auth-token/) to activate LocalStack.
38+
- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli).
3839
- [Cloud Development Kit](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) with the [`cdklocal`](https://www.npmjs.com/package/aws-cdk-local) installed.
3940
- [AWS CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) with the [`awslocal` wrapper](https://docs.localstack.cloud/user-guide/integrations/aws-cli/#localstack-aws-cli-awslocal).
4041
- [Node.js](https://nodejs.org/en/download), and [`yarn`](https://yarnpkg.com/).
4142

42-
Start LocalStack Community edition:
43+
## Start LocalStack
44+
45+
Start LocalStack with the `LOCALSTACK_AUTH_TOKEN` pre-configured:
4346

4447
```shell
45-
DEBUG=1 localstack start
48+
export LOCALSTACK_AUTH_TOKEN=<your-auth-token>
49+
make start
50+
make ready
4651
```
4752

4853
We specified DEBUG=1 to get the printed LocalStack logs directly in the terminal to help us see the event-driven architecture in action. If you prefer running LocalStack in detached mode, you can add the `-d` flag to the `localstack start` command, and use Docker Desktop to view the logs.

0 commit comments

Comments
 (0)