Introduction to the Distributed Application Runtime
Dapr는 클라우드나 엣지에서 실행 가능하여, 간단하게 마이크로서비스 애플리케이션을 구축할 수 있게 해 준다.
분산 애플리케이션에 내재된 큰 어려움 중 하나인 복잡성을 해결해 준다.
다양한 언어를 지원한다.
Microservice building blocks for cloud and edge
Building Block을 제공하여 마이크로서비스 애플리케이션을 구축할 때 공통 기능에 대한 표준적인 방법을 제공한다.
Building Block | Endpoint | Description |
Service-to-service invocation | /v1.0/invoke | Resilient service-to-service invocation enables method calls, including retries, on remote services, wherever they are located in the supported hosting environment. |
State management | /v1.0/state | With state management for storing and querying key/value pairs, long-running, highly available, stateful services can be easily written alongside stateless services in your application. The state store is pluggable and examples include AWS DynamoDB, Azure Cosmos DB, Azure SQL Server, GCP Firebase, PostgreSQL or Redis, among others. |
Publish and subscribe | /v1.0/publish /v1.0/subscrive |
Publishing events and subscribing to topics between services enables event-driven architectures to simplify horizontal scalability and make them resilient to failure. Dapr provides at-least-once message delivery guarantee, message TTL, consumer groups and other advance features. |
Resource bindings | /v1.0/bindings | Resource bindings with triggers builds further on event-driven architectures for scale and resiliency by receiving and sending events to and from any external source such as databases, queues, file systems, etc. |
Actors | /v1.0/actors | A pattern for stateful and stateless objects that makes concurrency simple, with method and state encapsulation. Dapr provides many capabilities in its actor runtime, including concurrency, state, and life-cycle management for actor activation/deactivation, and timers and reminders to wake up actors. |
Secrets | /v1.0/srcrets | The secrets management API integrates with public cloud and local secret stores to retrieve the secrets for use in application code. |
Configuration | /v1.0/configuration | The configuration API enables you to retrieve and subscribe to application configuration items from configuration stores. |
Distributed lock | /v1.0-alpha1/lock | The distributed lock API enables your application to acquire a lock for any resource that gives it exclusive access until either the lock is released by the application, or a lease timeout occurs. |
Workflows | /v1.0-alpha1/workflow | The workflow API can be combined with other Dapr building blocks to define long running, persistent processes or data flows that span multiple microservices using Dapr workflows or workflow components. |
Cryptography | The cryptography API provides an abstraction layer on top of security infrastructure such as key vaults. It contains APIs that allow you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your applications. |
Sidecar architecture
Dapr는 애클리케이션 코드에 Dapr 런타임 코드를 포함할 필요 없이 HTTP/gRPC API를 사이드카 아키텍처로 제공한다.
Hosting environments
Self-hosted local development
Dapr CLI를 사용하면 로컬 PC에서 Dapr 지원 애플리케이션을 실행 가능하다.
Kubernetes
Dapr는 애플리케이션에 컨테이너가 있는 동일한 Pod에 사이드카 컨테이너로 실행된다.
Clusters of physical or virtual machines
Dapr Control plan 서비스는 물리 또는 가상 머신에 HA모드로 구성할 수도 있다.
Getting started
Install Dapr CLI
설치방법 : https://docs.dapr.io/getting-started/install-dapr-cli/
__
____/ /___ _____ _____
/ __ / __ '/ __ \/ ___/
/ /_/ / /_/ / /_/ / /
\__,_/\__,_/ .___/_/
/_/
===============================
Distributed Application Runtime
Usage:
dapr [command]
Available Commands:
completion Generates shell completion scripts
components List all Dapr components. Supported platforms: Kubernetes
configurations List all Dapr configurations. Supported platforms: Kubernetes
dashboard Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted
help Help about any command
init Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted
invoke Invoke a method on a given Dapr application. Supported platforms: Self-hosted
list List all Dapr instances. Supported platforms: Kubernetes and self-hosted
logs Get Dapr sidecar logs for an application. Supported platforms: Kubernetes
mtls Check if mTLS is enabled. Supported platforms: Kubernetes
publish Publish a pub-sub event. Supported platforms: Self-hosted
run Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted
status Show the health status of Dapr services. Supported platforms: Kubernetes
stop Stop Dapr instances and their associated apps. . Supported platforms: Self-hosted
uninstall Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted
upgrade Upgrades a Dapr control plane installation in a cluster. Supported platforms: Kubernetes
version Print the Dapr runtime and CLI version
Flags:
-h, --help help for dapr
-v, --version version for dapr
Use "dapr [command] --help" for more information about a command.
Init Dapr locally
CLI를 사용해서 로컬 PC에 Dapr를 초기화한다.
- 로컬에서 Dapr 사이드카 바이너리를 가져와서 설치한다.
- Dapr로 애플리케이션 개발환경을 구축한다.
권장 개발환경은 Docker가 필요하지만 Docker 없이도 개발환경 구성은 가능하다.
참고 : https://docs.dapr.io/operations/hosting/self-hosted/self-hosted-no-docker/
Use the Dapr API
# Run the Dapr sidecar
$ dapr run --app-id myapp - -dapr-http-port 3500
# Save state
$ curl -X POST -H "Content-Type: application/json" -d '[f "key": "name", "value": "test"}]' http://localhost:3500/v1.0/state/statestore
# Get state
$ curl http://localhost:3500/v1.0/state/statestore/name
›› test
# See how the state is sotred in Redis
hgetall
"myapp | | name"
# Delete state
$ curl -V -X DELETE -H "Content-Type: application/json" http://localhost:3500/v1.0/state/statestore/name
Java SDK
https://docs.dapr.io/developing-applications/sdks/java/
Spring Framework과 쉽게 연동 가능하며, SDK 내부적으로는 gRPC를 사용하여 Dapr 사이드카와 통신한다.
참고
https://docs.dapr.io/concepts/overview/
'dev' 카테고리의 다른 글
LLM 프롬프트 디자인 (0) | 2024.11.12 |
---|---|
docker (0) | 2016.02.24 |
git remote 변경, hook 처리 (0) | 2014.01.10 |
용어 정리 (0) | 2010.08.24 |
java 개발자의 Ubuntu 10.04 설치 및 사용 후기 (0) | 2010.06.09 |