Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ jobs:
make install
make test

- name: Set up Terraform
uses: hashicorp/setup-terraform@v3

- name: Run Lambda integration tests
run: |
pip install terraform-local
make tf-deploy
make test-lambda

- name: Print logs
if: always()
run: |
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ tf-deploy: ## Deploy the app locally via Terraform
mkdir -p build/lambda
cp -r app/lambda/* build/lambda/

docker run -it --platform=linux/amd64 --rm --entrypoint= -v $(PWD)/build/lambda:/tmp/lambda public.ecr.aws/lambda/python:3.11 pip install --upgrade --target /tmp/lambda -r /tmp/lambda/requirements.txt
docker run --platform=linux/amd64 --rm --entrypoint= -v $(PWD)/build/lambda:/tmp/lambda public.ecr.aws/lambda/python:3.11 pip install --upgrade --target /tmp/lambda -r /tmp/lambda/requirements.txt

##### NOTE: SOMETIMES THE ARM64 VERSION WORKS, SOMETIMES THE AMD64 VERSION WORKS? #####
#docker run -it --platform=linux/arm64/v8 --rm --entrypoint= -v $(PWD)/build/lambda:/tmp/lambda public.ecr.aws/lambda/python:3.11 pip install --upgrade --target /tmp/lambda -r /tmp/lambda/requirements.txt
#docker run --platform=linux/arm64/v8 --rm --entrypoint= -v $(PWD)/build/lambda:/tmp/lambda public.ecr.aws/lambda/python:3.11 pip install --upgrade --target /tmp/lambda -r /tmp/lambda/requirements.txt

$(VENV_RUN); tflocal init; tflocal apply -auto-approve

Expand All @@ -34,6 +34,10 @@ test-lambda: ## Run Lambda API tests
test-extension: ## Run integration tests (requires LocalStack running with the Extension installed)
$(VENV_RUN); pytest tests/test_extension.py -v -s

web-ui: ## Run the Web UI on localhost port 3000
which serve || npm i -g serve
serve ./app/web

format: ## Run ruff to format the whole codebase
$(VENV_RUN); python -m ruff format .; python -m ruff check --output-format=full --fix .

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Sample app that demonstrates how to use TypeDB + LocalStack, to develop and test
* LocalStack Pro (free trial available [here](https://app.localstack.cloud))
* `localstack` CLI
* `terraform` CLI
* `node`/`npm` (for Web UI)

## Enable the TypeDB Extension

Expand All @@ -16,7 +17,7 @@ To enable the TypeDB extension in LocalStack, use this command:
$ localstack extensions install "git+https://github.com/whummer/localstack-utils.git#egg=localstack-typedb&subdirectory=localstack-typedb"
```

## Start localstack
## Start LocalStack

```
$ DOCKER_FLAGS='-e TYPEDB_FLAGS=--development-mode.enabled=true' localstack start
Expand All @@ -41,6 +42,13 @@ Once the app is deployed, we can run some HTTP requests against the local API Ga
$ make requests
```

## Run the Web UI

The project ships with a simple Web application, which can be spun up on `http://localhost:3000` via this command:
```
$ make web-ui
```

## License

The code in this repo is available under the Apache 2.0 license.
Expand Down
Loading