https://github.com/rosenkolev/dapr-pluggable-component-litedb
https://github.com/rosenkolev/dapr-pluggable-component-litedb
dapr dapr-component litedb
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rosenkolev/dapr-pluggable-component-litedb
- Owner: rosenkolev
- Created: 2024-04-18T17:02:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-19T11:35:19.000Z (over 1 year ago)
- Last Synced: 2025-01-13T10:50:08.609Z (10 months ago)
- Topics: dapr, dapr-component, litedb
- Language: C#
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DAPR Pluggable Component For LiteDb
[](https://github.com/rosenkolev/dapr-pluggable-component-litedb/actions/workflows/dotnet.yml)
[](https://hub.docker.com/r/rosenkolev/dapr-pluggable-component-litedb)
[!](https://hub.docker.com/r/rosenkolev/dapr-pluggable-component-litedb)
[](https://github.com/rosenkolev/dapr-pluggable-component-litedb/blob/main/LICENSE)
[Report Bug](/issues) . [Request Feature](/issues)
Table of Contents
1. [About The Project](#about-the-project)
* [Features](#features)
1. [Getting Started](#getting-started)
* [Dependencies](#dependencies)
* [Installation](#installation)
1. [Usage](#usage)
* [Configure](#configure)
* [Docker Compose](#docker-compose)
1. [Contributing](#contributing)
1. [License](#license)
## About The Project
**Pluggable component to use [LiteDb](https://www.litedb.org/) as [DAPR](dapr.io) state.**
### Features
Features are based on the DAPR state protocol (see [Dapr State Stores](https://docs.dapr.io/reference/components-reference/supported-state-stores/)).
| Component | CRUD | Transactional | Batch | ETag | TTL | Actors | Query |
| --------- | ---- | ------------- | ----- | ---- | --- | ------ | ----- |
| litedb | ✅ | ✅ | ✅ | ⬜ | ⬜ | ⬜ | ✅ |
## Getting Started
### Dependencies
[](https://www.nuget.org/packages/LiteDB)
[](https://www.nuget.org/packages/Dapr.PluggableComponents.AspNetCore)
### Installation
```shell
dotnet run -d -v dapr-sockets:/tmp/dapr-components-sockets:rw rosenkolev/dapr-pluggable-component-litedb
```
## Usage
### Configure
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: roles
spec:
type: state.litedb
version: v1
metadata:
# - name: databaseName
# value: state
# - name: collectionName
# value: default
# - name: indexes
# value:
```
#### Spec metadata fields
| Field | Required | Details | Example |
| -------------- | -------- | ------- | ------- |
| databaseName | N | The database file name.
Default: `state` | `"my_database"` |
| collectionName | N | The collection name
Default: `default` | `"roles"`, `"users"` |
| indexes | N | The collection indexes | `"email"`
`"email,externalId"` |
#### Files
| Path | Details |
| ---- | ------- |
| `/.db/{databaseName}.db` (ie: `/.db/state.db`) | The database file. |
| `/.db/metadata.json` | The file preserving components metadata between container restarts. |
### Docker Compose
```yaml
version: '3.4'
volumes:
dapr-sockets:
services:
api:
image: ${DOCKER_REGISTRY-}api
build:
context: .
dockerfile: Api/Dockerfile
api-dapr:
image: "daprio/daprd"
container_name: api-darp
command: ["./daprd",
"-app-id", "api",
"-app-port", "8080",
"-placement-host-address", "placement:50006",
"--resources-path", "/components"]
volumes:
- dapr-sockets:/tmp/dapr-components-sockets:rw
- ./dapr/components/:/components
depends_on:
- dapr-litedb
network_mode: "service:api"
dapr-litedb:
image: rosenkolev/dapr-pluggable-component-litedb
container_name: dapr-litedb
restart: no
volumes:
- dapr-sockets:/tmp/dapr-components-sockets:rw
```
## Contribution
The project is open for contribution by the community.
## License
Project is licensed under the [MIT](LICENSE.TXT) license.