Skip to content

Latest commit

 

History

History
39 lines (35 loc) · 4.01 KB

File metadata and controls

39 lines (35 loc) · 4.01 KB

What's the best way to organize a CSharp project for microservices development architecture with Azure Container Apps ?

Organizing a C# project for microservices architecture using Azure Container Apps involves careful planning, structuring, and setting up. Here is one of the best ways to do this:

  1. Services Division: Start by dividing your application into different services. Each service should have a single responsibility and should be loosely coupled, i.e., independent and self-contained.
  2. Project Folder Structure: Create separate folders for each microservice in your project. Within each microservice, you can further divide into smaller parts. Here is an example of a typical folder structure:
├─── .github                 # contains GitHub workflows and actions
├─── Microservice1
|      ├─── Controllers      # contains API controllers
|      ├─── Services         # business logic goes here
|      ├─── Middleware       # Middlewares if any
|      ├─── Models           # contains domain models
|      ├─── Properties       # application properties
|      └─── Utils            # utility functions/classes
|
├─── Microservice2
|
└─── docker-compose.yml
  1. Dockerization: Dockerize each microservice, create a Dockerfile within each service directory. This file should contain instructions to create a Docker image for the respective microservice.
  2. Docker Compose: Having Dockerfiles for each service, consider bringing them together using a docker-compose.yml. It should contain the services and the instructions to run them.
  3. Azure Container Apps: Azure Container Apps is a serverless container hosting service. Deploy your Docker container to Azure Container Apps as it handles orchestration, routing, scaling, and SSL offloading for you. You can set up pipelines in Azure DevOps to provide continuous integration and deployment.
  4. Separation of Concerns: For projects following microservices architecture, it's preferable to set up separate repositories for each service. This ensures that the services are decoupled from each other.
  5. Unit Tests: Create a tests project for each microservice to ensure that all functions are working as expected. This helps in maintaining the quality of code. Resources:
  • learn.microsoft.comlearn.microsoft.com Introduction to Kubernetes on Azure - Training Learn about the basics of Docker containers, container orchestration with Kubernetes, and managed clusters on Azure Kubernetes Service.

GitHubGitHub GitHub - dotnet-architecture/eShopOnContainers: Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop. Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual St... (98 kB)