-
Notifications
You must be signed in to change notification settings - Fork 15
Migrate from the localstack CLI to lstk #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,13 @@ | ||
| name: Create PR Preview | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| workflow_dispatch: | ||
| # Disabled: `lstk aws`/`lstk cdk` (used via the Makefile targets that preview-cmd | ||
| # below calls) always target their own locally-managed emulator and ignore | ||
| # AWS_ENDPOINT_URL, so they can't reach the remote ephemeral instance this | ||
| # workflow provisions. Re-enable once that's resolved. | ||
| # pull_request: | ||
| # types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| preview: | ||
|
|
@@ -22,18 +27,20 @@ jobs: | |
| state-backend: ephemeral | ||
| state-action: start | ||
| include-preview: 'true' | ||
| # TODO(lstk): no install-lstk equivalent in the setup-localstack action yet — | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the intention of this TODO? |
||
| # lstk is installed via npm inside preview-cmd instead. | ||
| install-awslocal: 'true' | ||
| # Multi line commands are folding for some reason, so we enforce new lines | ||
| # For more predictable usage, use script files | ||
| preview-cmd: | | ||
| npm install -g aws-cdk-local aws-cdk; | ||
| npm install -g @localstack/lstk aws-cdk; | ||
| make build; | ||
| make bootstrap; | ||
| make deploy; | ||
| make prepare-frontend-local; | ||
| make build-frontend; | ||
| make bootstrap-frontend; | ||
| make deploy-frontend; | ||
| distributionId=$(awslocal cloudfront list-distributions | jq -r '.DistributionList.Items[0].Id'); | ||
| distributionId=$(lstk aws cloudfront list-distributions | jq -r '.DistributionList.Items[0].Id'); | ||
| echo LS_PREVIEW_URL=$AWS_ENDPOINT_URL/cloudfront/$distributionId/ >> $GITHUB_ENV; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,20 +32,20 @@ We are using the following AWS services and their features to build our infrastr | |
|
|
||
| ## Prerequisites | ||
|
|
||
| - 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. | ||
| - [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli). | ||
| - [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). | ||
| - [CDK](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) with the [`cdklocal`](https://www.npmjs.com/package/aws-cdk-local) wrapper. | ||
| - A valid [LocalStack for AWS license](https://localstack.cloud/pricing). Your license provides a [`LOCALSTACK_AUTH_TOKEN`](https://docs.localstack.cloud/aws/getting-started/auth-token/) to activate LocalStack. | ||
| - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/), installed via `npm install -g @localstack/lstk` or `brew install localstack/tap/lstk`. | ||
| - [AWS CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/), required by `lstk aws`. | ||
| - [CDK](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/), used via the `lstk cdk` proxy. | ||
| - [Node.js](https://nodejs.org/en/download/) with `yarn` package manager. | ||
|
|
||
| Start LocalStack for AWS with the `LOCALSTACK_AUTH_TOKEN` pre-configured: | ||
|
|
||
| ```shell | ||
| export LOCALSTACK_AUTH_TOKEN=<your-auth-token> | ||
| EXTRA_CORS_ALLOWED_ORIGINS=* localstack start | ||
| EXTRA_CORS_ALLOWED_ORIGINS=* lstk start | ||
| ``` | ||
|
|
||
| The `EXTRA_CORS_ALLOWED_ORIGINS` configuration variable allows our website to send requests to the HTTP APIs exposed via the API Gateway. 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. | ||
| The `EXTRA_CORS_ALLOWED_ORIGINS` configuration variable allows our website to send requests to the HTTP APIs exposed via the API Gateway. If you prefer running LocalStack in detached mode, you can add the `--non-interactive` flag to the `lstk start` command, and use Docker Desktop to view the logs. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not correct, since |
||
|
|
||
| ## Instructions | ||
|
|
||
|
|
@@ -170,6 +170,8 @@ Users can adapt this example workflow to run in their own CI environment. LocalS | |
|
|
||
| This sample further shows off our preview environments feature. Preview environments allow you to deploy your application to a separate environment whenever you want with the right configuration. You can find the workflow in the `.github/workflows/preview.yml` file. You can find more information about preview environments in the [LocalStack documentation](https://docs.localstack.cloud/user-guide/cloud-sandbox/application-previews/). | ||
|
|
||
| > This workflow provisions a remote Ephemeral Instance via the `LocalStack/setup-localstack` action, which `lstk` does not support yet. Its automatic `pull_request` trigger has been disabled; it can still be run manually via `workflow_dispatch`. | ||
|
|
||
| ## Learn more | ||
|
|
||
| The sample application is based on a public [AWS sample app](https://github.com/aws-samples/ecs-apigateway-sample) and a [SST tutorial](https://github.com/serverless-stack/demo-notes-app). | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already resolved, although the
lstkdocs haven't been updated to reflect thatAWS_ENDPOINT_URLis now recognized.