Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thorstenhans/spin-kv-azure-cosmosdb
https://github.com/thorstenhans/spin-kv-azure-cosmosdb
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/thorstenhans/spin-kv-azure-cosmosdb
- Owner: ThorstenHans
- Created: 2023-05-26T08:21:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-26T08:21:51.000Z (over 1 year ago)
- Last Synced: 2024-04-14T04:43:57.429Z (7 months ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Use Azure Cosmos DB as key-value store for Fermyon Spin
This repository contains a sample application that demonstrates how to use Azure Cosmos DB as key-value store for Fermyon Spin.
Consider reading the corresponding article at [https://thorsten-hans.com/azure-cosmos-db-as-key-value-store-for-fermyon-spin/](https://thorsten-hans.com/azure-cosmos-db-as-key-value-store-for-fermyon-spin/) for a detailed walk-through.
## Provision the infrastructure
The `infra` folder contains a Terraform project which you can use to provision the required infrastructure in Azure. Once you've cloned the repo and installed Terraform on your machine, you can either use a Service Principal for authentication or re-use existing auth tokens from Azure CLI `az`.
To provision the infrastructure, invoke `terraform apply -auto-approve`
## Configure the Spin App
You must update `/app/rt-config.toml` with the values provided as output from Terraform. To read the sensitive `key` output, use `terraform output -raw key`
## Run the Spin application
You can run the Spin app using the `Makefile` located in the root of this repository. Simply invoke `make run`
## Testing
You can use `curl` to test the application:
```bash
# store some data in the key-value store
curl -iX POST --data 'hello' http://localhost:3000/test# retrieve data from the key-value store
curl -iX GET http://localhost:3000/testhello
```