Introduction
Before going to the main content of today, let's take a look at Dapr.
Dapr is a portable, event-driven runtime that makes it easy for any developer to build elastic, stateless, and stateful applications that run on the cloud and the edge, and includes a diversity of languages and developer frameworks .
▌Any language, any framework, anywhere
Today, we are experiencing a wave of cloud adoption. Developers are comfortable with web + database application architectures, such as the classic 3-tier design, but are not satisfied with the inherently distributed microservices application architecture. Becoming an expert in distributed systems is hard, and neither should you. Developers want to focus on business logic while relying on the platform to infuse their applications with the scale, elasticity, maintainability, resiliency, and other attributes of a cloud-native architecture.
This is where Dapr comes in. Dapr codifies best practices for building microservice applications into open, independent APIs called building blocks that enable you to build portable applications using the language and framework of your choice. Each building block is completely self-contained, and you can use one, some, or all of them in your application.
With Dapr, you can gradually migrate existing applications to a microservices architecture, enabling cloud-native patterns such as scale-out/scale-down, elasticity, and standalone deployments.
Additionally, Dapr is platform-agnostic, which means you can run your applications on-premises, on any Kubernetes cluster, virtual or physical, and other hosting environments that Dapr integrates with. This enables you to build microservice applications that can run in the cloud and at the edge.
▌Microservice building blocks for cloud and edge
There are many considerations when building a microservice application. Dapr provides best practices for common functionality when building microservice applications that developers can use in a standard way and deploy to any environment. It does this by providing distributed system building blocks.
Each of these building block APIs is self-contained, which means you can use one, some, or all of them in your application.
▌Sidecar Architecture
Dapr exposes its HTTP and gRPC APIs as a sidecar architecture, both as a container and as a process, without requiring application code to contain any Dapr runtime code. This makes integration with Dapr easy to integrate with other runtimes and provides separation of application logic for better supportability.
▌ Self-hosted local development
In self-hosted mode, Dapr runs as a separate sidecar process that your service code can call via HTTP or gRPC. Each running service has a Dapr runtime process (or sidecar) that is configured to use a state store, pub/sub, binding components, and other building blocks.
You can use the Dapr CLI to run Dapr-enabled applications on your local computer. The following figure shows Dapr's local development environment when configured using the CLIinit command.
After reading the above article, we all need to have a consensus concept that Dapr is a sidecar mode, and the place pointed by the arrow in the figure below is the sidecar. Do you immediately know what Dapr is like?
You can understand it as some additional services, of course it also means that it will be an omnipotent service.
Those who know NCF know it, and those who don't can go to NCF Docs to see the true content of NCF. (NeuCharFramework) is a complete set of enterprise-level general-purpose .NET frameworks that can be used to build basic projects. It strictly follows the DDD design pattern, including basic cache, database, model, verification and supporting management background. It is highly modular and highly scalable. sturdiness and durability.
NCF has simple, flexible and extensible features. Now add Dapr to it. You can imagine that it will provide more capabilities for developer partners to a greater extent. Let's take a look at the Dapr version of NCF.
NCF Docs:
https://www.ncf.pub/Docs#sort=start
step
- Download NCF source code
- Open Visual Studio and open the Dapr branch source code
- Modify database configuration
- Modify Redis configuration
- Compile the project docker-compose
- start Docker
- Check Docker running status
- Configure Docker Shared Folder Directory
- run
implement
- Download NCF source code
download link:
https://github.com/NeuCharFramework/NCF
Branch: Developer-front-DDD-Dapr-20220218
- Open Visual Studio and open the Dapr branch source code
After opening the source code as shown in the figure
Senparc.Web main running project
XncfModules/ Xncf modules directory
docker-compose docker run project
- Modify the database configuration Open the database configuration file
Modify the content of the Sql-Server node as follows
Modify these three positions
- Modify Redis configuration
Set docker-compose as startup item
If it prompts that the xxx container does not exist when starting, you need to add support for the project container, right-click the project to add Docker support
You need to view the configuration information in redis running in the docker container
- Compile the project docker-compose
- start Docker
- Check Docker running status
Right-click on the desktop icon where Docker is running, and you can see if Docker is running normally
Configure Docker Shared Folder Directory
Enter the windows version, docker desktop main interface, see the settings icon as shown below, click to enter
Authorize shared folders
Why authorize the folder, because docker itself is a container environment, independent of its own operating system, if you want to communicate or transfer with the folder in the operating system, you need to use sharing, mounting and other functions, so you need to share folder
- run
Microsoft Most Valuable Professional (MVP)
The Microsoft Most Valuable Professional is a global award given to third-party technology professionals by Microsoft Corporation. For 29 years, technology community leaders around the world have received this award for sharing their expertise and experience in technology communities both online and offline.
MVPs are a carefully selected team of experts who represent the most skilled and intelligent minds, passionate and helpful experts who are deeply invested in the community. MVPs are committed to helping others and maximizing the use of Microsoft technologies by Microsoft technical community users by speaking, forum Q&A, creating websites, writing blogs, sharing videos, open source projects, organizing conferences, and more.
For more details, please visit the official website: https://mvp.microsoft.com/zh-cn
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。