From b916b7dc1f9913c56506511ea8e9c25633c0199f Mon Sep 17 00:00:00 2001 From: CHIKAMATSU Naohiro Date: Mon, 8 Jan 2024 15:55:16 +0900 Subject: [PATCH 1/4] Introduce localstack pro into GitHub Actions(CI) --- .github/workflows/linux_test.yml | 3 +++ .gitignore | 1 + compose.yml | 5 ++++- doc/common/developers.md | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_test.yml b/.github/workflows/linux_test.yml index 2dcc0b3..ead6585 100644 --- a/.github/workflows/linux_test.yml +++ b/.github/workflows/linux_test.yml @@ -25,6 +25,9 @@ jobs: go-version: "1" check-latest: true + - name: Setup localstack + run: docker compose up + - name: Download dependencies run: go mod download diff --git a/.gitignore b/.gitignore index 3f3c45d..779ea08 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ data localstack /s3hub /spare +.envrc diff --git a/compose.yml b/compose.yml index 2351958..b39efc6 100644 --- a/compose.yml +++ b/compose.yml @@ -1,13 +1,16 @@ services: localstack: container_name: "rainbow-localstack" - image: localstack/localstack:latest + image: localstack/localstack-pro:latest ports: - "127.0.0.1:4566:4566" # LocalStack Gateway - "127.0.0.1:4510-4559:4510-4559" # external services port range environment: + - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN- } - DEBUG=${DEBUG-} - DOCKER_HOST=unix:///var/run/docker.sock + - DNS_LOCAL_NAME_PATTERNS='.*cloudfront\.net' + - CLOUDFRONT_STATIC_PORTS= 1 volumes: - "${LOCALSTACK_VOLUME_DIR:-./localstack}:/var/lib/localstack" - "/var/run/docker.sock:/var/run/docker.sock" diff --git a/doc/common/developers.md b/doc/common/developers.md index e32d948..87bda27 100644 --- a/doc/common/developers.md +++ b/doc/common/developers.md @@ -42,6 +42,12 @@ aws_secret_access_key=test > [!NOTE] > Alternatively, you can also set the AWS_PROFILE=localstack environment variable, in which case the --profile localstack parameter can be omitted in the commands above. +### localstack subscriptions +Please access the official website of [localstack](https://www.localstack.cloud/) and obtain a Hobby Subscription. Then, you can get the authentication token from the localstack dashboard. Finally, set the LOCALSTACK_AUTH_TOKEN environment variable. You must not upload the LOCALSTACK_AUTH_TOKEN to the remote repository. +```shell +export LOCALSTACK_AUTH_TOKEN=YOUR_AUTH_TOKEN +``` + ### Run localstack Run the following command to start localstack: ```shell From c0cfe29d6a4229b802739683724ef2f351a07e1c Mon Sep 17 00:00:00 2001 From: CHIKAMATSU Naohiro Date: Mon, 8 Jan 2024 16:11:37 +0900 Subject: [PATCH 2/4] Add secret --- .github/workflows/linux_test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_test.yml b/.github/workflows/linux_test.yml index ead6585..0e8ce0f 100644 --- a/.github/workflows/linux_test.yml +++ b/.github/workflows/linux_test.yml @@ -26,7 +26,11 @@ jobs: check-latest: true - name: Setup localstack - run: docker compose up + env: + LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + run: | + docker compose up - name: Download dependencies run: go mod download From cd1dd2ded61b4abc56fa4e528c3276a0c004bb11 Mon Sep 17 00:00:00 2001 From: CHIKAMATSU Naohiro Date: Mon, 8 Jan 2024 16:27:21 +0900 Subject: [PATCH 3/4] Remove deprecated variable --- compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yml b/compose.yml index b39efc6..40286d1 100644 --- a/compose.yml +++ b/compose.yml @@ -9,7 +9,7 @@ services: - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN- } - DEBUG=${DEBUG-} - DOCKER_HOST=unix:///var/run/docker.sock - - DNS_LOCAL_NAME_PATTERNS='.*cloudfront\.net' + - DNS_NAME_PATTERNS_TO_RESOLVE_UPSTREAM='.*cloudfront\.net' - CLOUDFRONT_STATIC_PORTS= 1 volumes: - "${LOCALSTACK_VOLUME_DIR:-./localstack}:/var/lib/localstack" From 0cf3a2158cd03d14ac8f9e06fe53353c4881d5bd Mon Sep 17 00:00:00 2001 From: CHIKAMATSU Naohiro Date: Mon, 8 Jan 2024 16:35:07 +0900 Subject: [PATCH 4/4] add waiting process --- .github/workflows/linux_test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_test.yml b/.github/workflows/linux_test.yml index 0e8ce0f..b97d8db 100644 --- a/.github/workflows/linux_test.yml +++ b/.github/workflows/linux_test.yml @@ -29,8 +29,12 @@ jobs: env: LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + # https://docs.localstack.cloud/user-guide/ci/github-actions/ run: | - docker compose up + docker compose up -d + echo "Waiting for LocalStack startup..." + sleep 30 + echo "Startup complete" - name: Download dependencies run: go mod download