diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c658578..9e2366c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,8 +25,8 @@ jobs:
if: success()
id: build-test-flight-step
with:
- project-path: '3-microservices-architecture-style/src/Services/Flight/src/Flight.Api'
- tests-path: '3-microservices-architecture-style/src/Services/Flight/tests/'
+ project-path: 'src/Services/Flight/src/Flight.Api'
+ tests-path: 'src/Services/Flight/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@@ -40,8 +40,8 @@ jobs:
if: success()
id: build-test-identity-step
with:
- project-path: '3-microservices-architecture-style/src/Services/Identity/src/Identity.Api'
- tests-path: '3-microservices-architecture-style/src/Services/Identity/tests/'
+ project-path: 'src/Services/Identity/src/Identity.Api'
+ tests-path: 'src/Services/Identity/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@@ -55,8 +55,8 @@ jobs:
if: success()
id: build-test-passenger-step
with:
- project-path: '3-microservices-architecture-style/src/Services/Passenger/src/Passenger.Api'
- tests-path: '3-microservices-architecture-style/src/Services/Passenger/tests/'
+ project-path: 'src/Services/Passenger/src/Passenger.Api'
+ tests-path: 'src/Services/Passenger/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@@ -70,8 +70,8 @@ jobs:
if: success()
id: build-test-booking-step
with:
- project-path: '3-microservices-architecture-style/src/Services/Booking/src/Booking.Api'
- tests-path: '3-microservices-architecture-style/src/Services/Booking/tests/'
+ project-path: 'src/Services/Booking/src/Booking.Api'
+ tests-path: 'src/Services/Booking/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@@ -98,7 +98,7 @@ jobs:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
- dockerfile-path: '3-microservices-architecture-style/src/Services/Identity/Dockerfile'
+ dockerfile-path: 'src/Services/Identity/Dockerfile'
image-name: 'booking-microservices-identity'
- name: Build and Publish Flight Microservice to Docker
@@ -108,7 +108,7 @@ jobs:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
- dockerfile-path: '3-microservices-architecture-style/src/Services/Flight/Dockerfile'
+ dockerfile-path: 'src/Services/Flight/Dockerfile'
image-name: 'booking-microservices-flight'
- name: Build and Publish Passenger Microservice to Docker
@@ -118,7 +118,7 @@ jobs:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
- dockerfile-path: '3-microservices-architecture-style/src/Services/Passenger/Dockerfile'
+ dockerfile-path: 'src/Services/Passenger/Dockerfile'
image-name: 'booking-microservices-passenger'
- name: Build and Publish Booking Microservice to Docker
@@ -128,5 +128,5 @@ jobs:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
- dockerfile-path: '3-microservices-architecture-style/src/Services/Booking/Dockerfile'
+ dockerfile-path: 'src/Services/Booking/Dockerfile'
image-name: 'booking-microservices-booking'
diff --git a/1-monolith-architecture-style/README.md b/1-monolith-architecture-style/README.md
deleted file mode 100644
index b09544e..0000000
--- a/1-monolith-architecture-style/README.md
+++ /dev/null
@@ -1,110 +0,0 @@
-# 🪁 Monolith Architecture Style
-
-> In **Monolith Architecture**, the entire application is built as a single, tightly coupled unit. All components (e.g., Api, business logic, and data access) are part of the same codebase and deployed together.
-
-# Table of Contents
-
-- [Key Features](#key-features)
-- [When to Use](#when-to-use)
-- [Challenges](#challenges)
-- [Monolith Architecture Design](#monolith-architecture-design)
-- [Development Setup](#development-setup)
- - [Dotnet Tools Packages](#dotnet-tools-packages)
- - [Husky](#husky)
- - [Upgrade Nuget Packages](#upgrade-nuget-packages)
-- [How to Run](#how-to-run)
- - [Docker Compose](#docker-compose)
- - [Build](#build)
- - [Run](#run)
- - [Test](#test)
-- [Documentation Apis](#documentation-apis)
-
-
-## Key Features
-1. **Single Codebase**: All components (UI, business logic, data access) are part of one project.
-2. **Tight Coupling**: Components are highly dependent on each other, making changes riskier.
-3. **Simple Deployment**: The entire application is deployed as a single unit.
-4. **Centralized Database**: Typically uses a single database for all data storage and access.
-
-
-## When to Use
-1. **Small to Medium Projects**: Ideal for applications with limited complexity and scope.
-2. **Rapid Development**: Suitable for projects requiring quick development and deployment.
-3. **Small Teams**: Works well for small teams with limited resources.
-4. **Low Scalability Needs**: Best for applications with predictable and low traffic.
-
-
-## Challenges
-- Harder to maintain as the codebase grows.
-- Limited scalability (scaling requires scaling the entire application).
-- Difficult to adopt new technologies incrementally.
-
-## Monolith Architecture Design
-
-
-
-
-## Development Setup
-
-### Dotnet Tools Packages
-For installing our requirement packages with .NET cli tools, we need to install `dotnet tool manifest`.
-```bash
-dotnet new tool-manifest
-```
-And after that we can restore our dotnet tools packages with .NET cli tools from `.config` folder and `dotnet-tools.json` file.
-```
-dotnet tool restore
-```
-
-### Husky
-Here we use `husky` to handel some pre commit rules and we used `conventional commits` rules and `formatting` as pre commit rules, here in [package.json](.././package.json). of course, we can add more rules for pre commit in future. (find more about husky in the [documentation](https://typicode.github.io/husky/get-started.html))
-We need to install `husky` package for `manage` `pre commits hooks` and also I add two packages `@commitlint/cli` and `@commitlint/config-conventional` for handling conventional commits rules in [package.json](.././package.json).
-Run the command bellow in the root of project to install all npm dependencies related to husky:
-
-```bash
-npm install
-```
-
-> Note: In the root of project we have `.husky` folder and it has `commit-msg` file for handling conventional commits rules with provide user friendly message and `pre-commit` file that we can run our `scripts` as a `pre-commit` hooks. that here we call `format` script from [package.json](./package.json) for formatting purpose.
-
-### Upgrade Nuget Packages
-For upgrading our nuget packages to last version, we use the great package [dotnet-outdated](https://github.com/dotnet-outdated/dotnet-outdated).
-Run the command below in the root of project to upgrade all of packages to last version:
-```bash
-dotnet outdated -u
-```
-
-## How to Run
-
-> ### Docker Compose
-
-To run this app in `Docker`, use the [docker-compose.yaml](./deployments/docker-compose/docker-compose.yaml) and execute the below command at the `root` of the application:
-
-```bash
-docker-compose -f ./deployments/docker-compose/docker-compose.yaml up -d
-```
-
-> ### Build
-To `build` monolith app, run this command in the `root` of the project:
-```bash
-dotnet build
-```
-
-> ### Run
-To `run` monolith app, run this command in the root of the `Api` folder where the `csproj` file is located:
-```bash
-dotnet run
-```
-
-> ### Test
-
-To `test` monolith app, run this command in the `root` of the project:
-```bash
-dotnet test
-```
-
-> ### Documentation Apis
-
-Each microservice provides `API documentation` and navigate to `/swagger` for `Swagger OpenAPI` or `/scalar/v1` for `Scalar OpenAPI` to visit list of endpoints.
-
-As part of API testing, I created the [booking.rest](./booking.rest) file which can be run with the [REST Client](https://github.com/Huachao/vscode-restclient) `VSCode plugin`.
diff --git a/1-monolith-architecture-style/assets/booking-monolith.drawio b/1-monolith-architecture-style/assets/booking-monolith.drawio
deleted file mode 100644
index d4033ca..0000000
--- a/1-monolith-architecture-style/assets/booking-monolith.drawio
+++ /dev/null
@@ -1,348 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/1-monolith-architecture-style/assets/booking-monolith.png b/1-monolith-architecture-style/assets/booking-monolith.png
deleted file mode 100644
index f090df5..0000000
Binary files a/1-monolith-architecture-style/assets/booking-monolith.png and /dev/null differ
diff --git a/1-monolith-architecture-style/booking.rest b/1-monolith-architecture-style/booking.rest
deleted file mode 100644
index 1af03e6..0000000
--- a/1-monolith-architecture-style/booking.rest
+++ /dev/null
@@ -1,230 +0,0 @@
-
-@booking-monolith-api=https://localhost:4000
-
-@contentType = application/json
-@flightid = "3c5c0000-97c6-fc34-2eb9-08db322230c9"
-@passengerId = "8c9c0000-97c6-fc34-2eb9-66db322230c9"
-
-################################# Identity API #################################
-
-###
-# @name Authenticate
-POST {{booking-monolith-api}}/connect/token
-Content-Type: application/x-www-form-urlencoded
-
-grant_type=password
-&client_id=client
-&client_secret=secret
-&username=samh
-&password=Admin@123456
-&scope=booking-monolith role
-###
-
-
-
-###
-# @name Register_New_User
-POST {{booking-monolith-api}}/api/v1/identity/register-user
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "firstName": "John",
- "lastName": "Do",
- "username": "admin",
- "passportNumber": "41290000",
- "email": "admin@admin.com",
- "password": "Admin@12345",
- "confirmPassword": "Admin@12345"
-}
-###
-
-################################# Flight API #################################
-
-###
-# @name Create_Seat
-Post {{booking-monolith-api}}/api/v1/flight/seat
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "seatNumber": "1255",
- "type": 1,
- "class": 1,
- "flightId": "3c5c0000-97c6-fc34-2eb9-08db322230c9"
-}
-###
-
-
-###
-# @name Reserve_Seat
-Post {{booking-monolith-api}}/api/v1/flight/reserve-seat
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "flightId": "3c5c0000-97c6-fc34-2eb9-08db322230c9",
- "seatNumber": "1255"
-}
-###
-
-
-###
-# @name Get_Available_Seats
-GET {{booking-monolith-api}}/api/v1/flight/get-available-seats/{{flightid}}
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-###
-
-
-###
-# @name Get_Flight_By_Id
-GET {{booking-monolith-api}}/api/v1/flight/{{flightid}}
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-###
-
-
-###
-# @name Get_Available_Flights
-GET {{booking-monolith-api}}/api/v1/flight/get-available-flights
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-###
-
-
-###
-# @name Create_Flights
-POST {{booking-monolith-api}}/api/v1/flight
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "flightNumber": "12BB",
- "aircraftId": "3c5c0000-97c6-fc34-fcd3-08db322230c8",
- "departureAirportId": "3c5c0000-97c6-fc34-a0cb-08db322230c8",
- "departureDate": "2022-03-01T14:55:41.255Z",
- "arriveDate": "2022-03-01T14:55:41.255Z",
- "arriveAirportId": "3c5c0000-97c6-fc34-fc3c-08db322230c8",
- "durationMinutes": 120,
- "flightDate": "2022-03-01T14:55:41.255Z",
- "status": 1,
- "price": 8000
-}
-###
-
-
-###
-# @name Update_Flights
-PUT {{booking-monolith-api}}/api/v1/flight
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "id": 1,
- "flightNumber": "BD467",
- "aircraftId": "3c5c0000-97c6-fc34-fcd3-08db322230c8",
- "departureAirportId": "3c5c0000-97c6-fc34-a0cb-08db322230c8",
- "departureDate": "2022-04-23T12:17:45.140Z",
- "arriveDate": "2022-04-23T12:17:45.140Z",
- "arriveAirportId": "3c5c0000-97c6-fc34-fc3c-08db322230c8",
- "durationMinutes": 120,
- "flightDate": "2022-04-23T12:17:45.140Z",
- "status": 4,
- "isDeleted": false,
- "price": 99000
-}
-###
-
-
-###
-# @name Delete_Flights
-DELETE {{booking-monolith-api}}/api/v1/flight/{{flightid}}
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-###
-
-
-###
-# @name Create_Airport
-POST {{booking-monolith-api}}/api/v1/flight/airport
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "name": "mehrabad",
- "address": "tehran",
- "code": "12YD"
-}
-###
-
-
-
-###
-# @name Create_Aircraft
-POST {{booking-monolith-api}}/api/v1/flight/aircraft
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "name": "airbus2",
- "model": "322",
- "manufacturingYear": 2012
-}
-###
-
-
-################################# Passenger API #################################
-
-
-###
-# @name Complete_Registration_Passenger
-POST {{booking-monolith-api}}/api/v1/passenger/complete-registration
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "passportNumber": "41290000",
- "passengerType": 1,
- "age": 30
-}
-###
-
-
-###
-# @name Get_Passenger_By_Id
-GET {{booking-monolith-api}}/api/v1/passenger/{{passengerId}}
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-###
-
-
-################################# Booking API #################################
-
-
-###
-# @name Create_Booking
-POST {{booking-monolith-api}}/api/v1/booking
-accept: application/json
-Content-Type: application/json
-authorization: bearer {{Authenticate.response.body.access_token}}
-
-{
- "passengerId": "8c9c0000-97c6-fc34-2eb9-66db322230c9",
- "flightId": "3c5c0000-97c6-fc34-2eb9-08db322230c9",
- "description": "I want to fly to iran"
-}
-###
diff --git a/1-monolith-architecture-style/deployments/configs/grafana/dashboards/dotnet-core.json b/1-monolith-architecture-style/deployments/configs/grafana/dashboards/dotnet-core.json
deleted file mode 100644
index b435130..0000000
--- a/1-monolith-architecture-style/deployments/configs/grafana/dashboards/dotnet-core.json
+++ /dev/null
@@ -1,1307 +0,0 @@
-{
- "__inputs": [
- {
- "name": "DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY",
- "label": "Managed_Prometheus_jamesnk-telemetry",
- "description": "",
- "type": "datasource",
- "pluginId": "prometheus",
- "pluginName": "Prometheus"
- }
- ],
- "__elements": {},
- "__requires": [
- {
- "type": "grafana",
- "id": "grafana",
- "name": "Grafana",
- "version": "9.4.8"
- },
- {
- "type": "datasource",
- "id": "prometheus",
- "name": "Prometheus",
- "version": "1.0.0"
- },
- {
- "type": "panel",
- "id": "stat",
- "name": "Stat",
- "version": ""
- },
- {
- "type": "panel",
- "id": "table",
- "name": "Table",
- "version": ""
- },
- {
- "type": "panel",
- "id": "timeseries",
- "name": "Time series",
- "version": ""
- }
- ],
- "annotations": {
- "list": [
- {
- "builtIn": 1,
- "datasource": {
- "type": "grafana",
- "uid": "-- Grafana --"
- },
- "enable": true,
- "hide": true,
- "iconColor": "rgba(0, 211, 255, 1)",
- "name": "Annotations & Alerts",
- "target": {
- "limit": 100,
- "matchAny": false,
- "tags": [],
- "type": "dashboard"
- },
- "type": "dashboard"
- }
- ]
- },
- "description": "ASP.NET Core metrics from OpenTelemetry NuGet",
- "editable": true,
- "fiscalYearStartMonth": 0,
- "gnetId": 17706,
- "graphTooltip": 0,
- "id": null,
- "links": [],
- "liveNow": false,
- "panels": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "fieldConfig": {
- "defaults": {
- "color": {
- "fixedColor": "dark-green",
- "mode": "continuous-GrYlRd",
- "seriesBy": "max"
- },
- "custom": {
- "axisCenteredZero": false,
- "axisColorMode": "text",
- "axisLabel": "",
- "axisPlacement": "auto",
- "axisSoftMin": 0,
- "barAlignment": 0,
- "drawStyle": "line",
- "fillOpacity": 50,
- "gradientMode": "opacity",
- "hideFrom": {
- "legend": false,
- "tooltip": false,
- "viz": false
- },
- "lineInterpolation": "smooth",
- "lineWidth": 1,
- "pointSize": 5,
- "scaleDistribution": {
- "type": "linear"
- },
- "showPoints": "never",
- "spanNulls": false,
- "stacking": {
- "group": "A",
- "mode": "none"
- },
- "thresholdsStyle": {
- "mode": "off"
- }
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- }
- ]
- },
- "unit": "s"
- },
- "overrides": [
- {
- "__systemRef": "hideSeriesFrom",
- "matcher": {
- "id": "byNames",
- "options": {
- "mode": "exclude",
- "names": [
- "p50"
- ],
- "prefix": "All except:",
- "readOnly": true
- }
- },
- "properties": [
- {
- "id": "custom.hideFrom",
- "value": {
- "legend": false,
- "tooltip": false,
- "viz": false
- }
- }
- ]
- }
- ]
- },
- "gridPos": {
- "h": 9,
- "w": 12,
- "x": 0,
- "y": 0
- },
- "id": 40,
- "options": {
- "legend": {
- "calcs": [
- "lastNotNull",
- "min",
- "max"
- ],
- "displayMode": "table",
- "placement": "right",
- "showLegend": true
- },
- "tooltip": {
- "mode": "multi",
- "sort": "none"
- }
- },
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "histogram_quantile(0.50, sum(rate(http_server_request_duration_s_bucket{job=\"$job\", instance=\"$instance\"}[$__rate_interval])) by (le))",
- "legendFormat": "p50",
- "range": true,
- "refId": "p50"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "histogram_quantile(0.75, sum(rate(http_server_request_duration_s_bucket{job=\"$job\", instance=\"$instance\"}[$__rate_interval])) by (le))",
- "hide": false,
- "legendFormat": "p75",
- "range": true,
- "refId": "p75"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "histogram_quantile(0.90, sum(rate(http_server_request_duration_s_bucket{job=\"$job\", instance=\"$instance\"}[$__rate_interval])) by (le))",
- "hide": false,
- "legendFormat": "p90",
- "range": true,
- "refId": "p90"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "histogram_quantile(0.95, sum(rate(http_server_request_duration_s_bucket{job=\"$job\", instance=\"$instance\"}[$__rate_interval])) by (le))",
- "hide": false,
- "legendFormat": "p95",
- "range": true,
- "refId": "p95"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "histogram_quantile(0.98, sum(rate(http_server_request_duration_s_bucket{job=\"$job\", instance=\"$instance\"}[$__rate_interval])) by (le))",
- "hide": false,
- "legendFormat": "p98",
- "range": true,
- "refId": "p98"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "histogram_quantile(0.99, sum(rate(http_server_request_duration_s_bucket{job=\"$job\", instance=\"$instance\"}[$__rate_interval])) by (le))",
- "hide": false,
- "legendFormat": "p99",
- "range": true,
- "refId": "p99"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "histogram_quantile(0.999, sum(rate(http_server_request_duration_s_bucket{job=\"$job\", instance=\"$instance\"}[$__rate_interval])) by (le))",
- "hide": false,
- "legendFormat": "p99.9",
- "range": true,
- "refId": "p99.9"
- }
- ],
- "title": "Requests Duration",
- "type": "timeseries"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "fieldConfig": {
- "defaults": {
- "color": {
- "mode": "palette-classic",
- "seriesBy": "max"
- },
- "custom": {
- "axisCenteredZero": false,
- "axisColorMode": "text",
- "axisLabel": "",
- "axisPlacement": "auto",
- "barAlignment": 0,
- "drawStyle": "line",
- "fillOpacity": 50,
- "gradientMode": "opacity",
- "hideFrom": {
- "legend": false,
- "tooltip": false,
- "viz": false
- },
- "lineInterpolation": "smooth",
- "lineWidth": 1,
- "pointSize": 5,
- "scaleDistribution": {
- "type": "linear"
- },
- "showPoints": "never",
- "spanNulls": false,
- "stacking": {
- "group": "A",
- "mode": "none"
- },
- "thresholdsStyle": {
- "mode": "off"
- }
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- }
- ]
- },
- "unit": "percentunit"
- },
- "overrides": [
- {
- "matcher": {
- "id": "byName",
- "options": "All"
- },
- "properties": [
- {
- "id": "color",
- "value": {
- "fixedColor": "dark-orange",
- "mode": "fixed"
- }
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "4XX"
- },
- "properties": [
- {
- "id": "color",
- "value": {
- "fixedColor": "yellow",
- "mode": "fixed"
- }
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "5XX"
- },
- "properties": [
- {
- "id": "color",
- "value": {
- "fixedColor": "dark-red",
- "mode": "fixed"
- }
- }
- ]
- }
- ]
- },
- "gridPos": {
- "h": 9,
- "w": 12,
- "x": 12,
- "y": 0
- },
- "id": 47,
- "options": {
- "legend": {
- "calcs": [
- "lastNotNull",
- "min",
- "max"
- ],
- "displayMode": "table",
- "placement": "right",
- "showLegend": true
- },
- "tooltip": {
- "mode": "multi",
- "sort": "none"
- }
- },
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "sum(rate(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\", status_code=~\"4..|5..\"}[$__rate_interval]) or vector(0)) / sum(rate(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\"}[$__rate_interval]))",
- "legendFormat": "All",
- "range": true,
- "refId": "All"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "sum(rate(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\", status_code=~\"4..\"}[$__rate_interval]) or vector(0)) / sum(rate(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\"}[$__rate_interval]))",
- "hide": false,
- "legendFormat": "4XX",
- "range": true,
- "refId": "4XX"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "sum(rate(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\", status_code=~\"5..\"}[$__rate_interval]) or vector(0)) / sum(rate(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\"}[$__rate_interval]))",
- "hide": false,
- "legendFormat": "5XX",
- "range": true,
- "refId": "5XX"
- }
- ],
- "title": "Errors Rate",
- "type": "timeseries"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "description": "",
- "fieldConfig": {
- "defaults": {
- "color": {
- "mode": "palette-classic"
- },
- "custom": {
- "axisCenteredZero": false,
- "axisColorMode": "text",
- "axisLabel": "",
- "axisPlacement": "auto",
- "barAlignment": 0,
- "drawStyle": "line",
- "fillOpacity": 0,
- "gradientMode": "none",
- "hideFrom": {
- "legend": false,
- "tooltip": false,
- "viz": false
- },
- "lineInterpolation": "linear",
- "lineWidth": 1,
- "pointSize": 5,
- "scaleDistribution": {
- "type": "linear"
- },
- "showPoints": "auto",
- "spanNulls": false,
- "stacking": {
- "group": "A",
- "mode": "none"
- },
- "thresholdsStyle": {
- "mode": "off"
- }
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": []
- },
- "gridPos": {
- "h": 8,
- "w": 6,
- "x": 0,
- "y": 9
- },
- "id": 49,
- "options": {
- "legend": {
- "calcs": [],
- "displayMode": "list",
- "placement": "bottom",
- "showLegend": false
- },
- "tooltip": {
- "mode": "single",
- "sort": "none"
- }
- },
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "sum(kestrel_current_connections{job=\"$job\", instance=\"$instance\"})",
- "legendFormat": "__auto",
- "range": true,
- "refId": "A"
- }
- ],
- "title": "Current Connections",
- "type": "timeseries"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "description": "",
- "fieldConfig": {
- "defaults": {
- "color": {
- "mode": "palette-classic"
- },
- "custom": {
- "axisCenteredZero": false,
- "axisColorMode": "text",
- "axisLabel": "",
- "axisPlacement": "auto",
- "barAlignment": 0,
- "drawStyle": "line",
- "fillOpacity": 0,
- "gradientMode": "none",
- "hideFrom": {
- "legend": false,
- "tooltip": false,
- "viz": false
- },
- "lineInterpolation": "linear",
- "lineWidth": 1,
- "pointSize": 5,
- "scaleDistribution": {
- "type": "linear"
- },
- "showPoints": "auto",
- "spanNulls": false,
- "stacking": {
- "group": "A",
- "mode": "none"
- },
- "thresholdsStyle": {
- "mode": "off"
- }
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": []
- },
- "gridPos": {
- "h": 8,
- "w": 6,
- "x": 6,
- "y": 9
- },
- "id": 55,
- "options": {
- "legend": {
- "calcs": [],
- "displayMode": "list",
- "placement": "bottom",
- "showLegend": false
- },
- "tooltip": {
- "mode": "single",
- "sort": "none"
- }
- },
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "sum(http_server_current_requests{job=\"$job\", instance=\"$instance\"})",
- "legendFormat": "__auto",
- "range": true,
- "refId": "A"
- }
- ],
- "title": "Current Requests",
- "type": "timeseries"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "fieldConfig": {
- "defaults": {
- "color": {
- "fixedColor": "blue",
- "mode": "fixed"
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": []
- },
- "gridPos": {
- "h": 4,
- "w": 6,
- "x": 12,
- "y": 9
- },
- "id": 58,
- "options": {
- "colorMode": "background",
- "graphMode": "area",
- "justifyMode": "center",
- "orientation": "auto",
- "reduceOptions": {
- "calcs": [
- "lastNotNull"
- ],
- "fields": "",
- "values": false
- },
- "text": {},
- "textMode": "value"
- },
- "pluginVersion": "9.4.8",
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "exemplar": false,
- "expr": "sum(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\"})",
- "instant": false,
- "legendFormat": "__auto",
- "range": true,
- "refId": "A"
- }
- ],
- "title": "Total Requests",
- "type": "stat"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "fieldConfig": {
- "defaults": {
- "color": {
- "fixedColor": "dark-red",
- "mode": "fixed"
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": []
- },
- "gridPos": {
- "h": 4,
- "w": 6,
- "x": 18,
- "y": 9
- },
- "id": 59,
- "options": {
- "colorMode": "background",
- "graphMode": "area",
- "justifyMode": "center",
- "orientation": "auto",
- "reduceOptions": {
- "calcs": [
- "lastNotNull"
- ],
- "fields": "",
- "values": false
- },
- "text": {},
- "textMode": "value"
- },
- "pluginVersion": "9.4.8",
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "exemplar": false,
- "expr": "sum(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\", exception_name!=\"\"})",
- "instant": false,
- "legendFormat": "__auto",
- "range": true,
- "refId": "A"
- }
- ],
- "title": "Total Unhandled Exceptions",
- "type": "stat"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "description": "",
- "fieldConfig": {
- "defaults": {
- "color": {
- "fixedColor": "green",
- "mode": "fixed"
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": []
- },
- "gridPos": {
- "h": 4,
- "w": 6,
- "x": 12,
- "y": 13
- },
- "id": 60,
- "options": {
- "colorMode": "background",
- "graphMode": "area",
- "justifyMode": "auto",
- "orientation": "auto",
- "reduceOptions": {
- "calcs": [
- "max"
- ],
- "fields": "",
- "values": false
- },
- "textMode": "value_and_name"
- },
- "pluginVersion": "9.4.8",
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "sum by (scheme) (\r\n max_over_time(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\"}[$__rate_interval])\r\n )",
- "legendFormat": "{{scheme}}",
- "range": true,
- "refId": "A"
- }
- ],
- "title": "Requests Secured",
- "type": "stat"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "description": "",
- "fieldConfig": {
- "defaults": {
- "color": {
- "fixedColor": "purple",
- "mode": "fixed"
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": []
- },
- "gridPos": {
- "h": 4,
- "w": 6,
- "x": 18,
- "y": 13
- },
- "id": 42,
- "options": {
- "colorMode": "background",
- "graphMode": "area",
- "justifyMode": "auto",
- "orientation": "auto",
- "reduceOptions": {
- "calcs": [
- "max"
- ],
- "fields": "",
- "values": false
- },
- "textMode": "value_and_name"
- },
- "pluginVersion": "9.4.8",
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "expr": "sum by (protocol) (\r\n max_over_time(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\"}[$__rate_interval])\r\n )",
- "legendFormat": "{{protocol}}",
- "range": true,
- "refId": "A"
- }
- ],
- "title": "Requests HTTP Protocol",
- "type": "stat"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "description": "",
- "fieldConfig": {
- "defaults": {
- "color": {
- "mode": "thresholds"
- },
- "custom": {
- "align": "auto",
- "cellOptions": {
- "type": "auto"
- },
- "inspect": false
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": [
- {
- "matcher": {
- "id": "byName",
- "options": "Requests"
- },
- "properties": [
- {
- "id": "custom.width",
- "value": 300
- },
- {
- "id": "custom.cellOptions",
- "value": {
- "mode": "gradient",
- "type": "gauge"
- }
- },
- {
- "id": "color",
- "value": {
- "mode": "continuous-BlPu"
- }
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "Endpoint"
- },
- "properties": [
- {
- "id": "links",
- "value": [
- {
- "targetBlank": false,
- "title": "Test",
- "url": "/d/NagEsjE4z/asp-net-core-endpoint-details?var-route=${__data.fields.route}&var-method=${__data.fields.method}&${__url_time_range}"
- }
- ]
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "route"
- },
- "properties": [
- {
- "id": "custom.hidden",
- "value": true
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "method"
- },
- "properties": [
- {
- "id": "custom.hidden",
- "value": true
- }
- ]
- }
- ]
- },
- "gridPos": {
- "h": 8,
- "w": 12,
- "x": 0,
- "y": 17
- },
- "hideTimeOverride": false,
- "id": 51,
- "options": {
- "footer": {
- "countRows": false,
- "fields": "",
- "reducer": [
- "sum"
- ],
- "show": false
- },
- "showHeader": true,
- "sortBy": [
- {
- "desc": true,
- "displayName": "Value"
- }
- ]
- },
- "pluginVersion": "9.4.8",
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "exemplar": false,
- "expr": " topk(10,\r\n sum by (route, method, method_route) (\r\n label_join(max_over_time(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\", route!=\"\"}[$__rate_interval]), \"method_route\", \" \", \"method\", \"route\")\r\n ))",
- "format": "table",
- "instant": true,
- "interval": "",
- "legendFormat": "{{route}}",
- "range": false,
- "refId": "A"
- }
- ],
- "title": "Top 10 Requested Endpoints",
- "transformations": [
- {
- "id": "organize",
- "options": {
- "excludeByName": {
- "Time": true,
- "method": false,
- "route": false
- },
- "indexByName": {
- "Time": 0,
- "Value": 4,
- "method": 2,
- "method_route": 3,
- "route": 1
- },
- "renameByName": {
- "Value": "Requests",
- "method": "",
- "method_route": "Endpoint",
- "route": ""
- }
- }
- }
- ],
- "type": "table"
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "description": "",
- "fieldConfig": {
- "defaults": {
- "color": {
- "mode": "thresholds"
- },
- "custom": {
- "align": "auto",
- "cellOptions": {
- "type": "auto"
- },
- "inspect": false
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": [
- {
- "matcher": {
- "id": "byName",
- "options": "Requests"
- },
- "properties": [
- {
- "id": "custom.width",
- "value": 300
- },
- {
- "id": "custom.cellOptions",
- "value": {
- "mode": "gradient",
- "type": "gauge"
- }
- },
- {
- "id": "color",
- "value": {
- "mode": "continuous-YlRd"
- }
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "Endpoint"
- },
- "properties": [
- {
- "id": "links",
- "value": [
- {
- "title": "",
- "url": "/d/NagEsjE4z/asp-net-core-endpoint-details?var-route=${__data.fields.route}&var-method=${__data.fields.method}&${__url_time_range}"
- }
- ]
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "route"
- },
- "properties": [
- {
- "id": "custom.hidden",
- "value": true
- }
- ]
- },
- {
- "matcher": {
- "id": "byName",
- "options": "method"
- },
- "properties": [
- {
- "id": "custom.hidden",
- "value": true
- }
- ]
- }
- ]
- },
- "gridPos": {
- "h": 8,
- "w": 12,
- "x": 12,
- "y": 17
- },
- "hideTimeOverride": false,
- "id": 54,
- "options": {
- "footer": {
- "countRows": false,
- "fields": "",
- "reducer": [
- "sum"
- ],
- "show": false
- },
- "showHeader": true,
- "sortBy": [
- {
- "desc": true,
- "displayName": "Value"
- }
- ]
- },
- "pluginVersion": "9.4.8",
- "targets": [
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "editorMode": "code",
- "exemplar": false,
- "expr": " topk(10,\r\n sum by (route, method, method_route) (\r\n label_join(max_over_time(http_server_request_duration_s_count{job=\"$job\", instance=\"$instance\", route!=\"\", exception_name!=\"\"}[$__rate_interval]), \"method_route\", \" \", \"method\", \"route\")\r\n ))",
- "format": "table",
- "instant": true,
- "interval": "",
- "legendFormat": "{{route}}",
- "range": false,
- "refId": "A"
- }
- ],
- "title": "Top 10 Unhandled Exception Endpoints",
- "transformations": [
- {
- "id": "organize",
- "options": {
- "excludeByName": {
- "Time": true,
- "method": false
- },
- "indexByName": {
- "Time": 0,
- "Value": 4,
- "method": 2,
- "method_route": 3,
- "route": 1
- },
- "renameByName": {
- "Value": "Requests",
- "method": "",
- "method_route": "Endpoint",
- "route": ""
- }
- }
- }
- ],
- "type": "table"
- }
- ],
- "refresh": "",
- "revision": 1,
- "schemaVersion": 38,
- "style": "dark",
- "tags": [
- "dotnet",
- "prometheus",
- "aspnetcore"
- ],
- "templating": {
- "list": [
- {
- "current": {},
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "definition": "label_values(http_server_current_requests, job)",
- "hide": 0,
- "includeAll": false,
- "label": "Job",
- "multi": false,
- "name": "job",
- "options": [],
- "query": {
- "query": "label_values(http_server_current_requests, job)",
- "refId": "StandardVariableQuery"
- },
- "refresh": 2,
- "regex": "",
- "skipUrlSync": false,
- "sort": 1,
- "type": "query"
- },
- {
- "current": {},
- "datasource": {
- "type": "prometheus",
- "uid": "${DS_MANAGED_PROMETHEUS_JAMESNK-TELEMETRY}"
- },
- "definition": "label_values(http_server_current_requests{job=~\"$job\"}, instance)",
- "hide": 0,
- "includeAll": false,
- "label": "Instance",
- "multi": false,
- "name": "instance",
- "options": [],
- "query": {
- "query": "label_values(http_server_current_requests{job=~\"$job\"}, instance)",
- "refId": "StandardVariableQuery"
- },
- "refresh": 2,
- "regex": "",
- "skipUrlSync": false,
- "sort": 1,
- "type": "query"
- }
- ]
- },
- "time": {
- "from": "now-30m",
- "to": "now"
- },
- "timepicker": {},
- "timezone": "",
- "title": "ASP.NET Core",
- "uid": "KdDACDp4z",
- "version": 5,
- "weekStart": ""
-}
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/configs/grafana/dashboards/node-exporter.json b/1-monolith-architecture-style/deployments/configs/grafana/dashboards/node-exporter.json
deleted file mode 100644
index 4839d46..0000000
--- a/1-monolith-architecture-style/deployments/configs/grafana/dashboards/node-exporter.json
+++ /dev/null
@@ -1,892 +0,0 @@
-{
- "__inputs": [],
- "__requires": [
- {
- "type": "grafana",
- "id": "grafana",
- "name": "Grafana",
- "version": "7.4.3"
- },
- {
- "type": "panel",
- "id": "graph",
- "name": "Graph",
- "version": ""
- },
- {
- "type": "datasource",
- "id": "prometheus",
- "name": "Prometheus",
- "version": "1.0.0"
- }
- ],
- "annotations": {
- "list": []
- },
- "editable": false,
- "gnetId": 13978,
- "graphTooltip": 0,
- "hideControls": false,
- "id": null,
- "links": [],
- "refresh": "",
- "rows": [
- {
- "collapse": false,
- "collapsed": false,
- "panels": [
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "fill": 1,
- "fillGradient": 0,
- "gridPos": {},
- "id": 2,
- "legend": {
- "alignAsTable": false,
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "rightSide": false,
- "show": true,
- "sideWidth": null,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "null",
- "percentage": false,
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "repeat": null,
- "seriesOverrides": [],
- "spaceLength": 10,
- "span": 6,
- "stack": true,
- "steppedLine": false,
- "targets": [
- {
- "expr": "(\n (1 - rate(node_cpu_seconds_total{job=\"node\", mode=\"idle\", instance=\"$instance\"}[$__interval]))\n/ ignoring(cpu) group_left\n count without (cpu)( node_cpu_seconds_total{job=\"node\", mode=\"idle\", instance=\"$instance\"})\n)\n",
- "format": "time_series",
- "interval": "1m",
- "intervalFactor": 5,
- "legendFormat": "{{cpu}}",
- "refId": "A"
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeShift": null,
- "title": "CPU Usage",
- "tooltip": {
- "shared": true,
- "sort": 0,
- "value_type": "individual"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "percentunit",
- "label": null,
- "logBase": 1,
- "max": 1,
- "min": 0,
- "show": true
- },
- {
- "format": "percentunit",
- "label": null,
- "logBase": 1,
- "max": 1,
- "min": 0,
- "show": true
- }
- ]
- },
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "fill": 0,
- "fillGradient": 0,
- "gridPos": {},
- "id": 3,
- "legend": {
- "alignAsTable": false,
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "rightSide": false,
- "show": true,
- "sideWidth": null,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "null",
- "percentage": false,
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "repeat": null,
- "seriesOverrides": [],
- "spaceLength": 10,
- "span": 6,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "expr": "node_load1{job=\"node\", instance=\"$instance\"}",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "1m load average",
- "refId": "A"
- },
- {
- "expr": "node_load5{job=\"node\", instance=\"$instance\"}",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "5m load average",
- "refId": "B"
- },
- {
- "expr": "node_load15{job=\"node\", instance=\"$instance\"}",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "15m load average",
- "refId": "C"
- },
- {
- "expr": "count(node_cpu_seconds_total{job=\"node\", instance=\"$instance\", mode=\"idle\"})",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "logical cores",
- "refId": "D"
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeShift": null,
- "title": "Load Average",
- "tooltip": {
- "shared": true,
- "sort": 0,
- "value_type": "individual"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- },
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- }
- ]
- }
- ],
- "repeat": null,
- "repeatIteration": null,
- "repeatRowId": null,
- "showTitle": false,
- "title": "Dashboard Row",
- "titleSize": "h6",
- "type": "row"
- },
- {
- "collapse": false,
- "collapsed": false,
- "panels": [
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "fill": 1,
- "fillGradient": 0,
- "gridPos": {},
- "id": 4,
- "legend": {
- "alignAsTable": false,
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "rightSide": false,
- "show": true,
- "sideWidth": null,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "null",
- "percentage": false,
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "repeat": null,
- "seriesOverrides": [],
- "spaceLength": 10,
- "span": 9,
- "stack": true,
- "steppedLine": false,
- "targets": [
- {
- "expr": "(\n node_memory_MemTotal_bytes{job=\"node\", instance=\"$instance\"}\n-\n node_memory_MemFree_bytes{job=\"node\", instance=\"$instance\"}\n-\n node_memory_Buffers_bytes{job=\"node\", instance=\"$instance\"}\n-\n node_memory_Cached_bytes{job=\"node\", instance=\"$instance\"}\n)\n",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "memory used",
- "refId": "A"
- },
- {
- "expr": "node_memory_Buffers_bytes{job=\"node\", instance=\"$instance\"}",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "memory buffers",
- "refId": "B"
- },
- {
- "expr": "node_memory_Cached_bytes{job=\"node\", instance=\"$instance\"}",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "memory cached",
- "refId": "C"
- },
- {
- "expr": "node_memory_MemFree_bytes{job=\"node\", instance=\"$instance\"}",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "memory free",
- "refId": "D"
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeShift": null,
- "title": "Memory Usage",
- "tooltip": {
- "shared": true,
- "sort": 0,
- "value_type": "individual"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- },
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- }
- ]
- },
- {
- "cacheTimeout": null,
- "colorBackground": false,
- "colorValue": false,
- "colors": [
- "rgba(50, 172, 45, 0.97)",
- "rgba(237, 129, 40, 0.89)",
- "rgba(245, 54, 54, 0.9)"
- ],
- "datasource": "$datasource",
- "format": "percent",
- "gauge": {
- "maxValue": 100,
- "minValue": 0,
- "show": true,
- "thresholdLabels": false,
- "thresholdMarkers": true
- },
- "gridPos": {},
- "id": 5,
- "interval": null,
- "links": [],
- "mappingType": 1,
- "mappingTypes": [
- {
- "name": "value to text",
- "value": 1
- },
- {
- "name": "range to text",
- "value": 2
- }
- ],
- "maxDataPoints": 100,
- "nullPointMode": "connected",
- "nullText": null,
- "postfix": "",
- "postfixFontSize": "50%",
- "prefix": "",
- "prefixFontSize": "50%",
- "rangeMaps": [
- {
- "from": "null",
- "text": "N/A",
- "to": "null"
- }
- ],
- "span": 3,
- "sparkline": {
- "fillColor": "rgba(31, 118, 189, 0.18)",
- "full": false,
- "lineColor": "rgb(31, 120, 193)",
- "show": false
- },
- "tableColumn": "",
- "targets": [
- {
- "expr": "100 -\n(\n avg(node_memory_MemAvailable_bytes{job=\"node\", instance=\"$instance\"})\n/\n avg(node_memory_MemTotal_bytes{job=\"node\", instance=\"$instance\"})\n* 100\n)\n",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "",
- "refId": "A"
- }
- ],
- "thresholds": "80, 90",
- "title": "Memory Usage",
- "type": "singlestat",
- "valueFontSize": "80%",
- "valueMaps": [
- {
- "op": "=",
- "text": "N/A",
- "value": "null"
- }
- ],
- "valueName": "current"
- }
- ],
- "repeat": null,
- "repeatIteration": null,
- "repeatRowId": null,
- "showTitle": false,
- "title": "Dashboard Row",
- "titleSize": "h6",
- "type": "row"
- },
- {
- "collapse": false,
- "collapsed": false,
- "panels": [
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "fill": 0,
- "fillGradient": 0,
- "gridPos": {},
- "id": 6,
- "legend": {
- "alignAsTable": false,
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "rightSide": false,
- "show": true,
- "sideWidth": null,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "null",
- "percentage": false,
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "repeat": null,
- "seriesOverrides": [
- {
- "alias": "/ read| written/",
- "yaxis": 1
- },
- {
- "alias": "/ io time/",
- "yaxis": 2
- }
- ],
- "spaceLength": 10,
- "span": 6,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "expr": "rate(node_disk_read_bytes_total{job=\"node\", instance=\"$instance\", device!=\"\"}[$__interval])",
- "format": "time_series",
- "interval": "1m",
- "intervalFactor": 2,
- "legendFormat": "{{device}} read",
- "refId": "A"
- },
- {
- "expr": "rate(node_disk_written_bytes_total{job=\"node\", instance=\"$instance\", device!=\"\"}[$__interval])",
- "format": "time_series",
- "interval": "1m",
- "intervalFactor": 2,
- "legendFormat": "{{device}} written",
- "refId": "B"
- },
- {
- "expr": "rate(node_disk_io_time_seconds_total{job=\"node\", instance=\"$instance\", device!=\"\"}[$__interval])",
- "format": "time_series",
- "interval": "1m",
- "intervalFactor": 2,
- "legendFormat": "{{device}} io time",
- "refId": "C"
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeShift": null,
- "title": "Disk I/O",
- "tooltip": {
- "shared": true,
- "sort": 0,
- "value_type": "individual"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- },
- {
- "format": "s",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- }
- ]
- },
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "fill": 1,
- "fillGradient": 0,
- "gridPos": {},
- "id": 7,
- "legend": {
- "alignAsTable": false,
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "rightSide": false,
- "show": true,
- "sideWidth": null,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "null",
- "percentage": false,
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "repeat": null,
- "seriesOverrides": [
- {
- "alias": "used",
- "color": "#E0B400"
- },
- {
- "alias": "available",
- "color": "#73BF69"
- }
- ],
- "spaceLength": 10,
- "span": 6,
- "stack": true,
- "steppedLine": false,
- "targets": [
- {
- "expr": "sum(\n max by (device) (\n node_filesystem_size_bytes{job=\"node\", instance=\"$instance\", fstype!=\"\"}\n -\n node_filesystem_avail_bytes{job=\"node\", instance=\"$instance\", fstype!=\"\"}\n )\n)\n",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "used",
- "refId": "A"
- },
- {
- "expr": "sum(\n max by (device) (\n node_filesystem_avail_bytes{job=\"node\", instance=\"$instance\", fstype!=\"\"}\n )\n)\n",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "available",
- "refId": "B"
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeShift": null,
- "title": "Disk Space Usage",
- "tooltip": {
- "shared": true,
- "sort": 0,
- "value_type": "individual"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- },
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- }
- ]
- }
- ],
- "repeat": null,
- "repeatIteration": null,
- "repeatRowId": null,
- "showTitle": false,
- "title": "Dashboard Row",
- "titleSize": "h6",
- "type": "row"
- },
- {
- "collapse": false,
- "collapsed": false,
- "panels": [
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "fill": 0,
- "fillGradient": 0,
- "gridPos": {},
- "id": 8,
- "legend": {
- "alignAsTable": false,
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "rightSide": false,
- "show": true,
- "sideWidth": null,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "null",
- "percentage": false,
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "repeat": null,
- "seriesOverrides": [],
- "spaceLength": 10,
- "span": 6,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "expr": "rate(node_network_receive_bytes_total{job=\"node\", instance=\"$instance\", device!=\"lo\"}[$__interval])",
- "format": "time_series",
- "interval": "1m",
- "intervalFactor": 2,
- "legendFormat": "{{device}}",
- "refId": "A"
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeShift": null,
- "title": "Network Received",
- "tooltip": {
- "shared": true,
- "sort": 0,
- "value_type": "individual"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- },
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- }
- ]
- },
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "fill": 0,
- "fillGradient": 0,
- "gridPos": {},
- "id": 9,
- "legend": {
- "alignAsTable": false,
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "rightSide": false,
- "show": true,
- "sideWidth": null,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "null",
- "percentage": false,
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "repeat": null,
- "seriesOverrides": [],
- "spaceLength": 10,
- "span": 6,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "expr": "rate(node_network_transmit_bytes_total{job=\"node\", instance=\"$instance\", device!=\"lo\"}[$__interval])",
- "format": "time_series",
- "interval": "1m",
- "intervalFactor": 2,
- "legendFormat": "{{device}}",
- "refId": "A"
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeShift": null,
- "title": "Network Transmitted",
- "tooltip": {
- "shared": true,
- "sort": 0,
- "value_type": "individual"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- },
- {
- "format": "bytes",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- }
- ]
- }
- ],
- "repeat": null,
- "repeatIteration": null,
- "repeatRowId": null,
- "showTitle": false,
- "title": "Dashboard Row",
- "titleSize": "h6",
- "type": "row"
- }
- ],
- "schemaVersion": 14,
- "style": "dark",
- "tags": [],
- "templating": {
- "list": [
- {
- "current": {
- "text": "Prometheus",
- "value": "Prometheus"
- },
- "hide": 0,
- "label": null,
- "name": "datasource",
- "options": [],
- "query": "prometheus",
- "refresh": 1,
- "regex": "",
- "type": "datasource"
- },
- {
- "allValue": null,
- "current": {},
- "datasource": "$datasource",
- "hide": 0,
- "includeAll": false,
- "label": null,
- "multi": false,
- "name": "instance",
- "options": [],
- "query": "label_values(node_exporter_build_info{job=\"node\"}, instance)",
- "refresh": 2,
- "regex": "",
- "sort": 0,
- "tagValuesQuery": "",
- "tags": [],
- "tagsQuery": "",
- "type": "query",
- "useTags": false
- }
- ]
- },
- "time": {
- "from": "now-1h",
- "to": "now"
- },
- "timepicker": {
- "refresh_intervals": [
- "5s",
- "10s",
- "30s",
- "1m",
- "5m",
- "15m",
- "30m",
- "1h",
- "2h",
- "1d"
- ],
- "time_options": [
- "5m",
- "15m",
- "1h",
- "6h",
- "12h",
- "24h",
- "2d",
- "7d",
- "30d"
- ]
- },
- "timezone": "browser",
- "title": "Node Exporter Quickstart and Dashboard",
- "version": 0,
- "description": "A quickstart to setup Prometheus Node Exporter with preconfigured dashboards, alerting rules, and recording rules."
-}
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/configs/grafana/dashboards/postgresql.json b/1-monolith-architecture-style/deployments/configs/grafana/dashboards/postgresql.json
deleted file mode 100644
index d1d696f..0000000
--- a/1-monolith-architecture-style/deployments/configs/grafana/dashboards/postgresql.json
+++ /dev/null
@@ -1,1459 +0,0 @@
-{
- "__inputs": [],
- "__requires": [
- {
- "type": "grafana",
- "id": "grafana",
- "name": "Grafana",
- "version": "7.2.0"
- },
- {
- "type": "panel",
- "id": "graph",
- "name": "Graph",
- "version": ""
- },
- {
- "type": "datasource",
- "id": "prometheus",
- "name": "Prometheus",
- "version": "1.0.0"
- }
- ],
- "annotations": {
- "list": [
- {
- "builtIn": 1,
- "datasource": "-- Grafana --",
- "enable": true,
- "hide": true,
- "iconColor": "rgba(0, 211, 255, 1)",
- "name": "Annotations & Alerts",
- "type": "dashboard"
- }
- ]
- },
- "description": "A quickstart to setup the Prometheus PostgreSQL Exporter with preconfigured dashboards, alerting rules, and recording rules.",
- "editable": true,
- "gnetId": 14114,
- "graphTooltip": 0,
- "id": 1,
- "iteration": 1603191461722,
- "links": [],
- "panels": [
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "editable": true,
- "error": false,
- "fieldConfig": {
- "defaults": {
- "custom": {}
- },
- "overrides": []
- },
- "fill": 1,
- "fillGradient": 0,
- "grid": {},
- "gridPos": {
- "h": 7,
- "w": 20,
- "x": 0,
- "y": 0
- },
- "hiddenSeries": false,
- "id": 1,
- "isNew": true,
- "legend": {
- "alignAsTable": true,
- "avg": true,
- "current": false,
- "max": true,
- "min": true,
- "rightSide": true,
- "show": true,
- "total": false,
- "values": true
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "connected",
- "options": {
- "alertThreshold": true
- },
- "percentage": false,
- "pluginVersion": "7.2.1",
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "seriesOverrides": [],
- "spaceLength": 10,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "alias": "fetched",
- "dsType": "prometheus",
- "expr": "sum(irate(pg_stat_database_tup_fetched{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "fetched",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "A",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "tup_fetched"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [
- "10s"
- ],
- "type": "non_negative_derivative"
- }
- ]
- ],
- "step": 120,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "fetched",
- "dsType": "prometheus",
- "expr": "sum(irate(pg_stat_database_tup_returned{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "returned",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "B",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "tup_fetched"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [
- "10s"
- ],
- "type": "non_negative_derivative"
- }
- ]
- ],
- "step": 120,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "fetched",
- "dsType": "prometheus",
- "expr": "sum(irate(pg_stat_database_tup_inserted{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "inserted",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "C",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "tup_fetched"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [
- "10s"
- ],
- "type": "non_negative_derivative"
- }
- ]
- ],
- "step": 120,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "fetched",
- "dsType": "prometheus",
- "expr": "sum(irate(pg_stat_database_tup_updated{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "updated",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "D",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "tup_fetched"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [
- "10s"
- ],
- "type": "non_negative_derivative"
- }
- ]
- ],
- "step": 120,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "fetched",
- "dsType": "prometheus",
- "expr": "sum(irate(pg_stat_database_tup_deleted{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "deleted",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "E",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "tup_fetched"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [
- "10s"
- ],
- "type": "non_negative_derivative"
- }
- ]
- ],
- "step": 120,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeRegions": [],
- "timeShift": null,
- "title": "Rows",
- "tooltip": {
- "msResolution": true,
- "shared": true,
- "sort": 0,
- "value_type": "cumulative"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- },
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- }
- ],
- "yaxis": {
- "align": false,
- "alignLevel": null
- }
- },
- {
- "cacheTimeout": null,
- "colorBackground": false,
- "colorValue": false,
- "colors": [
- "rgba(245, 54, 54, 0.9)",
- "rgba(237, 129, 40, 0.89)",
- "rgba(50, 172, 45, 0.97)"
- ],
- "datasource": "$datasource",
- "decimals": 0,
- "editable": true,
- "error": false,
- "fieldConfig": {
- "defaults": {
- "custom": {}
- },
- "overrides": []
- },
- "format": "none",
- "gauge": {
- "maxValue": 100,
- "minValue": 0,
- "show": false,
- "thresholdLabels": false,
- "thresholdMarkers": true
- },
- "gridPos": {
- "h": 3,
- "w": 4,
- "x": 20,
- "y": 0
- },
- "height": "55px",
- "id": 11,
- "interval": null,
- "isNew": true,
- "links": [],
- "mappingType": 1,
- "mappingTypes": [
- {
- "name": "value to text",
- "value": 1
- },
- {
- "name": "range to text",
- "value": 2
- }
- ],
- "maxDataPoints": 100,
- "nullPointMode": "connected",
- "nullText": null,
- "postfix": "",
- "postfixFontSize": "50%",
- "prefix": "",
- "prefixFontSize": "50%",
- "rangeMaps": [
- {
- "from": "null",
- "text": "N/A",
- "to": "null"
- }
- ],
- "sparkline": {
- "fillColor": "rgba(31, 118, 189, 0.18)",
- "full": true,
- "lineColor": "rgb(31, 120, 193)",
- "show": true
- },
- "tableColumn": "",
- "targets": [
- {
- "dsType": "prometheus",
- "expr": "sum(irate(pg_stat_database_xact_commit{datname=~\"$db\",instance=~\"$instance\"}[5m])) + sum(irate(pg_stat_database_xact_rollback{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "measurement": "postgresql",
- "policy": "default",
- "refId": "A",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "xact_commit"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [
- "10s"
- ],
- "type": "non_negative_derivative"
- }
- ]
- ],
- "step": 1800,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- }
- ],
- "thresholds": "",
- "title": "QPS",
- "transparent": true,
- "type": "singlestat",
- "valueFontSize": "80%",
- "valueMaps": [
- {
- "op": "=",
- "text": "N/A",
- "value": "null"
- }
- ],
- "valueName": "avg"
- },
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "decimals": 1,
- "editable": true,
- "error": false,
- "fieldConfig": {
- "defaults": {
- "custom": {}
- },
- "overrides": []
- },
- "fill": 1,
- "fillGradient": 0,
- "grid": {},
- "gridPos": {
- "h": 7,
- "w": 12,
- "x": 0,
- "y": 7
- },
- "hiddenSeries": false,
- "id": 2,
- "isNew": true,
- "legend": {
- "alignAsTable": true,
- "avg": true,
- "current": false,
- "hideZero": true,
- "max": true,
- "min": true,
- "rightSide": false,
- "show": true,
- "total": false,
- "values": true
- },
- "lines": true,
- "linewidth": 1,
- "links": [],
- "nullPointMode": "connected",
- "options": {
- "alertThreshold": true
- },
- "percentage": false,
- "pluginVersion": "7.2.1",
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "seriesOverrides": [],
- "spaceLength": 10,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "alias": "Buffers Allocated",
- "dsType": "prometheus",
- "expr": "irate(pg_stat_bgwriter_buffers_alloc{instance=~'$instance'}[5m])",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "buffers_alloc",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "A",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "buffers_alloc"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [],
- "type": "difference"
- }
- ]
- ],
- "step": 240,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "Buffers Allocated",
- "dsType": "prometheus",
- "expr": "irate(pg_stat_bgwriter_buffers_backend_fsync{instance=~'$instance'}[5m])",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "buffers_backend_fsync",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "B",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "buffers_alloc"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [],
- "type": "difference"
- }
- ]
- ],
- "step": 240,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "Buffers Allocated",
- "dsType": "prometheus",
- "expr": "irate(pg_stat_bgwriter_buffers_backend{instance=~'$instance'}[5m])",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "buffers_backend",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "C",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "buffers_alloc"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [],
- "type": "difference"
- }
- ]
- ],
- "step": 240,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "Buffers Allocated",
- "dsType": "prometheus",
- "expr": "irate(pg_stat_bgwriter_buffers_clean{instance=~'$instance'}[5m])",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "buffers_clean",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "D",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "buffers_alloc"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [],
- "type": "difference"
- }
- ]
- ],
- "step": 240,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "Buffers Allocated",
- "dsType": "prometheus",
- "expr": "irate(pg_stat_bgwriter_buffers_checkpoint{instance=~'$instance'}[5m])",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "buffers_checkpoint",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "E",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "buffers_alloc"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [],
- "type": "difference"
- }
- ]
- ],
- "step": 240,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeRegions": [],
- "timeShift": null,
- "title": "Buffers",
- "tooltip": {
- "msResolution": false,
- "shared": true,
- "sort": 0,
- "value_type": "cumulative"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- },
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- }
- ],
- "yaxis": {
- "align": false,
- "alignLevel": null
- }
- },
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "editable": true,
- "error": false,
- "fieldConfig": {
- "defaults": {
- "custom": {}
- },
- "overrides": []
- },
- "fill": 1,
- "fillGradient": 0,
- "grid": {},
- "gridPos": {
- "h": 7,
- "w": 12,
- "x": 12,
- "y": 7
- },
- "hiddenSeries": false,
- "id": 3,
- "isNew": true,
- "legend": {
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "show": true,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 2,
- "links": [],
- "nullPointMode": "connected",
- "options": {
- "alertThreshold": true
- },
- "percentage": false,
- "pluginVersion": "7.2.1",
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "seriesOverrides": [],
- "spaceLength": 10,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "alias": "conflicts",
- "dsType": "prometheus",
- "expr": "sum(rate(pg_stat_database_deadlocks{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "deadlocks",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "A",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "conflicts"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [],
- "type": "difference"
- }
- ]
- ],
- "step": 240,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- },
- {
- "alias": "deadlocks",
- "dsType": "prometheus",
- "expr": "sum(rate(pg_stat_database_conflicts{datname=~\"$db\",instance=~\"$instance\"}[5m]))",
- "format": "time_series",
- "groupBy": [
- {
- "params": [
- "$interval"
- ],
- "type": "time"
- },
- {
- "params": [
- "null"
- ],
- "type": "fill"
- }
- ],
- "intervalFactor": 2,
- "legendFormat": "conflicts",
- "measurement": "postgresql",
- "policy": "default",
- "refId": "B",
- "resultFormat": "time_series",
- "select": [
- [
- {
- "params": [
- "deadlocks"
- ],
- "type": "field"
- },
- {
- "params": [],
- "type": "mean"
- },
- {
- "params": [],
- "type": "difference"
- }
- ]
- ],
- "step": 240,
- "tags": [
- {
- "key": "instance",
- "operator": "=~",
- "value": "/^$instance$/"
- }
- ]
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeRegions": [],
- "timeShift": null,
- "title": "Conflicts/Deadlocks",
- "tooltip": {
- "msResolution": false,
- "shared": true,
- "sort": 0,
- "value_type": "cumulative"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": 0,
- "show": true
- },
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- }
- ],
- "yaxis": {
- "align": false,
- "alignLevel": null
- }
- },
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "editable": true,
- "error": false,
- "fieldConfig": {
- "defaults": {
- "custom": {}
- },
- "overrides": []
- },
- "fill": 1,
- "fillGradient": 0,
- "grid": {},
- "gridPos": {
- "h": 7,
- "w": 12,
- "x": 0,
- "y": 14
- },
- "hiddenSeries": false,
- "id": 12,
- "isNew": true,
- "legend": {
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "show": true,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 2,
- "links": [],
- "nullPointMode": "connected",
- "options": {
- "alertThreshold": true
- },
- "percentage": true,
- "pluginVersion": "7.2.1",
- "pointradius": 1,
- "points": false,
- "renderer": "flot",
- "seriesOverrides": [],
- "spaceLength": 10,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "expr": "sum(pg_stat_database_blks_hit{datname=~\"$db\",instance=~\"$instance\"}) / (sum(pg_stat_database_blks_hit{datname=~\"$db\",instance=~\"$instance\"}) + sum(pg_stat_database_blks_read{datname=~\"$db\",instance=~\"$instance\"}))",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "cache hit rate",
- "refId": "A",
- "step": 240
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeRegions": [],
- "timeShift": null,
- "title": "Cache hit ratio",
- "tooltip": {
- "msResolution": false,
- "shared": true,
- "sort": 0,
- "value_type": "cumulative"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "percentunit",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- },
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- }
- ],
- "yaxis": {
- "align": false,
- "alignLevel": null
- }
- },
- {
- "aliasColors": {},
- "bars": false,
- "dashLength": 10,
- "dashes": false,
- "datasource": "$datasource",
- "editable": true,
- "error": false,
- "fieldConfig": {
- "defaults": {
- "custom": {}
- },
- "overrides": []
- },
- "fill": 1,
- "fillGradient": 0,
- "grid": {},
- "gridPos": {
- "h": 7,
- "w": 12,
- "x": 12,
- "y": 14
- },
- "hiddenSeries": false,
- "id": 13,
- "isNew": true,
- "legend": {
- "avg": false,
- "current": false,
- "max": false,
- "min": false,
- "show": true,
- "total": false,
- "values": false
- },
- "lines": true,
- "linewidth": 2,
- "links": [],
- "nullPointMode": "connected",
- "options": {
- "alertThreshold": true
- },
- "percentage": false,
- "pluginVersion": "7.2.1",
- "pointradius": 5,
- "points": false,
- "renderer": "flot",
- "seriesOverrides": [],
- "spaceLength": 10,
- "stack": false,
- "steppedLine": false,
- "targets": [
- {
- "expr": "pg_stat_database_numbackends{datname=~\"$db\",instance=~\"$instance\"}",
- "format": "time_series",
- "intervalFactor": 2,
- "legendFormat": "{{__name__}}",
- "refId": "A",
- "step": 240
- }
- ],
- "thresholds": [],
- "timeFrom": null,
- "timeRegions": [],
- "timeShift": null,
- "title": "Number of active connections",
- "tooltip": {
- "msResolution": false,
- "shared": true,
- "sort": 0,
- "value_type": "cumulative"
- },
- "type": "graph",
- "xaxis": {
- "buckets": null,
- "mode": "time",
- "name": null,
- "show": true,
- "values": []
- },
- "yaxes": [
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- },
- {
- "format": "short",
- "label": null,
- "logBase": 1,
- "max": null,
- "min": null,
- "show": true
- }
- ],
- "yaxis": {
- "align": false,
- "alignLevel": null
- }
- }
- ],
- "refresh": false,
- "schemaVersion": 26,
- "style": "dark",
- "tags": [
- "postgres"
- ],
- "templating": {
- "list": [
- {
- "allValue": ".*",
- "current": {
- "selected": false,
- "text": "All",
- "value": "$__all"
- },
- "datasource": "$datasource",
- "definition": "",
- "hide": 0,
- "includeAll": true,
- "label": null,
- "multi": false,
- "name": "instance",
- "options": [],
- "query": "label_values(up{job=~\"postgres.*\"},instance)",
- "refresh": 1,
- "regex": "",
- "skipUrlSync": false,
- "sort": 0,
- "tagValuesQuery": "",
- "tags": [],
- "tagsQuery": "",
- "type": "query",
- "useTags": false
- },
- {
- "allValue": ".*",
- "current": {
- "selected": false,
- "text": "All",
- "value": "$__all"
- },
- "datasource": "$datasource",
- "definition": "label_values(pg_stat_database_tup_fetched{instance=~\"$instance\",datname!~\"template.*|postgres\"},datname)",
- "hide": 0,
- "includeAll": true,
- "label": "db",
- "multi": false,
- "name": "db",
- "options": [],
- "query": "label_values(pg_stat_database_tup_fetched{instance=~\"$instance\",datname!~\"template.*|postgres\"},datname)",
- "refresh": 1,
- "regex": "",
- "skipUrlSync": false,
- "sort": 0,
- "tagValuesQuery": "",
- "tags": [],
- "tagsQuery": "",
- "type": "query",
- "useTags": false
- },
- {
- "current": {
- "selected": false,
- "text": "Postgres Overview",
- "value": "Postgres Overview"
- },
- "hide": 0,
- "includeAll": false,
- "label": "datasource",
- "multi": false,
- "name": "datasource",
- "options": [],
- "query": "prometheus",
- "refresh": 1,
- "regex": "",
- "skipUrlSync": false,
- "type": "datasource"
- },
- {
- "allValue": null,
- "current": {
- "selected": true,
- "text": "postgres",
- "value": "postgres"
- },
- "datasource": "$datasource",
- "definition": "label_values(pg_up, job)",
- "hide": 0,
- "includeAll": false,
- "label": "job",
- "multi": false,
- "name": "job",
- "options": [
- {
- "selected": true,
- "text": "postgres",
- "value": "postgres"
- }
- ],
- "query": "label_values(pg_up, job)",
- "refresh": 0,
- "regex": "",
- "skipUrlSync": false,
- "sort": 0,
- "tagValuesQuery": "",
- "tags": [],
- "tagsQuery": "",
- "type": "query",
- "useTags": false
- }
- ]
- },
- "time": {
- "from": "now-1h",
- "to": "now"
- },
- "timepicker": {
- "refresh_intervals": [
- "5s",
- "10s",
- "30s",
- "1m",
- "5m",
- "15m",
- "30m",
- "1h",
- "2h",
- "1d"
- ],
- "time_options": [
- "5m",
- "15m",
- "1h",
- "6h",
- "12h",
- "24h",
- "2d",
- "7d",
- "30d"
- ]
- },
- "timezone": "browser",
- "title": "PostgreSQL Exporter Quickstart and Dashboard",
- "uid": "wGgaPlciz",
- "version": 5
-}
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/configs/grafana/provisioning/dashboards/dashboard.yml b/1-monolith-architecture-style/deployments/configs/grafana/provisioning/dashboards/dashboard.yml
deleted file mode 100644
index f1fb0bb..0000000
--- a/1-monolith-architecture-style/deployments/configs/grafana/provisioning/dashboards/dashboard.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-# https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards
-apiVersion: 1
-
-providers:
- - name: "default"
- orgId: 1
- folder: ""
- type: file
- disableDeletion: false
- editable: true
- allowUiUpdates: true
- updateIntervalSeconds: 5 # how often Grafana will scan for changed dashboards
- options:
- path: /var/lib/grafana/dashboards # path to dashboards on disk
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/configs/grafana/provisioning/datasources/datasource.yml b/1-monolith-architecture-style/deployments/configs/grafana/provisioning/datasources/datasource.yml
deleted file mode 100644
index 5b04359..0000000
--- a/1-monolith-architecture-style/deployments/configs/grafana/provisioning/datasources/datasource.yml
+++ /dev/null
@@ -1,88 +0,0 @@
-# https://grafana.com/docs/grafana/latest/administration/provisioning/
-# https://github.com/grafana/tempo/blob/main/example/docker-compose/shared/grafana-datasources.yaml
-# https://github.com/grafana/intro-to-mltp/blob/main/grafana/provisioning/datasources/datasources.yaml
-
-apiVersion: 1
-
-datasources:
- # https://github.com/grafana/tempo/blob/main/example/docker-compose/shared/grafana-datasources.yaml
- - name: Prometheus
- type: prometheus
- typeName: Prometheus
- uid: prometheus-uid
- access: proxy
- orgId: 1
- url: http://prometheus:9090
- basicAuth: false
- isDefault: true
- readOnly: false
- user: ''
- database: ''
- version: 1
- editable: false
- jsonData:
- httpMethod: GET
-
- - name: Jaeger
- type: jaeger
- access: proxy
- url: http://jaeger-all-in-one:16686
- editable: false
- uid: jaeger-uid
-
- - name: Zipkin
- type: zipkin
- access: proxy
- url: http://zipkin-all-in-one:9411
- editable: false
- uid: zipkin-uid
-
- # https://github.com/grafana/tempo/blob/main/example/docker-compose/shared/grafana-datasources.yaml
- - name: Tempo
- type: tempo
- access: proxy
- orgId: 1
- url: http://tempo:3200
- basicAuth: false
- isDefault: false
- version: 1
- editable: false
- apiVersion: 1
- uid: tempo-uid
- jsonData:
- httpMethod: GET
- serviceMap:
- datasourceUid: prometheus-uid
- streamingEnabled:
- search: true
-
- #https://github.com/grafana/intro-to-mltp/blob/main/grafana/provisioning/datasources/datasources.yaml
- - name: Loki
- type: loki
- access: proxy
- uid: loki-uid
- url: http://loki:3100
- user: ''
- database: ''
- readOnly: false
- jsonData:
- derivedFields:
- - datasourceUid: tempo-uid
- matcherRegex: "^.*?traceI[d|D]=(\\w+).*$"
- name: traceId
- url: '$${__value.raw}'
-
- - name: Kibana
- type: elasticsearch
- url: http://elasticsearch:9200
- access: proxy
- isDefault: false
- uid: kibana-uid
- jsonData:
- esVersion: 7
- timeField: "@timestamp"
- maxConcurrentShardRequests: 256
- interval: Daily
- logMessageField: "message" # Optional: Field for log messages
- logLevelField: "level" # Optional: Field for log levels
- editable: true
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/configs/otel-collector-config.yaml b/1-monolith-architecture-style/deployments/configs/otel-collector-config.yaml
deleted file mode 100644
index ea6ef40..0000000
--- a/1-monolith-architecture-style/deployments/configs/otel-collector-config.yaml
+++ /dev/null
@@ -1,131 +0,0 @@
-# ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/examples/demo/otel-collector-config.yaml
-# https://opentelemetry.io/docs/collector/configuration/
-# https://opentelemetry.io/docs/collector/architecture/
-# https://betterstack.com/community/guides/observability/opentelemetry-collector/
-# https://signoz.io/blog/opentelemetry-collector-complete-guide/
-
-# This configuration sets up an OpenTelemetry Collector that receives trace data via the OTLP protocol over HTTP on port 4318, applies batch processing, and then exports the processed traces
-# to exporter components like `Jaeger` endpoint located at `jaeger-all-in-one:4317`. It also includes a health_check extension for monitoring the collector's status.
-
-# Receivers in the OpenTelemetry Collector are components that collect telemetry data (traces, metrics, and logs) from various sources, such as instrumented applications or agents.
-# They act as entry points, converting incoming data into OpenTelemetry's internal format for processing and export.
-# https://betterstack.com/community/guides/observability/opentelemetry-collector/#exploring-the-opentelemetry-collector-components
-# https://opentelemetry.io/docs/collector/architecture/#receivers
-# https://github.com/open-telemetry/opentelemetry-collector/blob/main/receiver/README.md
-# https://opentelemetry.io/docs/collector/configuration/#receivers
-receivers:
- # supported receivers
- # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver
- # instead of specifying details explicitly we can just use `otlp` and it uses both grpc and http
- otlp:
- protocols:
- grpc:
- endpoint: 0.0.0.0:4317
- http:
- endpoint: 0.0.0.0:4318
-# prometheus:
-# config:
-# scrape_configs:
-# - job_name: 'node-exporter'
-# scrape_interval: 10s
-# static_configs:
-# - targets: [ 'node-exporter:9100' ]
-
-
-# Processors in the OpenTelemetry Collector modify and enhance telemetry data by filtering, transforming, enriching, or batching it to prepare it for export.
-# https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor
-processors:
- batch: # Batches logs for better performance
-
-# - Exporters in the OpenTelemetry Collector send processed telemetry data to backend systems like observability platforms, databases, or cloud services for storage, visualization, and analysis.
-# - The `key` follows the `type/name` format, where `type` specifies the exporter `type` (e.g., otlp, kafka, prometheus), and `name` (optional) can be appended to provide a unique name for multiple instance of the same type
-# https://betterstack.com/community/guides/observability/opentelemetry-collector/#exploring-the-opentelemetry-collector-components
-# https://opentelemetry.io/docs/collector/architecture/#exporters
-# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter
-# https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter
-# https://opentelemetry.io/docs/collector/configuration/#exporters
-exporters:
-
- # valid values: [prometheusremotewrite zipkin otlphttp file kafka prometheus debug nop otlp opencensus]
-
- # Prometheus exporter metrics
- prometheus:
- endpoint: "0.0.0.0:8889"
-
- prometheusremotewrite:
- endpoint: "http://prometheus:9090/api/v1/write"
-
- # https://grafana.com/docs/loki/latest/send-data/otel/
- # https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/lokiexporter/README.md
- otlphttp/loki:
- endpoint: "http://loki:3100/otlp"
- tls:
- insecure: true
-
- # # we can also use `loki component` from `opentelemetry-collector-contrib` if we don't want to use builtin `otlphttp` exporter type and `http://loki:3100/otlp` loki endpoint
- # loki:
- # endpoint: "http://loki:3100/loki/api/v1/push"
- # tls:
- # insecure: true
-
- debug:
-
- # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/elasticsearchexporter
- # using `elasticsearch` from `opentelemetry-collector-contrib` components because it doesn't exist in `opentelemetry-collector`
- elasticsearch:
- endpoint: "http://elasticsearch:9200"
-
- zipkin:
- endpoint: "http://zipkin-all-in-one:9411/api/v2/spans"
- format: proto
-
- # export collected telemetry traces to jaeger OTLP grpc port, we can send data to other available endpoints and ports on jaeger as well
- otlp/jaeger:
- endpoint: "http://jaeger-all-in-one:4317"
- tls:
- insecure: true
-
- otlp/tempo:
- endpoint: "http://tempo:4317"
- tls:
- insecure: true
-
- # seq-otlp:
- # endpoint: "http://seq:5341/ingest/otlp"
-
-# https://opentelemetry.io/docs/collector/configuration/#extensions
-# https://github.com/open-telemetry/opentelemetry-collector/blob/main/extension/README.md
-extensions:
- pprof:
- endpoint: 0.0.0.0:1888
- zpages:
- endpoint: 0.0.0.0:55679
- health_check:
- endpoint: 0.0.0.0:13133
-
-# - The service section is used to configure what components are enabled in the Collector based on the configuration found in the receivers, processors, exporters, and extensions sections.
-# - If a component is configured, but not defined within the service section, then it’s not enabled.
-# https://betterstack.com/community/guides/observability/opentelemetry-collector/#exploring-the-opentelemetry-collector-components
-# https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/README.md
-# https://opentelemetry.io/docs/collector/architecture/
-# https://opentelemetry.io/docs/collector/configuration/#service
-service:
- # The `service.extensions` subsection determines which of the configured extensions will be enabled
- extensions: [pprof, zpages, health_check]
- # The `service.pipeline` Each pipeline starts with one or more receivers collecting data, which is then processed sequentially by processors (applying transformations, filtering, or sampling).
- # The processed data is finally sent to all configured exporters, ensuring each receives a copy. Components must be pre-configured in their respective sections before being used in a pipeline.
- # pipeline activate predefined components, defined components are disabled by default
- pipelines:
- traces:
- receivers: [otlp]
- processors: [batch]
- # https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#exporter-selection
- exporters: [debug, zipkin, otlp/jaeger, otlp/tempo]
- metrics:
- receivers: [otlp]
- processors: [batch]
- exporters: [debug, prometheusremotewrite, prometheus]
- logs:
- receivers: [otlp]
- processors: [batch]
- exporters: [otlphttp/loki, elasticsearch]
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/configs/prometheus.yaml b/1-monolith-architecture-style/deployments/configs/prometheus.yaml
deleted file mode 100644
index 1928aaf..0000000
--- a/1-monolith-architecture-style/deployments/configs/prometheus.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
-# ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/examples/demo/prometheus.yaml
-# https://prometheus.io/docs/introduction/first_steps/
-# https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
-
-global:
- scrape_interval: 5s
-
-scrape_configs:
- # when we use otel-collector we should comment other jobs in prometheus config, and we read configs from `otel-collector-config`
- - job_name: "otel-collector"
- scrape_interval: 10s
- static_configs:
- # otel-collector Prometheus exporter metrics
- - targets: [ 'otel-collector:8889' ]
- - targets: [ 'otel-collector:8888' ]
-
- - job_name: "prometheus"
- static_configs:
- - targets: ["prometheus:9090"]
-
-# # https://prometheus.io/docs/guides/node-exporter/
-# # https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
-# - job_name: "node-exporter"
-# static_configs:
-# - targets: [ 'node-exporter:9100' ]
-
-# # if we don't use otel collector we should uncomment this
-# # scrap application metrics
-# # http://localhost:4000/metrics by AddPrometheusExporter()
-# - job_name: vertical-slice-template-api
-# scrape_interval: 10s
-# metrics_path: /metrics
-# static_configs:
-# - targets: ['host.docker.internal:4000']
-#
-# # if we don't use otel collector we should uncomment this
-# # scrap application health metrics
-# # http://localhost:4000/health/metrics by AddPrometheusExporter()
-# - job_name: vertical-slice-template-api-healthchecks
-# scrape_interval: 10s
-# metrics_path: /health/metrics
-# static_configs:
-# - targets: ['host.docker.internal:4000']
-
-## https://github.com/grafana/tempo/blob/main/example/docker-compose/shared/prometheus.yaml
-# - job_name: 'tempo'
-# static_configs:
-# - targets: [ 'tempo:3200' ]
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/configs/tempo.yaml b/1-monolith-architecture-style/deployments/configs/tempo.yaml
deleted file mode 100644
index fcb2ed3..0000000
--- a/1-monolith-architecture-style/deployments/configs/tempo.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
-# https://grafana.com/docs/tempo/latest/configuration/
-# https://github.com/grafana/tempo/blob/main/example/docker-compose/local/tempo.yaml
-
-# https://github.com/grafana/tempo/blob/main/example/docker-compose/shared/tempo.yaml
-stream_over_http_enabled: true
-server:
- http_listen_port: 3200
- log_level: info
-
-distributor:
- receivers:
- otlp:
- protocols:
- grpc:
- endpoint: "tempo:4317"
-
-ingester:
- max_block_duration: 5m # cut the headblock when this much time passes. this is being set for demo purposes and should probably be left alone normally
-
-compactor:
- compaction:
- block_retention: 1h # overall Tempo trace retention. set for demo purposes
-
-metrics_generator:
- registry:
- external_labels:
- source: tempo
- cluster: docker-compose
- storage:
- path: /var/tempo/generator/wal
- remote_write:
- - url: http://prometheus:9090/api/v1/write
- send_exemplars: true
- traces_storage:
- path: /var/tempo/generator/traces
-
-storage:
- trace:
- backend: local # backend configuration to use
- wal:
- path: /var/tempo/wal # where to store the wal locally
- local:
- path: /var/tempo/blocks
-
-overrides:
- defaults:
- metrics_generator:
- processors: [service-graphs, span-metrics, local-blocks] # enables metrics generator
- generate_native_histograms: both
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/docker-compose/docker-compose.infrastructure.yaml b/1-monolith-architecture-style/deployments/docker-compose/docker-compose.infrastructure.yaml
deleted file mode 100644
index e93ae59..0000000
--- a/1-monolith-architecture-style/deployments/docker-compose/docker-compose.infrastructure.yaml
+++ /dev/null
@@ -1,361 +0,0 @@
-# ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/examples/demo/docker-compose.yaml
-# ref: https://github.com/joaofbantunes/DotNetMicroservicesObservabilitySample/blob/main/docker-compose.yml
-# ref: https://github.com/oskardudycz/EventSourcing.NetCore/blob/main/docker-compose.yml
-# https://github.com/grafana/intro-to-mltp
-# https://stackoverflow.com/questions/65272764/ports-are-not-available-listen-tcp-0-0-0-0-50070-bind-an-attempt-was-made-to
-
-
-name: booking-monolith-infrastructure
-
-services:
- #######################################################
- # rabbitmq
- #######################################################
- rabbitmq:
- image: rabbitmq:management
- container_name: rabbitmq
- restart: unless-stopped
- ports:
- - "5672:5672"
- - "15672:15672"
- # volumes:
- # - rabbitmq:/var/lib/rabbitmq
- networks:
- - infrastructure
-
- #######################################################
- # postgres
- #######################################################
- postgres:
- image: postgres:latest
- container_name: postgres
- restart: unless-stopped
- ports:
- - '5432:5432'
- environment:
- - POSTGRES_USER=postgres
- - POSTGRES_PASSWORD=postgres
- command:
- - "postgres"
- - "-c"
- - "wal_level=logical"
- - "-c"
- - "max_prepared_transactions=10"
- volumes:
- - postgres-data:/var/lib/postgresql/data
- networks:
- - infrastructure
-
-
- #######################################################
- # EventStoreDB
- #######################################################
- eventstore:
- container_name: eventstore
- image: eventstore/eventstore:latest
- restart: unless-stopped
- environment:
- - EVENTSTORE_CLUSTER_SIZE=1
- - EVENTSTORE_RUN_PROJECTIONS=All
- - EVENTSTORE_START_STANDARD_PROJECTIONS=True
- - EVENTSTORE_HTTP_PORT=2113
- - EVENTSTORE_INSECURE=True
- - EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=True
- ports:
- - "2113:2113"
- networks:
- - infrastructure
-
-
- # #######################################################
- # # Mongo
- # #######################################################
- mongo:
- image: mongo:latest
- container_name: mongo
- restart: unless-stopped
- # environment:
- # - MONGO_INITDB_ROOT_USERNAME=root
- # - MONGO_INITDB_ROOT_PASSWORD=secret
- ports:
- - 27017:27017
- networks:
- - infrastructure
-
-
- # #######################################################
- # # Redis
- # #######################################################
- redis:
- image: redis
- container_name: redis
- restart: unless-stopped
- ports:
- - 6379:6379
- networks:
- - infrastructure
-
-
- # #######################################################
- # # jaeger
- # # https://www.jaegertracing.io/docs/1.64/deployment/
- # # https://www.jaegertracing.io/docs/1.6/deployment/
- # #######################################################
- jaeger-all-in-one:
- image: jaegertracing/all-in-one:latest
- container_name: jaeger-all-in-one
- restart: unless-stopped
- ports:
- - "6831:6831/udp" # UDP port for Jaeger agent
- - "16686:16686" # endpoints and Jaeger UI
- - "14268:14268" # HTTP port for accept trace spans directly from clients
- - "14317:4317" # OTLP gRPC receiver for jaeger
- - "14318:4318" # OTLP http receiver for jaeger
- # - "9411" # Accepts Zipkin spans - /api/v2/spans
- networks:
- - infrastructure
-
-
- # #######################################################
- # # zipkin
- # # https://zipkin.io/pages/quickstart
- # #######################################################
- zipkin-all-in-one:
- image: openzipkin/zipkin:latest
- container_name: zipkin-all-in-one
- restart: unless-stopped
- ports:
- - "9411:9411"
- networks:
- - infrastructure
-
-
- # #######################################################
- # # otel-collector
- # # https://opentelemetry.io/docs/collector/installation/
- # # https://github.com/open-telemetry/opentelemetry-collector
- # # https://github.com/open-telemetry/opentelemetry-collector-contrib
- # # we can use none contrib docker `otel/opentelemetry-collector` version from `https://github.com/open-telemetry/opentelemetry-collector` repository but,
- # # if we need more components like `elasticsearch` we should use `otel/opentelemetry-collector-contrib` image of `https://github.com/open-telemetry/opentelemetry-collector-contrib` repository.
- # #######################################################
- otel-collector:
- image: otel/opentelemetry-collector-contrib:latest
- container_name: otel-collector
- restart: unless-stopped
- command: ["--config=/etc/otelcol-contrib/config.yaml"]
- volumes:
- - ./../configs/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
- ports:
- - "11888:1888" # pprof extension
- - "8888:8888" # Prometheus metrics exposed by the Collector
- - "8889:8889" # Prometheus exporter metrics
- - "13133:13133" # health_check extension
- - "4317:4317" # OTLP gRPC receiver
- - "4318:4318" # OTLP http receiver
- - "55679:55679" # zpages extension
- networks:
- - infrastructure
-
-
- # #######################################################
- # # prometheus
- # # https://prometheus.io/docs/introduction/first_steps/
- # # https://prometheus.io/docs/prometheus/3.1/installation/
- # # https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
- # #######################################################
- prometheus:
- image: prom/prometheus:latest
- restart: unless-stopped
- ports:
- - "9090:9090"
- volumes:
- - ./../configs/prometheus.yaml:/etc/prometheus/prometheus.yml
- # to passe one flag, such as "--log.level=debug" or "--web.enable-remote-write-receiver", we need to override the whole command, as we can't just pass one extra argument
- command:
- - "--config.file=/etc/prometheus/prometheus.yml"
- - "--storage.tsdb.path=/prometheus"
- - "--web.console.libraries=/usr/share/prometheus/console_libraries"
- - "--web.console.templates=/usr/share/prometheus/consoles"
- # need this for the OpenTelemetry collector to be able to put metrics into Prometheus
- - "--web.enable-remote-write-receiver"
- # - "--log.level=debug"
- networks:
- - infrastructure
-
-
- # #######################################################
- # # node-exporter
- # # https://prometheus.io/docs/guides/node-exporter/
- # # https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
- # #######################################################
- node-exporter:
- image: prom/node-exporter:latest
- container_name: node-exporter
- restart: unless-stopped
- volumes:
- - /proc:/host/proc:ro
- - /sys:/host/sys:ro
- - /:/rootfs:ro
- command:
- - '--path.procfs=/host/proc'
- - '--path.rootfs=/rootfs'
- - '--path.sysfs=/host/sys'
- ports:
- - "9101:9100"
- networks:
- - infrastructure
-
-
- # #######################################################
- # # grafana
- # # https://grafana.com/docs/grafana/latest/administration/provisioning/
- # # https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/
- # # https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/
- # # https://github.com/grafana/intro-to-mltp/blob/main/grafana/provisioning/datasources/datasources.yaml
- # #######################################################
- grafana:
- image: grafana/grafana:latest
- container_name: grafana
- restart: unless-stopped
- environment:
- - GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
- - GF_SECURITY_ADMIN_USER=admin
- - GF_SECURITY_ADMIN_PASSWORD=admin
- - GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
- # - GF_AUTH_ANONYMOUS_ENABLED=true
- # - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- # - GF_AUTH_DISABLE_LOGIN_FORM=true
- depends_on:
- - prometheus
- ports:
- - "3000:3000"
- volumes:
- - ./../configs/grafana/provisioning:/etc/grafana/provisioning
- - ./../configs/grafana/dashboards:/var/lib/grafana/dashboards
- ## https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/
- # - ./../configs/grafana/grafana.ini:/etc/grafana/grafana.ini
- networks:
- - infrastructure
-
-
- # #######################################################
- # # tempo
- # # https://github.com/grafana/tempo/blob/main/example/docker-compose/otel-collector/docker-compose.yaml
- # # https://github.com/grafana/tempo/blob/main/example/docker-compose/shared
- # # https://github.com/grafana/tempo/blob/main/example/docker-compose/local
- # # https://github.com/grafana/tempo/tree/main/example/docker-compose
- # #######################################################
- tempo:
- image: grafana/tempo:latest
- container_name: tempo
- restart: unless-stopped
- command: [ "-config.file=/etc/tempo.yaml" ]
- volumes:
- - ./../configs/tempo.yaml:/etc/tempo.yaml
- ports:
- - "3200" # tempo
- - "24317:4317" # otlp grpc
- - "24318:4318" # otlp http
- networks:
- - infrastructure
-
-
- # #######################################################
- # # loki
- # # https://grafana.com/docs/opentelemetry/collector/send-logs-to-loki/
- # # https://github.com/grafana/loki/blob/main/production/docker-compose.yaml
- # # https://github.com/grafana/loki/blob/main/examples/getting-started/docker-compose.yaml
- # #######################################################
- loki:
- image: grafana/loki:latest
- hostname: loki
- container_name: loki
- ports:
- - "3100:3100"
- command: -config.file=/etc/loki/local-config.yaml
- volumes:
- - ./../configs/loki-config.yaml:/etc/loki/local-config.yaml
- networks:
- - infrastructure
-
-
- # #######################################################
- # # elasticsearch
- # # https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docker.html#docker-compose-file
- # #######################################################
- elasticsearch:
- container_name: elasticsearch
- restart: unless-stopped
- image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
- environment:
- - discovery.type=single-node
- - cluster.name=docker-cluster
- - node.name=docker-node
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- - xpack.security.enabled=false
- - xpack.security.http.ssl.enabled=false
- - xpack.security.transport.ssl.enabled=false
- - network.host=0.0.0.0
- - http.port=9200
- - transport.host=localhost
- - bootstrap.memory_lock=true
- - cluster.routing.allocation.disk.threshold_enabled=false
- ulimits:
- memlock:
- soft: -1
- hard: -1
- volumes:
- - elastic-data:/usr/share/elasticsearch/data
- ports:
- - ${ELASTIC_HOST_PORT:-9200}:${ELASTIC_PORT:-9200}
- - 9300:9300
- networks:
- - infrastructure
-
-
- # #######################################################
- # # kibana
- # # https://www.elastic.co/guide/en/kibana/current/docker.html
- # #######################################################
- kibana:
- image: docker.elastic.co/kibana/kibana:8.17.0
- container_name: kibana
- restart: unless-stopped
- environment:
- - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
- ports:
- - ${KIBANA_HOST_PORT:-5601}:${KIBANA_PORT:-5601}
- depends_on:
- - elasticsearch
- networks:
- - infrastructure
-
-
- # #######################################################
- # # cadvisor
- # #######################################################
- cadvisor:
- image: gcr.io/cadvisor/cadvisor:latest
- container_name: cadvisor
- restart: unless-stopped
- ports:
- - "8080:8080"
- volumes:
- - /:/rootfs:ro
- - /var/run:/var/run:ro
- - /sys:/sys:ro
- - /var/lib/docker/:/var/lib/docker:ro
- - /dev/disk/:/dev/disk:ro
- devices:
- - /dev/kmsg
- networks:
- - infrastructure
-
-
-networks:
- infrastructure:
- name: infrastructure
- driver: bridge
-
-volumes:
- postgres-data:
\ No newline at end of file
diff --git a/1-monolith-architecture-style/deployments/docker-compose/docker-compose.yaml b/1-monolith-architecture-style/deployments/docker-compose/docker-compose.yaml
deleted file mode 100644
index c179852..0000000
--- a/1-monolith-architecture-style/deployments/docker-compose/docker-compose.yaml
+++ /dev/null
@@ -1,365 +0,0 @@
-name: booking-monolith
-
-services:
-
- #######################################################
- # EventStoreDB
- #######################################################
- eventstore:
- container_name: eventstore
- image: eventstore/eventstore:latest
- restart: unless-stopped
- environment:
- - EVENTSTORE_CLUSTER_SIZE=1
- - EVENTSTORE_RUN_PROJECTIONS=All
- - EVENTSTORE_START_STANDARD_PROJECTIONS=True
- - EVENTSTORE_HTTP_PORT=2113
- - EVENTSTORE_INSECURE=True
- - EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=True
- ports:
- - "2113:2113"
- networks:
- - booking
-
- #######################################################
- # postgres
- #######################################################
- postgres:
- image: postgres:latest
- container_name: postgres
- restart: unless-stopped
- ports:
- - '5432:5432'
- environment:
- - POSTGRES_USER=postgres
- - POSTGRES_PASSWORD=postgres
- command:
- - "postgres"
- - "-c"
- - "wal_level=logical"
- - "-c"
- - "max_prepared_transactions=10"
- volumes:
- - postgres-data:/var/lib/postgresql/data
- networks:
- - booking
-
- #######################################################
- # Mongo
- #######################################################
- mongo:
- image: mongo:latest
- container_name: mongo
- restart: unless-stopped
- # environment:
- # - MONGO_INITDB_ROOT_USERNAME=root
- # - MONGO_INITDB_ROOT_PASSWORD=secret
- ports:
- - 27017:27017
- networks:
- - booking
-
- #######################################################
- # jaeger
- # https://www.jaegertracing.io/docs/1.64/deployment/
- # https://www.jaegertracing.io/docs/1.6/deployment/
- #######################################################
- jaeger-all-in-one:
- image: jaegertracing/all-in-one:latest
- container_name: jaeger-all-in-one
- restart: unless-stopped
- ports:
- - "6831:6831/udp" # UDP port for Jaeger agent
- - "16686:16686" # endpoints and Jaeger UI
- - "14268:14268" # HTTP port for accept trace spans directly from clients
- - "14317:4317" # OTLP gRPC receiver for jaeger
- - "14318:4318" # OTLP http receiver for jaeger
- # - "9411" # Accepts Zipkin spans - /api/v2/spans
- networks:
- - booking
-
- #######################################################
- # zipkin
- # https://zipkin.io/pages/quickstart
- #######################################################
- zipkin-all-in-one:
- image: openzipkin/zipkin:latest
- container_name: zipkin-all-in-one
- restart: unless-stopped
- ports:
- - "9411:9411"
- networks:
- - booking
-
- #######################################################
- # prometheus
- # https://prometheus.io/docs/introduction/first_steps/
- # https://prometheus.io/docs/prometheus/3.1/installation/
- # https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
- #######################################################
- prometheus:
- image: prom/prometheus:latest
- restart: unless-stopped
- ports:
- - "9090:9090"
- volumes:
- - ./../configs/prometheus.yaml:/etc/prometheus/prometheus.yml
- # to passe one flag, such as "--log.level=debug" or "--web.enable-remote-write-receiver", we need to override the whole command, as we can't just pass one extra argument
- command:
- - "--config.file=/etc/prometheus/prometheus.yml"
- - "--storage.tsdb.path=/prometheus"
- - "--web.console.libraries=/usr/share/prometheus/console_libraries"
- - "--web.console.templates=/usr/share/prometheus/consoles"
- # need this for the OpenTelemetry collector to be able to put metrics into Prometheus
- - "--web.enable-remote-write-receiver"
- # - "--log.level=debug"
- networks:
- - booking
-
- #######################################################
- # otel-collector
- # https://opentelemetry.io/docs/collector/installation/
- # https://github.com/open-telemetry/opentelemetry-collector
- # https://github.com/open-telemetry/opentelemetry-collector-contrib
- # we can use none contrib docker `otel/opentelemetry-collector` version from `https://github.com/open-telemetry/opentelemetry-collector` repository but,
- # if we need more components like `elasticsearch` we should use `otel/opentelemetry-collector-contrib` image of `https://github.com/open-telemetry/opentelemetry-collector-contrib` repository.
- #######################################################
- otel-collector:
- image: otel/opentelemetry-collector-contrib:latest
- container_name: otel-collector
- restart: unless-stopped
- command: ["--config=/etc/otelcol-contrib/config.yaml"]
- volumes:
- - ./../configs/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
- ports:
- - "11888:1888" # pprof extension
- - "8888:8888" # Prometheus metrics exposed by the Collector
- - "8889:8889" # Prometheus exporter metrics
- - "13133:13133" # health_check extension
- - "4317:4317" # OTLP gRPC receiver
- - "4318:4318" # OTLP http receiver
- - "55679:55679" # zpages extension
- networks:
- - booking
-
- #######################################################
- # rabbitmq
- #######################################################
- rabbitmq:
- image: rabbitmq:management
- container_name: rabbitmq
- restart: unless-stopped
- ports:
- - "5672:5672"
- - "15672:15672"
- # volumes:
- # - rabbitmq:/var/lib/rabbitmq
- networks:
- - booking
-
- #######################################################
- # Redis
- #######################################################
- redis:
- image: redis
- container_name: redis
- restart: unless-stopped
- ports:
- - 6379:6379
- networks:
- - booking
-
- #######################################################
- # node-exporter
- # https://prometheus.io/docs/guides/node-exporter/
- # https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
- #######################################################
- node-exporter:
- image: prom/node-exporter:latest
- container_name: node-exporter
- restart: unless-stopped
- volumes:
- - /proc:/host/proc:ro
- - /sys:/host/sys:ro
- - /:/rootfs:ro
- command:
- - '--path.procfs=/host/proc'
- - '--path.rootfs=/rootfs'
- - '--path.sysfs=/host/sys'
- ports:
- - "9101:9100"
- networks:
- - booking
-
- #######################################################
- # grafana
- # https://grafana.com/docs/grafana/latest/administration/provisioning/
- # https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/
- # https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/
- # https://github.com/grafana/intro-to-mltp/blob/main/grafana/provisioning/datasources/datasources.yaml
- #######################################################
- grafana:
- image: grafana/grafana:latest
- container_name: grafana
- restart: unless-stopped
- environment:
- - GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
- - GF_SECURITY_ADMIN_USER=admin
- - GF_SECURITY_ADMIN_PASSWORD=admin
- - GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
- # - GF_AUTH_ANONYMOUS_ENABLED=true
- # - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- # - GF_AUTH_DISABLE_LOGIN_FORM=true
- depends_on:
- - prometheus
- ports:
- - "3000:3000"
- volumes:
- - ./../configs/grafana/provisioning:/etc/grafana/provisioning
- - ./../configs/grafana/dashboards:/var/lib/grafana/dashboards
- networks:
- - booking
-
- #######################################################
- # tempo
- # https://github.com/grafana/tempo/blob/main/example/docker-compose/otel-collector/docker-compose.yaml
- # https://github.com/grafana/tempo/blob/main/example/docker-compose/shared
- # https://github.com/grafana/tempo/blob/main/example/docker-compose/local
- # https://github.com/grafana/tempo/tree/main/example/docker-compose
- #######################################################
- tempo:
- image: grafana/tempo:latest
- container_name: tempo
- restart: unless-stopped
- command: [ "-config.file=/etc/tempo.yaml" ]
- volumes:
- - ./../configs/tempo.yaml:/etc/tempo.yaml
- ports:
- - "3200" # tempo
- - "24317:4317" # otlp grpc
- - "24318:4318" # otlp http
- networks:
- - booking
-
- #######################################################
- # loki
- # https://grafana.com/docs/opentelemetry/collector/send-logs-to-loki/
- # https://github.com/grafana/loki/blob/main/production/docker-compose.yaml
- # https://github.com/grafana/loki/blob/main/examples/getting-started/docker-compose.yaml
- #######################################################
- loki:
- image: grafana/loki:latest
- hostname: loki
- container_name: loki
- ports:
- - "3100:3100"
- command: -config.file=/etc/loki/local-config.yaml
- volumes:
- - ./../configs/loki-config.yaml:/etc/loki/local-config.yaml
- networks:
- - booking
-
- #######################################################
- # elasticsearch
- # https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docker.html#docker-compose-file
- #######################################################
- elasticsearch:
- container_name: elasticsearch
- restart: unless-stopped
- image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
- environment:
- - discovery.type=single-node
- - cluster.name=docker-cluster
- - node.name=docker-node
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- - xpack.security.enabled=false
- - xpack.security.http.ssl.enabled=false
- - xpack.security.transport.ssl.enabled=false
- - network.host=0.0.0.0
- - http.port=9200
- - transport.host=localhost
- - bootstrap.memory_lock=true
- - cluster.routing.allocation.disk.threshold_enabled=false
- ulimits:
- memlock:
- soft: -1
- hard: -1
- volumes:
- - elastic-data:/usr/share/elasticsearch/data
- ports:
- - ${ELASTIC_HOST_PORT:-9200}:${ELASTIC_PORT:-9200}
- - 9300:9300
- networks:
- - booking
-
- #######################################################
- # kibana
- # https://www.elastic.co/guide/en/kibana/current/docker.html
- #######################################################
- kibana:
- image: docker.elastic.co/kibana/kibana:8.17.0
- container_name: kibana
- restart: unless-stopped
- environment:
- - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
- ports:
- - ${KIBANA_HOST_PORT:-5601}:${KIBANA_PORT:-5601}
- depends_on:
- - elasticsearch
- networks:
- - booking
-
- #######################################################
- # cadvisor
- #######################################################
- cadvisor:
- image: gcr.io/cadvisor/cadvisor:latest
- container_name: cadvisor
- restart: unless-stopped
- ports:
- - "8080:8080"
- volumes:
- - /:/rootfs:ro
- - /var/run:/var/run:ro
- - /sys:/sys:ro
- - /var/lib/docker/:/var/lib/docker:ro
- - /dev/disk/:/dev/disk:ro
- devices:
- - /dev/kmsg
- networks:
- - booking
-
- #######################################################
- # booking-monolith
- #######################################################
- bookingmonolith:
- image: booking-monolith
- build:
- args:
- Version: "1"
- context: ../../../
- dockerfile: 1-monolith-architecture-style/src/BookingMonolith/dev.Dockerfile
- container_name: bookingmonolith
- ports:
- - 4001:80
- - 4000:443
- volumes:
- - ~/.aspnet/https:/https:ro
- environment:
- - ASPNETCORE_ENVIRONMENT=docker
- - ASPNETCORE_URLS=https://+;http://+
- - ASPNETCORE_HTTPS_PORT=4000
- - ASPNETCORE_HTTP_PORT=4001
- - ASPNETCORE_Kestrel__Certificates__Default__Password=password
- - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
- networks:
- - booking
-
-networks:
- booking:
- name: booking
- driver: bridge
-
-volumes:
- elastic-data:
- postgres-data:
\ No newline at end of file
diff --git a/1-monolith-architecture-style/src/Api/src/Api.csproj b/1-monolith-architecture-style/src/Api/src/Api.csproj
deleted file mode 100644
index a63c543..0000000
--- a/1-monolith-architecture-style/src/Api/src/Api.csproj
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- Api
-
-
-
-
-
-
-
diff --git a/1-monolith-architecture-style/src/Api/src/Extensions/MediatRExtensions.cs b/1-monolith-architecture-style/src/Api/src/Extensions/MediatRExtensions.cs
deleted file mode 100644
index e67be88..0000000
--- a/1-monolith-architecture-style/src/Api/src/Extensions/MediatRExtensions.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using BookingMonolith;
-using BuildingBlocks.Caching;
-using BuildingBlocks.EFCore;
-using BuildingBlocks.Logging;
-using BuildingBlocks.Validation;
-using MediatR;
-
-namespace Api.Extensions;
-
-public static class MediatRExtensions
-{
- public static IServiceCollection AddCustomMediatR(this IServiceCollection services)
- {
- services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(AppDomain.CurrentDomain.GetAssemblies()));
- services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
- services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));
- services.AddScoped(typeof(IPipelineBehavior<,>), typeof(EfTxBehavior<,>));
- services.AddTransient(typeof(IPipelineBehavior<,>), typeof(CachingBehavior<,>));
- services.AddTransient(typeof(IPipelineBehavior<,>), typeof(InvalidateCachingBehavior<,>));
-
- return services;
- }
-}
diff --git a/1-monolith-architecture-style/src/Api/src/Extensions/SharedInfrastructureExtensions.cs b/1-monolith-architecture-style/src/Api/src/Extensions/SharedInfrastructureExtensions.cs
deleted file mode 100644
index 2e64410..0000000
--- a/1-monolith-architecture-style/src/Api/src/Extensions/SharedInfrastructureExtensions.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-using System.Threading.RateLimiting;
-using BookingMonolith;
-using BookingMonolith.Booking.Data;
-using BookingMonolith.Flight.Data;
-using BookingMonolith.Flight.Data.Seed;
-using BookingMonolith.Identity.Data;
-using BookingMonolith.Identity.Data.Seed;
-using BookingMonolith.Identity.Extensions.Infrastructure;
-using BookingMonolith.Passenger.Data;
-using BuildingBlocks.Core;
-using BuildingBlocks.EFCore;
-using BuildingBlocks.EventStoreDB;
-using BuildingBlocks.HealthCheck;
-using BuildingBlocks.Jwt;
-using BuildingBlocks.Logging;
-using BuildingBlocks.Mapster;
-using BuildingBlocks.MassTransit;
-using BuildingBlocks.Mongo;
-using BuildingBlocks.OpenApi;
-using BuildingBlocks.OpenTelemetryCollector;
-using BuildingBlocks.PersistMessageProcessor;
-using BuildingBlocks.ProblemDetails;
-using BuildingBlocks.Web;
-using Figgle;
-using FluentValidation;
-using Microsoft.AspNetCore.HttpOverrides;
-using Microsoft.AspNetCore.Mvc;
-using Serilog;
-
-namespace Api.Extensions;
-
-public static class SharedInfrastructureExtensions
-{
- public static WebApplicationBuilder AddSharedInfrastructure(this WebApplicationBuilder builder)
- {
- builder.Host.UseDefaultServiceProvider(
- (context, options) =>
- {
- // Service provider validation
- // ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/
- options.ValidateScopes = context.HostingEnvironment.IsDevelopment() ||
- context.HostingEnvironment.IsStaging() ||
- context.HostingEnvironment.IsEnvironment("tests");
-
- options.ValidateOnBuild = true;
- });
-
- var appOptions = builder.Services.GetOptions(nameof(AppOptions));
- Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
-
- builder.AddCustomSerilog(builder.Environment);
- builder.Services.AddJwt();
- builder.Services.AddScoped();
- builder.Services.AddTransient();
- builder.Services.AddPersistMessageProcessor();
-
- builder.Services.AddEndpointsApiExplorer();
- builder.Services.AddControllers();
- builder.Services.AddAspnetOpenApi();
- builder.Services.AddCustomVersioning();
- builder.Services.AddHttpContextAccessor();
- builder.Services.AddScoped();
- builder.Services.AddCustomMediatR();
-
- builder.Services.AddCustomMassTransit(
- builder.Environment,
- TransportType.InMemory,
- AppDomain.CurrentDomain.GetAssemblies());
-
-
- builder.Services.Scan(
- scan => scan
- .FromAssemblyOf()
- .AddClasses(classes => classes.AssignableTo())
- .AsImplementedInterfaces()
- .WithScopedLifetime());
-
-
- builder.AddMinimalEndpoints(assemblies: typeof(BookingMonolithRoot).Assembly);
- builder.Services.AddValidatorsFromAssembly(typeof(BookingMonolithRoot).Assembly);
- builder.Services.AddCustomMapster(typeof(BookingMonolithRoot).Assembly);
-
- builder.AddMongoDbContext();
- builder.AddMongoDbContext();
- builder.AddMongoDbContext();
-
- builder.AddCustomDbContext();
- builder.Services.AddScoped();
- builder.AddCustomIdentityServer();
-
- builder.Services.Configure(
- options =>
- {
- options.ForwardedHeaders =
- ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
- });
-
- builder.AddCustomDbContext();
- builder.Services.AddScoped();
-
- builder.AddCustomDbContext();
-
- // ref: https://github.com/oskardudycz/EventSourcing.NetCore/tree/main/Sample/EventStoreDB/ECommerce
- builder.Services.AddEventStore(builder.Configuration, typeof(BookingMonolithRoot).Assembly)
- .AddEventStoreDBSubscriptionToAll();
-
- builder.Services.Configure(
- options => options.SuppressModelStateInvalidFilter = true);
-
- builder.Services.AddRateLimiter(
- options =>
- {
- options.GlobalLimiter = PartitionedRateLimiter.Create(
- httpContext =>
- RateLimitPartition.GetFixedWindowLimiter(
- partitionKey: httpContext.User.Identity?.Name ??
- httpContext.Request.Headers.Host.ToString(),
- factory: partition => new FixedWindowRateLimiterOptions
- {
- AutoReplenishment = true,
- PermitLimit = 10,
- QueueLimit = 0,
- Window = TimeSpan.FromMinutes(1)
- }));
- });
-
- builder.AddCustomObservability();
- builder.Services.AddCustomHealthCheck();
-
- builder.Services.AddEasyCaching(
- options => { options.UseInMemory(builder.Configuration, "mem"); });
-
- builder.Services.AddProblemDetails();
-
- return builder;
- }
-
-
- public static WebApplication UserSharedInfrastructure(this WebApplication app)
- {
- var appOptions = app.Configuration.GetOptions(nameof(AppOptions));
-
- app.UseCustomProblemDetails();
- app.UseCustomObservability();
- app.UseCustomHealthCheck();
-
- app.UseSerilogRequestLogging(
- options =>
- {
- options.EnrichDiagnosticContext = LogEnrichHelper.EnrichFromRequest;
- });
-
- app.UseCorrelationId();
- app.UseRateLimiter();
- app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
-
- if (app.Environment.IsDevelopment())
- {
- app.UseAspnetOpenApi();
- }
-
- app.UseForwardedHeaders();
- app.UseMigration();
- app.UseMigration();
- app.UseMigration();
-
- app.UseIdentityServer();
-
- return app;
- }
-}
diff --git a/1-monolith-architecture-style/src/Api/src/Program.cs b/1-monolith-architecture-style/src/Api/src/Program.cs
deleted file mode 100644
index c3b80d5..0000000
--- a/1-monolith-architecture-style/src/Api/src/Program.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Api.Extensions;
-using BuildingBlocks.Web;
-
-var builder = WebApplication.CreateBuilder(args);
-
-builder.AddSharedInfrastructure();
-
-var app = builder.Build();
-
-// ref: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-7.0#routing-basics
-app.UseAuthentication();
-app.UseAuthorization();
-
-app.UserSharedInfrastructure();
-app.MapMinimalEndpoints();
-
-app.Run();
-
-namespace Api
-{
- public partial class Program
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/Api/src/Properties/launchSettings.json b/1-monolith-architecture-style/src/Api/src/Properties/launchSettings.json
deleted file mode 100644
index 4659237..0000000
--- a/1-monolith-architecture-style/src/Api/src/Properties/launchSettings.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "$schema": "https://json.schemastore.org/launchsettings.json",
- "profiles": {
- "Monolith.Api": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "launchUrl": "swagger",
- "launchBrowser": true,
- "applicationUrl": "https://localhost:4000;http://localhost:4001",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- }
- }
-}
diff --git a/1-monolith-architecture-style/src/Api/src/appsettings.docker.json b/1-monolith-architecture-style/src/Api/src/appsettings.docker.json
deleted file mode 100644
index 2c63c08..0000000
--- a/1-monolith-architecture-style/src/Api/src/appsettings.docker.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-}
diff --git a/1-monolith-architecture-style/src/Api/src/appsettings.json b/1-monolith-architecture-style/src/Api/src/appsettings.json
deleted file mode 100644
index fff2405..0000000
--- a/1-monolith-architecture-style/src/Api/src/appsettings.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "AppOptions": {
- "Name": "Booking-Monolith"
- },
- "LogOptions": {
- "Level": "information",
- "LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}",
- "File": {
- "Enabled": false,
- "Path": "logs/logs.txt",
- "Interval": "day"
- }
- },
- "PostgresOptions": {
- "ConnectionString": "Server=localhost;Port=5432;Database=booking_monolith;User Id=postgres;Password=postgres;Include Error Detail=true"
- },
- "MongoOptions": {
- "ConnectionString": "mongodb://localhost:27017",
- "DatabaseName": "booking_modular_monolith_read"
- },
- "EventStoreOptions": {
- "ConnectionString": "esdb://localhost:2113?tls=false"
- },
- "PersistMessageOptions": {
- "Interval": 30,
- "Enabled": true,
- "ConnectionString": "Server=localhost;Port=5432;Database=persist_message;User Id=postgres;Password=postgres;Include Error Detail=true"
- },
- "Jwt": {
- "Authority": "https://localhost:4000",
- "Audience": "booking-monolith"
- },
- "HealthOptions": {
- "Enabled": false
- },
- "ObservabilityOptions": {
- "InstrumentationName": "booking_monolith_service",
- "OTLPOptions": {
- "OTLPGrpExporterEndpoint": "http://localhost:4317"
- },
- "AspireDashboardOTLPOptions": {
- "OTLPGrpExporterEndpoint": "http://localhost:4319"
- },
- "ZipkinOptions": {
- "HttpExporterEndpoint": "http://localhost:9411/api/v2/spans"
- },
- "JaegerOptions": {
- "OTLPGrpcExporterEndpoint": "http://localhost:14317",
- "HttpExporterEndpoint": "http://localhost:14268/api/traces"
- },
- "UsePrometheusExporter": true,
- "UseOTLPExporter": true,
- "UseAspireOTLPExporter": true,
- "UseGrafanaExporter": false,
- "ServiceName": "Booking Monolith Service"
- },
- "AllowedHosts": "*"
-}
diff --git a/1-monolith-architecture-style/src/Api/src/appsettings.test.json b/1-monolith-architecture-style/src/Api/src/appsettings.test.json
deleted file mode 100644
index 7a73a41..0000000
--- a/1-monolith-architecture-style/src/Api/src/appsettings.test.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-}
\ No newline at end of file
diff --git a/1-monolith-architecture-style/src/Api/src/keys/is-signing-key-296345BF73910ADD1DAC302B848E47E7.json b/1-monolith-architecture-style/src/Api/src/keys/is-signing-key-296345BF73910ADD1DAC302B848E47E7.json
deleted file mode 100644
index cd34668..0000000
--- a/1-monolith-architecture-style/src/Api/src/keys/is-signing-key-296345BF73910ADD1DAC302B848E47E7.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Version":1,"Id":"296345BF73910ADD1DAC302B848E47E7","Created":"2025-04-06T20:57:25.1670058Z","Algorithm":"RS256","IsX509Certificate":false,"Data":"CfDJ8KNpFTgHKl5Nl-o13RQ8rseNpYdUTB-_FLsIGbeu6jM5x9l_rDfygUsYH6TAnyqXDFeW4U7xf8kJXDDvH1V0jkKcQaHFWYcZnKAirRBnuReu2OcaGWcn0vDccI5liTTRfp_Dknwhf3jgrU-LOBlPDoVGWwTwOQHXa4iHQjfOCG77Ey6CmJZ0w6JMi802tSMbpc2G2376b05GuzpoKwfgG_F8ZJcAtl1cql4KD11CcynPTNqK0fXOcIeGCQKgJDkJp_cHlk-sv4xJTFl5nqRx62v9auoB3AeKxqRqKqserGT-ZFYDeSxOlgmDSreVFezZ4tYd80Iq-ZpQXK5e3uz8gJ1B37_ySzgF_Rkscf67FivIqcpcV-WZzvnKXeQP0Wo7B7Qt8sKwCAW-vh3X5iMdDi-tecOWaRqeNrffbjd4efP1FK5wqmNrZirrcuCZDgPyYUiB1bSUE1HSj5vW4kFy_NF-3k0EVcQf5KqJpJ9QkTQgmTPkFCwwEcyX-P2hA21G64_M_7EjZXnjw29xjnkI7zO3mx3sA5bwPf6sCmxgE6joaI6P7G4u8JB5pbSHynOWWNTWRZm8YHngZCfK1DZa6Y-uAnrNzVQdcbB-uVGwszavP3Ohqtu7NBCaIkIhyT9N783n5-J8KAbSKu2FBF-qwNaUcmSAhbnRLyQwou-F0sxgM9iLwNcCo6jcgqz5g3MBEIcWa5IKdbtYXQQzbj3NlKmYg1l-x0SrxZD9403gNIS-zCEWLPEgpLr-NU06_Y5Vkbvn8jHKAr45nDFvY_osVvCPQ8qFuq_P-z3HMqFrfuPNlLrf_ZoJCpIKYNdXPJwHQXzGpz41QiN2omk52K5N8UCiGnDog66tJZAqGjtWWHpFCF2O4LXA9uEwnlD06N_i1T9umOtLnlGsF5SM0G3YjG_G8APqd6GDnJsM1wBoVXzzldGvS8GEwwxvVRGvLrSljPdR_l-8JifzUzhIOxMdlZUE8D9tQJhqZJovm34kfgx8AA0j4FQxAKPUhz99dapc5rmP1pgkuv7b9ZgtWa9js16GUJUYV3Dd6HC3lWU4zdXnQIsJPBUdgsiKptAXayc1KevAzw7o2PB7_auENui4cj1MuDxbaf9yrq9ZIol_tPw5rdN440vhHPIPzVi-1Wv0YyvyPD0fj2GAU5fL97lVlCprWuM71-rjVtARrn0pbf4ENBYk4ABWWke8ZHppbdFQQbjBv-yKCeiGA7qbRAeb_NMK2wmWUGz9DTVWtb04kmitXvg1-aj6ZwY-uIDSY5uaHPz7b8mxFywlSQ9plQzIkb-EfZk6RWxW1-NqyHMEAryM4QxwdDX9LjSo37CPdHCdOSRsMzH6zGH0_SgeN4W25Lk0RhoBHMMQk_gF5FCXjDteFlAdPFw9K5qmVVohHfEnAMDUZ4xYYgDx0Z254jsbSIFOuqEmUvmb5WvbKFtlcLrpFAuoqcNLfI61JM0LLxZNjpktGOMX5q1E_tYm5Y-bxd6W_2r-UUkCTKWJMp7_wr2CJPyegVshEBuUaO4_GyndCTY9_jh4OEYgyFQliEg66g3CUVy7ZBERrfz1CiHmpTqoKbs3toPsHMrB6yaQe9UtcYzLBRP3OVku3WmE1IylfUsZ64YA2DBU399JjYckXlWU3PxH9GAxcnIW8cU_29XZZ0ueGLFeSRP0mBb8TqVIcqd3xoAUbZGPnleme-D44yco8ZSGFVhQqt5qstzIA2DQALjVf2E5vg-yL8Gj9s5q-xjPjBgZgyW23gbBEO6PynDK3jfnucHXcLsHMpvZwyV1yaU3314mNLUpu241_7ukMuWC5FmxaVWqe4n9h-W479YlK5WmI5TDmWcc12DQI92eIAYCSYA60SOJhnuGsyFHwedfxIjVjouZeAWWHj1QOM3uZ1rwYOB0DZSlqI6C2kecv4D2CFq7gYosBxQX9fSnJ2MyUiGOxbdlRtwGB_dtRtlqWpt-acu-l9i5jNwdM6QnNejoPthvWPCcvfaaqFjWjnZQQKSBBfWV9Coe7mnaJYhyqWFUQ4AKcDuboQ3k3jj2p-5LTnbFlTQ3SzLfsgjLjpD5hqIY1ND5NWOT3D0pQumfh5tJxgSa0g-HhW7XBSGs2783OFdgAMuxCkZUgisdu0MRyQzdqWEY30trlpnpsAGOO3E8MMxQ2COy7Y-WrUykioag1qkJTbT-1FgHgw9Qj4dnQ136_tC3BvVrmO6pId26PzdPDpV_4T5vNLoyuiyyUqnHcKOETFrHpbj2cXmi-sYuqrwfNZKfcPIsAkekmcWlLd9s4glvD3xJ0SB0s6gJURjvupdD96l2kfdHw8qieB0ovlGISrpjnAKGn6F81_32rYULB-NDN8H4aTdiVmhvwf6KkpXHA9Euuyyir4BqHmIknr8WWuugIMxRw3ysCS4OIV5ocsjzIfQ9r_15bNWsoyWPDkVnKcS1ffbURzYPNIqTO6Ik5iC7rk705WAxaojy","DataProtected":true}
\ No newline at end of file
diff --git a/1-monolith-architecture-style/src/Api/src/keys/is-signing-key-73D9025BDA857BF270C99C6594EE4246.json b/1-monolith-architecture-style/src/Api/src/keys/is-signing-key-73D9025BDA857BF270C99C6594EE4246.json
deleted file mode 100644
index 5ca82b6..0000000
--- a/1-monolith-architecture-style/src/Api/src/keys/is-signing-key-73D9025BDA857BF270C99C6594EE4246.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Version":1,"Id":"73D9025BDA857BF270C99C6594EE4246","Created":"2024-09-02T18:34:53.8631045Z","Algorithm":"RS256","IsX509Certificate":false,"Data":"CfDJ8MEQ06y_es9CrKY4Ou9Uc7Hf97ujXcMcuawi9V5VrBvxWbAqbdjBlk5zKK_NzrDURTwaFvgOfLUQ__0r-sMvtTXBZLhWhNWJnLn1-KWhtnpvPt5jFTAf2f5mvrjVTTN8E-NTGMGk2yLOYm2TVE3QL7DuLRrazydXLJvIB71O2d_OrAfB7Pq62xrnwLgp4BErb_HphYUExsAEp7jn6uL34QJ5HI6zsb_ct2SHvOl0CzUH2yIjjrY_u-5GAgmqqpUyysGwUh8RpR_CDPCd8ZxgSOiKAlBkp3kQXxf86MF0C-kfBKU-iflrJRSJ1-5R8F5nNPK8FL29I4i7SYCugIkLvqez3wTewPUFv00bTpcfs3V_tmfqBFLyNWm4sppzpU9HGB3elZ0z5bBa_IGbtIrlHC_o4SDSxKKdD4OUZHGLE5X--xWBw5uV9GSgrSH6bcnHZ6rLd3qrt7b82BMr-rVIGyFzGIE6OTLVGkXSL6FdpJ9Lezp06qnZ6DtLFI86lVJGsYIuXR_AIVrz9U8uqCrK6jLwGCk9nR0adPtAUJfgcXGVVTQlvt_YgZv5k5_rYcVl0yLNdgd-BoidXeoqLPJxIJOCohwumVcqTPkf-gB_hjgNk6IEqXZxm0Tzl0d2jpyERDHdHxIvS5o1h4YUfkiMcliRfQMNkLoDxf0H2hFNXRYQKkQ1y6cwS9juq66Uj_-v-vN1etE-hK45ULFCfyppBvb2aTYfTuce5S0ps1t0ZIjvpm7Kvjg3doHEi97N-IqxYaf8r6n8gBcaUwlrfcHaYNPLRyWywX_varEmLm9qGK5KJj2itGNfw0wU0EygIeoV6V_PzqyAkf0JcVTC7lcog37TPdNU2AGzH0S8oXiAQEd49wPs2ZApjiOaiz26efr03I-hD5N91-R2_9ACGjENGPVHMyUtMVV5RPs3-pQMv9f_zweOuLQo7ZfhScqu4HmxGW70amuV4anMxGCQzbi3JWnkTmspptzClJyvE_MJVSTQ6SX04DaS4buSG3wZEc9Qy9SqTj-9CJ7XFGFs8XYmKUj_cIoQF1XuoSnWblsnnEC7EbNRF7y9fG8ZG-Sk3TEEYnalxRrcS-i26wVNdnuUBEmidz_HfsxFxCDKKmx7GHTvHxy72kI84ucMeQeVFjJI3ZDynGn--cL9xBiUbUKM8WDhJ-AgZ76wwh0qAPw5xJ6yHi-15moxySUkvFLjlNkP2Ad5j3_3ab_r6VIunM6zhsq7pSBWIg5povuV5ZwNVZQX0IeLqV9bHug443LaK5a57dTK8wy346AFftV-wc71i4Nt5MIFcOs3lxRPqYij1enbrPYvIV4-N8Sy6aaYj25Qn7VHrGeW72aZPAYY5W-czoPw_Oo6xYGjaPYFFsUSZVg6IQwCzwwAxUoc2gAL33FJQTNvNSnrYBJ5HN-Tqan23Pw_bEus7HHZu2N1daFjqtrl4-oOco46phsppUjH3LGhOPJnFSChr-W8tlk80coJ8IK_AsGludKB09WzId9JBtI5cp3Yu1J7N6nSL7nVTrT6Gw_0hitSoeu5ZLPSS9ooAynAXrvB_s0l0L9aFTRuc5IEhgt4bLzbeqimfQemRlBsNz09JGe04gmOOCmjWD52JHWUiVJQNMavrSGtW9Dy1-Z5h0D_BHzhpTia1S7wx7dSdItJ0-Pm1Au_TNkQGm4ffNFsVDQmNkCYyc8yFnYmZMYYEaPmbw7DvQTs1MHoe7aUzMM0DKcaqboSaxqQK9sxymgElvdoYqOMRWzS7s39UQ1O4TfPngfrWdtN2DogGUtyS-vPfNJpdS6jZvJAj8czgl7PU8buwWyPApE1-FVL32wC6a8dkHvJi4p7fbBjmTfFCnuW8G1KBX3VuToctJvidSjzoSUTX3vgKVni2QW-55Sh7DUYy91FGXGB_ui1yuxEnLmymtbWokcWYkIwcAsl8im70V4oK63ypNSYWea_gaDWMFXT_vANB1iAkr-_zE_ECocOXo93QqSR5UdLmfQFvLiDwjUeovkjFS5C2Z8AjEvHvFkedGWOIK5Bpam-0IEFip3Fvg6RgxwTinFXXa8PiRkcLSlt0J81b85ybrKsDj5WtUA-MFuK2Silyofn9BgD_lh9RU4HPFhVoqey7AuEJjHtGvqz4EnE_05y4A_mKgvJBAs4QiYjCopWtheeOGeeoUa636Ewmu30P66C5mimdAIx36-55xlyJBIM7DFFM6RAGvfAmpyNphjwT0y84B4pOhFEZeOQ2me2sfG-xRJbjjgDhP2SwBBEQ-hCLGeqOD-Xo74FZC4lCTvtn2Sbu1kIw0kz2P_vrq6d6SZwEIrhWYhfRVKTrT8nXj8i48Jdc1d1fyKdRL15USgLhAT-QSNcgVYHRLsVlQx5-b51tGg6Atx6vGCxtXBRSaTwZ3IxbdJs0T62H14K5U81EFu-2Vvf-cMwCm4gCQATxvvAsqToxElou9ZjIVMPt_FQUyAMtJke","DataProtected":true}
\ No newline at end of file
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingEventMapper.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingEventMapper.cs
deleted file mode 100644
index 9743d54..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingEventMapper.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using BookingMonolith.Booking.Bookings.Features.CreatingBook.V1;
-using BuildingBlocks.Contracts.EventBus.Messages;
-using BuildingBlocks.Core;
-using BuildingBlocks.Core.Event;
-
-namespace BookingMonolith.Booking;
-
-public sealed class BookingEventMapper : IEventMapper
-{
- public IIntegrationEvent? MapToIntegrationEvent(IDomainEvent @event)
- {
- return @event switch
- {
- BookingCreatedDomainEvent e => new BookingCreated(e.Id),
- _ => null
- };
- }
-
- public IInternalCommand? MapToInternalCommand(IDomainEvent @event)
- {
- return @event switch
- {
- _ => null
- };
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingProjection.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingProjection.cs
deleted file mode 100644
index 7cbff91..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingProjection.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using BookingMonolith.Booking.Bookings.Features.CreatingBook.V1;
-using BookingMonolith.Booking.Bookings.Models;
-using BookingMonolith.Booking.Data;
-using BuildingBlocks.EventStoreDB.Events;
-using BuildingBlocks.EventStoreDB.Projections;
-using MassTransit;
-using MediatR;
-using MongoDB.Driver;
-using MongoDB.Driver.Linq;
-
-namespace BookingMonolith.Booking;
-
-public class BookingProjection : IProjectionProcessor
-{
- private readonly BookingReadDbContext _bookingReadDbContext;
-
- public BookingProjection(BookingReadDbContext bookingReadDbContext)
- {
- _bookingReadDbContext = bookingReadDbContext;
- }
-
- public async Task ProcessEventAsync(StreamEvent streamEvent, CancellationToken cancellationToken = default)
- where T : INotification
- {
- switch (streamEvent.Data)
- {
- case BookingCreatedDomainEvent bookingCreatedDomainEvent:
- await Apply(bookingCreatedDomainEvent, cancellationToken);
- break;
- }
- }
-
- private async Task Apply(BookingCreatedDomainEvent @event, CancellationToken cancellationToken = default)
- {
- var reservation =
- await _bookingReadDbContext.Booking.AsQueryable().SingleOrDefaultAsync(x => x.Id == @event.Id && !x.IsDeleted,
- cancellationToken);
-
- if (reservation == null)
- {
- var bookingReadModel = new BookingReadModel
- {
- Id = NewId.NextGuid(),
- Trip = @event.Trip,
- BookId = @event.Id,
- PassengerInfo = @event.PassengerInfo,
- IsDeleted = @event.IsDeleted
- };
-
- await _bookingReadDbContext.Booking.InsertOneAsync(bookingReadModel, cancellationToken: cancellationToken);
- }
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingRoot.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingRoot.cs
deleted file mode 100644
index e5df390..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/BookingRoot.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace BookingMonolith.Booking;
-
-public class BookingRoot
-{
-
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Dtos/CreateReservation.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Dtos/CreateReservation.cs
deleted file mode 100644
index 9d4fe4a..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Dtos/CreateReservation.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-namespace BookingMonolith.Booking.Bookings.Dtos;
-
-public record BookingResponseDto(Guid Id, string Name, string FlightNumber, Guid AircraftId, decimal Price,
- DateTime FlightDate, string SeatNumber, Guid DepartureAirportId, Guid ArriveAirportId, string Description);
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/BookingAlreadyExistException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/BookingAlreadyExistException.cs
deleted file mode 100644
index 8a47323..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/BookingAlreadyExistException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Net;
-using BuildingBlocks.Exception;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class BookingAlreadyExistException : AppException
-{
- public BookingAlreadyExistException(int? code = default) : base("Booking already exist!", HttpStatusCode.Conflict, code)
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/FlightNotFoundException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/FlightNotFoundException.cs
deleted file mode 100644
index 7db5c22..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/FlightNotFoundException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Net;
-using BuildingBlocks.Exception;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class FlightNotFoundException : AppException
-{
- public FlightNotFoundException() : base("Flight doesn't exist!", HttpStatusCode.NotFound)
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidAircraftIdException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidAircraftIdException.cs
deleted file mode 100644
index 8274ea2..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidAircraftIdException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class InvalidAircraftIdException : DomainException
-{
- public InvalidAircraftIdException(Guid aircraftId)
- : base($"aircraftId: '{aircraftId}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidArriveAirportIdException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidArriveAirportIdException.cs
deleted file mode 100644
index 16ae26a..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidArriveAirportIdException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class InvalidArriveAirportIdException : DomainException
-{
- public InvalidArriveAirportIdException(Guid arriveAirportId)
- : base($"arriveAirportId: '{arriveAirportId}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidDepartureAirportIdException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidDepartureAirportIdException.cs
deleted file mode 100644
index caa8162..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidDepartureAirportIdException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class InvalidDepartureAirportIdException : DomainException
-{
- public InvalidDepartureAirportIdException(Guid departureAirportId)
- : base($"departureAirportId: '{departureAirportId}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidFlightDateException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidFlightDateException.cs
deleted file mode 100644
index 5a4bc88..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidFlightDateException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class InvalidFlightDateException : DomainException
-{
- public InvalidFlightDateException(DateTime flightDate)
- : base($"Flight Date: '{flightDate}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidFlightNumberException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidFlightNumberException.cs
deleted file mode 100644
index 2609d3e..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidFlightNumberException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class InvalidFlightNumberException : DomainException
-{
- public InvalidFlightNumberException(string flightNumber)
- : base($"Flight Number: '{flightNumber}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidPassengerNameException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidPassengerNameException.cs
deleted file mode 100644
index e0e7ad0..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidPassengerNameException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class InvalidPassengerNameException : DomainException
-{
- public InvalidPassengerNameException(string passengerName)
- : base($"Passenger Name: '{passengerName}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidPriceException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidPriceException.cs
deleted file mode 100644
index 53806f5..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/InvalidPriceException.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class InvalidPriceException : DomainException
-{
- public InvalidPriceException(decimal price)
- : base($"Price: '{price}' must be grater than or equal 0.")
- {
- }
-}
-
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/SeatNumberException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/SeatNumberException.cs
deleted file mode 100644
index cb68748..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Exceptions/SeatNumberException.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.Exceptions;
-
-public class SeatNumberException : DomainException
-{
- public SeatNumberException(string seatNumber)
- : base($"Seat Number: '{seatNumber}' is invalid.")
- {
- }
-}
-
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Features/BookingMappings.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Features/BookingMappings.cs
deleted file mode 100644
index d962240..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Features/BookingMappings.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using BookingMonolith.Booking.Bookings.Dtos;
-using BookingMonolith.Booking.Bookings.Features.CreatingBook.V1;
-using Mapster;
-
-namespace BookingMonolith.Booking.Bookings.Features;
-
-public class BookingMappings : IRegister
-{
- public void Register(TypeAdapterConfig config)
- {
- config.Default.NameMatchingStrategy(NameMatchingStrategy.Flexible);
-
- config.NewConfig()
- .ConstructUsing(x => new BookingResponseDto(x.Id, x.PassengerInfo.Name, x.Trip.FlightNumber,
- x.Trip.AircraftId, x.Trip.Price, x.Trip.FlightDate, x.Trip.SeatNumber, x.Trip.DepartureAirportId, x.Trip.ArriveAirportId,
- x.Trip.Description));
-
-
- config.NewConfig()
- .ConstructUsing(x => new CreateBooking(x.PassengerId, x.FlightId, x.Description));
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Features/CreatingBook/V1/CreateBooking.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Features/CreatingBook/V1/CreateBooking.cs
deleted file mode 100644
index 7d1d6f6..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Features/CreatingBook/V1/CreateBooking.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using Ardalis.GuardClauses;
-using BookingMonolith.Booking.Bookings.Exceptions;
-using BookingMonolith.Booking.Bookings.ValueObjects;
-using BookingMonolith.Flight.Flights.Features.GettingFlightById.V1;
-using BookingMonolith.Flight.Seats.Features.GettingAvailableSeats.V1;
-using BookingMonolith.Flight.Seats.Features.ReservingSeat.V1;
-using BookingMonolith.Passenger.Passengers.Features.GettingPassengerById.V1;
-using BuildingBlocks.Core;
-using BuildingBlocks.Core.CQRS;
-using BuildingBlocks.Core.Event;
-using BuildingBlocks.Core.Model;
-using BuildingBlocks.EventStoreDB.Repository;
-using BuildingBlocks.Web;
-using Duende.IdentityServer.EntityFramework.Entities;
-using FluentValidation;
-using Mapster;
-using MapsterMapper;
-using MassTransit;
-using MediatR;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace BookingMonolith.Booking.Bookings.Features.CreatingBook.V1;
-
-public record CreateBooking(Guid PassengerId, Guid FlightId, string Description) : ICommand
-{
- public Guid Id { get; init; } = NewId.NextGuid();
-}
-
-public record CreateBookingResult(ulong Id);
-
-public record BookingCreatedDomainEvent(Guid Id, PassengerInfo PassengerInfo, Trip Trip) : Entity, IDomainEvent;
-
-public record CreateBookingRequestDto(Guid PassengerId, Guid FlightId, string Description);
-
-public record CreateBookingResponseDto(ulong Id);
-
-public class CreateBookingEndpoint : IMinimalEndpoint
-{
- public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
- {
- builder.MapPost($"{EndpointConfig.BaseApiPath}/booking", async (CreateBookingRequestDto request,
- IMediator mediator, IMapper mapper,
- CancellationToken cancellationToken) =>
- {
- var command = mapper.Map(request);
-
- var result = await mediator.Send(command, cancellationToken);
-
- var response = result.Adapt();
-
- return Results.Ok(response);
- })
- .RequireAuthorization(nameof(ApiScope))
- .WithName("CreateBooking")
- .WithApiVersionSet(builder.NewApiVersionSet("Booking").Build())
- .Produces()
- .ProducesProblem(StatusCodes.Status400BadRequest)
- .WithSummary("Create Booking")
- .WithDescription("Create Booking")
- .WithOpenApi()
- .HasApiVersion(1.0);
-
- return builder;
- }
-}
-
-public class CreateBookingValidator : AbstractValidator
-{
- public CreateBookingValidator()
- {
- RuleFor(x => x.FlightId).NotNull().WithMessage("FlightId is required!");
- RuleFor(x => x.PassengerId).NotNull().WithMessage("PassengerId is required!");
- }
-}
-
-internal class CreateBookingCommandHandler : ICommandHandler
-{
- private readonly IEventStoreDBRepository _eventStoreDbRepository;
- private readonly ICurrentUserProvider _currentUserProvider;
- private readonly IEventDispatcher _eventDispatcher;
- private readonly IMediator _mediator;
-
- public CreateBookingCommandHandler(IEventStoreDBRepository eventStoreDbRepository,
- ICurrentUserProvider currentUserProvider,
- IEventDispatcher eventDispatcher,
- IMediator mediator)
- {
- _eventStoreDbRepository = eventStoreDbRepository;
- _currentUserProvider = currentUserProvider;
- _eventDispatcher = eventDispatcher;
- _mediator = mediator;
- }
-
- public async Task Handle(CreateBooking command, CancellationToken cancellationToken)
- {
- Guard.Against.Null(command, nameof(command));
-
- // Directly call the GetFlightById handler instead of gRPC
- var flight = await _mediator.Send(new GetFlightById(command.FlightId), cancellationToken);
-
- if (flight is null)
- {
- throw new FlightNotFoundException();
- }
-
- var passenger = await _mediator.Send(new GetPassengerById(command.PassengerId), cancellationToken);
-
- var emptySeat = (await _mediator.Send(new GetAvailableSeats(command.FlightId), cancellationToken))?.SeatDtos?.FirstOrDefault();
-
- var reservation = await _eventStoreDbRepository.Find(command.Id, cancellationToken);
-
- if (reservation is not null && !reservation.IsDeleted)
- {
- throw new BookingAlreadyExistException();
- }
-
- var aggrigate = Models.Booking.Create(command.Id, PassengerInfo.Of(passenger.PassengerDto?.Name), Trip.Of(
- flight.FlightDto.FlightNumber, flight.FlightDto.AircraftId,
- flight.FlightDto.DepartureAirportId,
- flight.FlightDto.ArriveAirportId, flight.FlightDto.FlightDate,
- flight.FlightDto.Price, command.Description,
- emptySeat?.SeatNumber),
- false, _currentUserProvider.GetCurrentUserId());
-
- await _eventDispatcher.SendAsync(aggrigate.DomainEvents, cancellationToken: cancellationToken);
-
- await _mediator.Send(new ReserveSeat(flight.FlightDto.Id, emptySeat?.SeatNumber), cancellationToken);
-
- var result = await _eventStoreDbRepository.Add(
- aggrigate,
- cancellationToken);
-
- return new CreateBookingResult(result);
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Models/Booking.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Models/Booking.cs
deleted file mode 100644
index c1b1729..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Models/Booking.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using BookingMonolith.Booking.Bookings.Features.CreatingBook.V1;
-using BookingMonolith.Booking.Bookings.ValueObjects;
-using BuildingBlocks.EventStoreDB.Events;
-
-namespace BookingMonolith.Booking.Bookings.Models;
-
-public record Booking : AggregateEventSourcing
-{
- public Trip Trip { get; private set; }
- public PassengerInfo PassengerInfo { get; private set; }
-
- public static Booking Create(Guid id, PassengerInfo passengerInfo, Trip trip, bool isDeleted = false, long? userId = null)
- {
- var booking = new Booking { Id = id, Trip = trip, PassengerInfo = passengerInfo, IsDeleted = isDeleted };
-
- var @event = new BookingCreatedDomainEvent(booking.Id, booking.PassengerInfo, booking.Trip)
- {
- IsDeleted = booking.IsDeleted,
- CreatedAt = DateTime.Now,
- CreatedBy = userId
- };
-
- booking.AddDomainEvent(@event);
- booking.Apply(@event);
-
- return booking;
- }
-
- public override void When(object @event)
- {
- switch (@event)
- {
- case BookingCreatedDomainEvent bookingCreated:
- {
- Apply(bookingCreated);
- return;
- }
- }
- }
-
- private void Apply(BookingCreatedDomainEvent @event)
- {
- Id = @event.Id;
- Trip = @event.Trip;
- PassengerInfo = @event.PassengerInfo;
- IsDeleted = @event.IsDeleted;
- Version++;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Models/BookingReadModel.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Models/BookingReadModel.cs
deleted file mode 100644
index 730a6bc..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/Models/BookingReadModel.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using BookingMonolith.Booking.Bookings.ValueObjects;
-
-namespace BookingMonolith.Booking.Bookings.Models;
-
-public class BookingReadModel
-{
- public required Guid Id { get; init; }
- public required Guid BookId { get; init; }
- public required Trip Trip { get; init; }
- public required PassengerInfo PassengerInfo { get; init; }
- public required bool IsDeleted { get; init; }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/ValueObjects/PassengerInfo.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/ValueObjects/PassengerInfo.cs
deleted file mode 100644
index 8a65131..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/ValueObjects/PassengerInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using BookingMonolith.Booking.Bookings.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.ValueObjects;
-
-public record PassengerInfo
-{
- public string Name { get; }
-
- private PassengerInfo(string name)
- {
- Name = name;
- }
-
- public static PassengerInfo Of(string name)
- {
- if (string.IsNullOrWhiteSpace(name))
- {
- throw new InvalidPassengerNameException(name);
- }
-
- return new PassengerInfo(name);
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/ValueObjects/Trip.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/ValueObjects/Trip.cs
deleted file mode 100644
index da43eaa..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Bookings/ValueObjects/Trip.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using BookingMonolith.Booking.Bookings.Exceptions;
-
-namespace BookingMonolith.Booking.Bookings.ValueObjects;
-
-public record Trip
-{
- public string FlightNumber { get; }
- public Guid AircraftId { get; }
- public Guid DepartureAirportId { get; }
- public Guid ArriveAirportId { get; }
- public DateTime FlightDate { get; }
- public decimal Price { get; }
- public string Description { get; }
- public string SeatNumber { get; }
-
- private Trip(string flightNumber, Guid aircraftId, Guid departureAirportId, Guid arriveAirportId,
- DateTime flightDate, decimal price, string description, string seatNumber)
- {
- FlightNumber = flightNumber;
- AircraftId = aircraftId;
- DepartureAirportId = departureAirportId;
- ArriveAirportId = arriveAirportId;
- FlightDate = flightDate;
- Price = price;
- Description = description;
- SeatNumber = seatNumber;
- }
-
- public static Trip Of(string flightNumber, Guid aircraftId, Guid departureAirportId, Guid arriveAirportId,
- DateTime flightDate, decimal price, string description, string seatNumber)
- {
- if (string.IsNullOrWhiteSpace(flightNumber))
- {
- throw new InvalidFlightNumberException(flightNumber);
- }
-
- if (aircraftId == Guid.Empty)
- {
- throw new InvalidAircraftIdException(aircraftId);
- }
-
- if (departureAirportId == Guid.Empty)
- {
- throw new InvalidDepartureAirportIdException(departureAirportId);
- }
-
- if (arriveAirportId == Guid.Empty)
- {
- throw new InvalidArriveAirportIdException(departureAirportId);
- }
-
- if (flightDate == default)
- {
- throw new InvalidFlightDateException(flightDate);
- }
-
- if (price < 0)
- {
- throw new InvalidPriceException(price);
- }
-
- if (string.IsNullOrWhiteSpace(seatNumber))
- {
- throw new SeatNumberException(seatNumber);
- }
-
- return new Trip(flightNumber, aircraftId, departureAirportId, arriveAirportId, flightDate, price, description, seatNumber);
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Data/BookingReadDbContext.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Data/BookingReadDbContext.cs
deleted file mode 100644
index 8c88c0f..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Booking/Data/BookingReadDbContext.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using BookingMonolith.Booking.Bookings.Models;
-using BuildingBlocks.Mongo;
-using Humanizer;
-using Microsoft.Extensions.Options;
-using MongoDB.Driver;
-
-namespace BookingMonolith.Booking.Data;
-
-
-public class BookingReadDbContext : MongoDbContext
-{
- public BookingReadDbContext(IOptions options) : base(options)
- {
- Booking = GetCollection(nameof(Booking).Underscore());
- }
-
- public IMongoCollection Booking { get; }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/BookingMonolith.csproj b/1-monolith-architecture-style/src/BookingMonolith/src/BookingMonolith.csproj
deleted file mode 100644
index 55c9efb..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/BookingMonolith.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- net9.0
- enable
- enable
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/BookingMonolithRoot.cs b/1-monolith-architecture-style/src/BookingMonolith/src/BookingMonolithRoot.cs
deleted file mode 100644
index 0f56d2e..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/BookingMonolithRoot.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace BookingMonolith;
-
-public class BookingMonolithRoot
-{
-
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Dtos/AircraftDto.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Dtos/AircraftDto.cs
deleted file mode 100644
index ec95561..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Dtos/AircraftDto.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-namespace BookingMonolith.Flight.Aircrafts.Dtos;
-
-public record AircraftDto(long Id, string Name, string Model, int ManufacturingYear);
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/AircraftAlreadyExistException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/AircraftAlreadyExistException.cs
deleted file mode 100644
index a313d41..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/AircraftAlreadyExistException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Net;
-using BuildingBlocks.Exception;
-
-namespace BookingMonolith.Flight.Aircrafts.Exceptions;
-
-public class AircraftAlreadyExistException : AppException
-{
- public AircraftAlreadyExistException() : base("Aircraft already exist!", HttpStatusCode.Conflict)
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidAircraftIdException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidAircraftIdException.cs
deleted file mode 100644
index 7e93540..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidAircraftIdException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.Exceptions;
-
-public class InvalidAircraftIdException : DomainException
-{
- public InvalidAircraftIdException(Guid aircraftId)
- : base($"AircraftId: '{aircraftId}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidManufacturingYearException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidManufacturingYearException.cs
deleted file mode 100644
index c608ae7..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidManufacturingYearException.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.Exceptions;
-
-public class InvalidManufacturingYearException : DomainException
-{
- public InvalidManufacturingYearException() : base("ManufacturingYear must be greater than 1900")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidModelException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidModelException.cs
deleted file mode 100644
index ed4a2e7..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidModelException.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.Exceptions;
-
-public class InvalidModelException : DomainException
-{
- public InvalidModelException() : base("Model cannot be empty or whitespace.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidNameException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidNameException.cs
deleted file mode 100644
index 00b6435..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Exceptions/InvalidNameException.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.Exceptions;
-
-public class InvalidNameException : DomainException
-{
- public InvalidNameException() : base("Name cannot be empty or whitespace.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/AircraftMappings.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/AircraftMappings.cs
deleted file mode 100644
index 633c694..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/AircraftMappings.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Features.CreatingAircraft.V1;
-using BookingMonolith.Flight.Aircrafts.Models;
-using BookingMonolith.Flight.Aircrafts.ValueObjects;
-using Mapster;
-using MassTransit;
-
-namespace BookingMonolith.Flight.Aircrafts.Features;
-
-public class AircraftMappings : IRegister
-{
- public void Register(TypeAdapterConfig config)
- {
- config.NewConfig()
- .Map(d => d.Id, s => NewId.NextGuid())
- .Map(d => d.AircraftId, s => AircraftId.Of(s.Id));
-
- config.NewConfig()
- .Map(d => d.Id, s => NewId.NextGuid())
- .Map(d => d.AircraftId, s => AircraftId.Of(s.Id.Value));
-
- config.NewConfig()
- .ConstructUsing(x => new CreatingAircraft.V1.CreateAircraft(x.Name, x.Model, x.ManufacturingYear));
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/CreatingAircraft/V1/CreateAircraft.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/CreatingAircraft/V1/CreateAircraft.cs
deleted file mode 100644
index d33df28..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/CreatingAircraft/V1/CreateAircraft.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using Ardalis.GuardClauses;
-using BookingMonolith.Flight.Aircrafts.Exceptions;
-using BookingMonolith.Flight.Aircrafts.Models;
-using BookingMonolith.Flight.Aircrafts.ValueObjects;
-using BookingMonolith.Flight.Data;
-using BuildingBlocks.Core.CQRS;
-using BuildingBlocks.Core.Event;
-using BuildingBlocks.Web;
-using Duende.IdentityServer.EntityFramework.Entities;
-using FluentValidation;
-using Mapster;
-using MapsterMapper;
-using MassTransit;
-using MediatR;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-using Microsoft.EntityFrameworkCore;
-
-namespace BookingMonolith.Flight.Aircrafts.Features.CreatingAircraft.V1;
-
-public record CreateAircraft(string Name, string Model, int ManufacturingYear) : ICommand,
- IInternalCommand
-{
- public Guid Id { get; init; } = NewId.NextGuid();
-}
-
-public record CreateAircraftResult(AircraftId Id);
-
-public record AircraftCreatedDomainEvent
- (Guid Id, string Name, string Model, int ManufacturingYear, bool IsDeleted) : IDomainEvent;
-
-public record CreateAircraftRequestDto(string Name, string Model, int ManufacturingYear);
-
-public record CreateAircraftResponseDto(Guid Id);
-
-public class CreateAircraftEndpoint : IMinimalEndpoint
-{
- public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
- {
- builder.MapPost($"{EndpointConfig.BaseApiPath}/flight/aircraft", async (CreateAircraftRequestDto request,
- IMediator mediator, IMapper mapper,
- CancellationToken cancellationToken) =>
- {
- var command = mapper.Map(request);
-
- var result = await mediator.Send(command, cancellationToken);
-
- var response = result.Adapt();
-
- return Results.Ok(response);
- })
- .RequireAuthorization(nameof(ApiScope))
- .WithName("CreateAircraft")
- .WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
- .Produces()
- .ProducesProblem(StatusCodes.Status400BadRequest)
- .WithSummary("Create Aircraft")
- .WithDescription("Create Aircraft")
- .WithOpenApi()
- .HasApiVersion(1.0);
-
- return builder;
- }
-}
-
-public class CreateAircraftValidator : AbstractValidator
-{
- public CreateAircraftValidator()
- {
- RuleFor(x => x.Model).NotEmpty().WithMessage("Model is required");
- RuleFor(x => x.Name).NotEmpty().WithMessage("Name is required");
- RuleFor(x => x.ManufacturingYear).NotEmpty().WithMessage("ManufacturingYear is required");
- }
-}
-
-internal class CreateAircraftHandler : IRequestHandler
-{
- private readonly FlightDbContext _flightDbContext;
-
- public CreateAircraftHandler(FlightDbContext flightDbContext)
- {
- _flightDbContext = flightDbContext;
- }
-
- public async Task Handle(CreateAircraft request, CancellationToken cancellationToken)
- {
- Guard.Against.Null(request, nameof(request));
-
- var aircraft = await _flightDbContext.Aircraft.SingleOrDefaultAsync(
- a => a.Model.Value == request.Model, cancellationToken);
-
- if (aircraft is not null)
- {
- throw new AircraftAlreadyExistException();
- }
-
- var aircraftEntity = Aircraft.Create(AircraftId.Of(request.Id), Name.Of(request.Name), Model.Of(request.Model), ManufacturingYear.Of(request.ManufacturingYear));
-
- var newAircraft = (await _flightDbContext.Aircraft.AddAsync(aircraftEntity, cancellationToken)).Entity;
-
- return new CreateAircraftResult(newAircraft.Id);
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/CreatingAircraft/V1/CreateAircraftMongo.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/CreatingAircraft/V1/CreateAircraftMongo.cs
deleted file mode 100644
index 11e4337..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Features/CreatingAircraft/V1/CreateAircraftMongo.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using Ardalis.GuardClauses;
-using BookingMonolith.Flight.Aircrafts.Exceptions;
-using BookingMonolith.Flight.Aircrafts.Models;
-using BookingMonolith.Flight.Data;
-using BuildingBlocks.Core.CQRS;
-using BuildingBlocks.Core.Event;
-using MapsterMapper;
-using MediatR;
-using MongoDB.Driver;
-using MongoDB.Driver.Linq;
-
-namespace BookingMonolith.Flight.Aircrafts.Features.CreatingAircraft.V1;
-
-public record CreateAircraftMongo(Guid Id, string Name, string Model, int ManufacturingYear, bool IsDeleted = false) : InternalCommand;
-
-internal class CreateAircraftMongoHandler : ICommandHandler
-{
- private readonly FlightReadDbContext _flightReadDbContext;
- private readonly IMapper _mapper;
-
- public CreateAircraftMongoHandler(
- FlightReadDbContext flightReadDbContext,
- IMapper mapper)
- {
- _flightReadDbContext = flightReadDbContext;
- _mapper = mapper;
- }
-
- public async Task Handle(CreateAircraftMongo request, CancellationToken cancellationToken)
- {
- Guard.Against.Null(request, nameof(request));
-
- var aircraftReadModel = _mapper.Map(request);
-
- var aircraft = await _flightReadDbContext.Aircraft.AsQueryable()
- .FirstOrDefaultAsync(x => x.AircraftId == aircraftReadModel.AircraftId &&
- !x.IsDeleted, cancellationToken);
-
- if (aircraft is not null)
- {
- throw new AircraftAlreadyExistException();
- }
-
- await _flightReadDbContext.Aircraft.InsertOneAsync(aircraftReadModel, cancellationToken: cancellationToken);
-
- return Unit.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Models/Aircraft.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Models/Aircraft.cs
deleted file mode 100644
index bed0ddb..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Models/Aircraft.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Features.CreatingAircraft.V1;
-using BookingMonolith.Flight.Aircrafts.ValueObjects;
-using BuildingBlocks.Core.Model;
-
-namespace BookingMonolith.Flight.Aircrafts.Models;
-
-public record Aircraft : Aggregate
-{
- public Name Name { get; private set; } = default!;
- public Model Model { get; private set; } = default!;
- public ManufacturingYear ManufacturingYear { get; private set; } = default!;
-
- public static Aircraft Create(AircraftId id, Name name, Model model, ManufacturingYear manufacturingYear, bool isDeleted = false)
- {
- var aircraft = new Aircraft
- {
- Id = id,
- Name = name,
- Model = model,
- ManufacturingYear = manufacturingYear
- };
-
- var @event = new AircraftCreatedDomainEvent(
- aircraft.Id,
- aircraft.Name,
- aircraft.Model,
- aircraft.ManufacturingYear,
- isDeleted);
-
- aircraft.AddDomainEvent(@event);
-
- return aircraft;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Models/AircraftReadModel.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Models/AircraftReadModel.cs
deleted file mode 100644
index e4c7f3a..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/Models/AircraftReadModel.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace BookingMonolith.Flight.Aircrafts.Models;
-
-public class AircraftReadModel
-{
- public required Guid Id { get; init; }
- public required Guid AircraftId { get; init; }
- public required string Name { get; init; }
- public required string Model { get; init; }
- public required int ManufacturingYear { get; init; }
- public required bool IsDeleted { get; init; }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/AircraftId.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/AircraftId.cs
deleted file mode 100644
index 4fbe3cb..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/AircraftId.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.ValueObjects;
-
-public record AircraftId
-{
- public Guid Value { get; }
-
- private AircraftId(Guid value)
- {
- Value = value;
- }
-
- public static AircraftId Of(Guid value)
- {
- if (value == Guid.Empty)
- {
- throw new InvalidAircraftIdException(value);
- }
-
- return new AircraftId(value);
- }
-
- public static implicit operator Guid(AircraftId aircraftId)
- {
- return aircraftId.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/ManufacturingYear.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/ManufacturingYear.cs
deleted file mode 100644
index 63951b9..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/ManufacturingYear.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.ValueObjects;
-
-public record ManufacturingYear
-{
- public int Value { get; }
-
- private ManufacturingYear(int value)
- {
- Value = value;
- }
-
- public static ManufacturingYear Of(int value)
- {
- if (value < 1900)
- {
- throw new InvalidManufacturingYearException();
- }
-
- return new ManufacturingYear(value);
- }
-
- public static implicit operator int(ManufacturingYear manufacturingYear)
- {
- return manufacturingYear.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/Model.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/Model.cs
deleted file mode 100644
index f13b6af..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/Model.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.ValueObjects;
-
-public record Model
-{
- public string Value { get; }
-
- private Model(string value)
- {
- Value = value;
- }
-
- public static Model Of(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new InvalidModelException();
- }
-
- return new Model(value);
- }
-
- public static implicit operator string(Model model)
- {
- return model.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/Name.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/Name.cs
deleted file mode 100644
index 22136fc..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Aircrafts/ValueObjects/Name.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Exceptions;
-
-namespace BookingMonolith.Flight.Aircrafts.ValueObjects;
-
-public record Name
-{
- public string Value { get; }
-
- private Name(string value)
- {
- Value = value;
- }
-
- public static Name Of(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new InvalidNameException();
- }
-
- return new Name(value);
- }
-
- public static implicit operator string(Name name)
- {
- return name.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Dtos/AirportDto.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Dtos/AirportDto.cs
deleted file mode 100644
index db55c61..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Dtos/AirportDto.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-namespace BookingMonolith.Flight.Airports.Dtos;
-
-public record AirportDto(long Id, string Name, string Address, string Code);
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/AirportAlreadyExistException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/AirportAlreadyExistException.cs
deleted file mode 100644
index 59cebd4..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/AirportAlreadyExistException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Net;
-using BuildingBlocks.Exception;
-
-namespace BookingMonolith.Flight.Airports.Exceptions;
-
-public class AirportAlreadyExistException : AppException
-{
- public AirportAlreadyExistException(int? code = default) : base("Airport already exist!", HttpStatusCode.Conflict, code)
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidAddressException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidAddressException.cs
deleted file mode 100644
index 9cdb412..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidAddressException.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.Exceptions;
-
-public class InvalidAddressException : DomainException
-{
- public InvalidAddressException() : base("Address cannot be empty or whitespace.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidAirportIdException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidAirportIdException.cs
deleted file mode 100644
index f13b54b..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidAirportIdException.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.Exceptions;
-
-public class InvalidAirportIdException : DomainException
-{
- public InvalidAirportIdException(Guid airportId)
- : base($"airportId: '{airportId}' is invalid.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidCodeException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidCodeException.cs
deleted file mode 100644
index d5f8f35..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidCodeException.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.Exceptions;
-
-public class InvalidCodeException : DomainException
-{
- public InvalidCodeException() : base("Code cannot be empty or whitespace.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidNameException.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidNameException.cs
deleted file mode 100644
index b4e06c3..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Exceptions/InvalidNameException.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using SmartCharging.Infrastructure.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.Exceptions;
-
-public class InvalidNameException : DomainException
-{
- public InvalidNameException() : base("Name cannot be empty or whitespace.")
- {
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/AirportMappings.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/AirportMappings.cs
deleted file mode 100644
index ffb4324..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/AirportMappings.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using BookingMonolith.Flight.Airports.Features.CreatingAirport.V1;
-using BookingMonolith.Flight.Airports.Models;
-using Mapster;
-using MassTransit;
-
-namespace BookingMonolith.Flight.Airports.Features;
-
-public class AirportMappings : IRegister
-{
- public void Register(TypeAdapterConfig config)
- {
- config.NewConfig()
- .Map(d => d.Id, s => NewId.NextGuid())
- .Map(d => d.AirportId, s => s.Id);
-
- config.NewConfig()
- .Map(d => d.Id, s => NewId.NextGuid())
- .Map(d => d.AirportId, s => s.Id.Value);
-
- config.NewConfig()
- .ConstructUsing(x => new CreateAirport(x.Name, x.Address, x.Code));
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/CreatingAirport/V1/CreateAirport.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/CreatingAirport/V1/CreateAirport.cs
deleted file mode 100644
index 53043f5..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/CreatingAirport/V1/CreateAirport.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-using Ardalis.GuardClauses;
-using BookingMonolith.Flight.Airports.Exceptions;
-using BookingMonolith.Flight.Airports.ValueObjects;
-using BookingMonolith.Flight.Data;
-using BuildingBlocks.Core.CQRS;
-using BuildingBlocks.Core.Event;
-using BuildingBlocks.Web;
-using Duende.IdentityServer.EntityFramework.Entities;
-using FluentValidation;
-using Mapster;
-using MapsterMapper;
-using MassTransit;
-using MediatR;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-using Microsoft.EntityFrameworkCore;
-
-namespace BookingMonolith.Flight.Airports.Features.CreatingAirport.V1;
-
-public record CreateAirport(string Name, string Address, string Code) : ICommand, IInternalCommand
-{
- public Guid Id { get; init; } = NewId.NextGuid();
-}
-
-public record CreateAirportResult(Guid Id);
-
-public record AirportCreatedDomainEvent
- (Guid Id, string Name, string Address, string Code, bool IsDeleted) : IDomainEvent;
-
-public record CreateAirportRequestDto(string Name, string Address, string Code);
-
-public record CreateAirportResponseDto(Guid Id);
-
-public class CreateAirportEndpoint : IMinimalEndpoint
-{
- public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
- {
- builder.MapPost($"{EndpointConfig.BaseApiPath}/flight/airport", async (CreateAirportRequestDto request,
- IMediator mediator, IMapper mapper,
- CancellationToken cancellationToken) =>
- {
- var command = mapper.Map(request);
-
- var result = await mediator.Send(command, cancellationToken);
-
- var response = result.Adapt();
-
- return Results.Ok(response);
- })
- .RequireAuthorization(nameof(ApiScope))
- .WithName("CreateAirport")
- .WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
- .Produces()
- .ProducesProblem(StatusCodes.Status400BadRequest)
- .WithSummary("Create Airport")
- .WithDescription("Create Airport")
- .WithOpenApi()
- .HasApiVersion(1.0);
-
- return builder;
- }
-}
-
-public class CreateAirportValidator : AbstractValidator
-{
- public CreateAirportValidator()
- {
- RuleFor(x => x.Code).NotEmpty().WithMessage("Code is required");
- RuleFor(x => x.Name).NotEmpty().WithMessage("Name is required");
- RuleFor(x => x.Address).NotEmpty().WithMessage("Address is required");
- }
-}
-
-internal class CreateAirportHandler : IRequestHandler
-{
- private readonly FlightDbContext _flightDbContext;
-
- public CreateAirportHandler(FlightDbContext flightDbContext)
- {
- _flightDbContext = flightDbContext;
- }
-
- public async Task Handle(CreateAirport request, CancellationToken cancellationToken)
- {
- Guard.Against.Null(request, nameof(request));
-
- var airport =
- await _flightDbContext.Airports.SingleOrDefaultAsync(x => x.Code.Value == request.Code, cancellationToken);
-
- if (airport is not null)
- {
- throw new AirportAlreadyExistException();
- }
-
- var airportEntity = Models.Airport.Create(AirportId.Of(request.Id), Name.Of(request.Name), Address.Of(request.Address), Code.Of(request.Code));
-
- var newAirport = (await _flightDbContext.Airports.AddAsync(airportEntity, cancellationToken)).Entity;
-
- return new CreateAirportResult(newAirport.Id);
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/CreatingAirport/V1/CreateAirportMongo.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/CreatingAirport/V1/CreateAirportMongo.cs
deleted file mode 100644
index 1a961c8..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Features/CreatingAirport/V1/CreateAirportMongo.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using Ardalis.GuardClauses;
-using BookingMonolith.Flight.Airports.Exceptions;
-using BookingMonolith.Flight.Airports.Models;
-using BookingMonolith.Flight.Data;
-using BuildingBlocks.Core.CQRS;
-using BuildingBlocks.Core.Event;
-using MapsterMapper;
-using MediatR;
-using MongoDB.Driver;
-using MongoDB.Driver.Linq;
-
-namespace BookingMonolith.Flight.Airports.Features.CreatingAirport.V1;
-
-public record CreateAirportMongo(Guid Id, string Name, string Address, string Code, bool IsDeleted = false) : InternalCommand;
-
-internal class CreateAirportMongoHandler : ICommandHandler
-{
- private readonly FlightReadDbContext _flightReadDbContext;
- private readonly IMapper _mapper;
-
- public CreateAirportMongoHandler(
- FlightReadDbContext flightReadDbContext,
- IMapper mapper)
- {
- _flightReadDbContext = flightReadDbContext;
- _mapper = mapper;
- }
-
- public async Task Handle(CreateAirportMongo request, CancellationToken cancellationToken)
- {
- Guard.Against.Null(request, nameof(request));
-
- var airportReadModel = _mapper.Map(request);
-
- var aircraft = await _flightReadDbContext.Airport.AsQueryable()
- .FirstOrDefaultAsync(x => x.AirportId == airportReadModel.AirportId &&
- !x.IsDeleted, cancellationToken);
-
- if (aircraft is not null)
- {
- throw new AirportAlreadyExistException();
- }
-
- await _flightReadDbContext.Airport.InsertOneAsync(airportReadModel, cancellationToken: cancellationToken);
-
- return Unit.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Models/Airport.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Models/Airport.cs
deleted file mode 100644
index fb25307..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Models/Airport.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using BookingMonolith.Flight.Airports.Features.CreatingAirport.V1;
-using BookingMonolith.Flight.Airports.ValueObjects;
-using BuildingBlocks.Core.Model;
-
-namespace BookingMonolith.Flight.Airports.Models;
-
-public record Airport : Aggregate
-{
- public Name Name { get; private set; } = default!;
- public Address Address { get; private set; } = default!;
- public Code Code { get; private set; } = default!;
-
- public static Airport Create(AirportId id, Name name, Address address, Code code, bool isDeleted = false)
- {
- var airport = new Airport
- {
- Id = id,
- Name = name,
- Address = address,
- Code = code
- };
-
- var @event = new AirportCreatedDomainEvent(
- airport.Id,
- airport.Name,
- airport.Address,
- airport.Code,
- isDeleted);
-
- airport.AddDomainEvent(@event);
-
- return airport;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Models/AirportReadModel.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Models/AirportReadModel.cs
deleted file mode 100644
index a0afa00..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/Models/AirportReadModel.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace BookingMonolith.Flight.Airports.Models;
-
-public class AirportReadModel
-{
- public required Guid Id { get; init; }
- public required Guid AirportId { get; init; }
- public required string Name { get; init; }
- public string Address { get; init; }
- public required string Code { get; init; }
- public required bool IsDeleted { get; init; }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Address.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Address.cs
deleted file mode 100644
index b4d1dfd..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Address.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Airports.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.ValueObjects;
-
-public class Address
-{
- public string Value { get; }
-
- private Address(string value)
- {
- Value = value;
- }
-
- public static Address Of(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new InvalidAddressException();
- }
-
- return new Address(value);
- }
-
- public static implicit operator string(Address address)
- {
- return address.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/AirportId.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/AirportId.cs
deleted file mode 100644
index a203d75..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/AirportId.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Airports.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.ValueObjects;
-
-public record AirportId
-{
- public Guid Value { get; }
-
- private AirportId(Guid value)
- {
- Value = value;
- }
-
- public static AirportId Of(Guid value)
- {
- if (value == Guid.Empty)
- {
- throw new InvalidAirportIdException(value);
- }
-
- return new AirportId(value);
- }
-
- public static implicit operator Guid(AirportId airportId)
- {
- return airportId.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Code.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Code.cs
deleted file mode 100644
index d6560d9..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Code.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Airports.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.ValueObjects;
-
-public record Code
-{
- public string Value { get; }
-
- private Code(string value)
- {
- Value = value;
- }
-
- public static Code Of(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new InvalidCodeException();
- }
-
- return new Code(value);
- }
-
- public static implicit operator string(Code code)
- {
- return code.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Name.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Name.cs
deleted file mode 100644
index 7e6e1e9..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Airports/ValueObjects/Name.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using BookingMonolith.Flight.Airports.Exceptions;
-
-namespace BookingMonolith.Flight.Airports.ValueObjects;
-
-public record Name
-{
- public string Value { get; }
-
- private Name(string value)
- {
- Value = value;
- }
-
- public static Name Of(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new InvalidNameException();
- }
-
- return new Name(value);
- }
-
- public static implicit operator string(Name name)
- {
- return name.Value;
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/AircraftConfiguration.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/AircraftConfiguration.cs
deleted file mode 100644
index 53d6634..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/AircraftConfiguration.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Models;
-using BookingMonolith.Flight.Aircrafts.ValueObjects;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
-namespace BookingMonolith.Flight.Data.Configurations;
-
-[RegisterFlightConfiguration]
-public class AircraftConfiguration : IEntityTypeConfiguration
-{
- public void Configure(EntityTypeBuilder builder)
- {
-
- builder.ToTable(nameof(Aircraft));
-
- builder.HasKey(r => r.Id);
- builder.Property(r => r.Id).ValueGeneratedNever()
- .HasConversion(aircraftId => aircraftId.Value, dbId => AircraftId.Of(dbId));
-
- builder.Property(r => r.Version).IsConcurrencyToken();
-
- builder.OwnsOne(
- x => x.Name,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Aircraft.Name))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
-
- builder.OwnsOne(
- x => x.Model,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Aircraft.Model))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
-
- builder.OwnsOne(
- x => x.ManufacturingYear,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Aircraft.ManufacturingYear))
- .HasMaxLength(5)
- .IsRequired();
- }
- );
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/AirportConfiguration.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/AirportConfiguration.cs
deleted file mode 100644
index 24812b6..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/AirportConfiguration.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using BookingMonolith.Flight.Airports.Models;
-using BookingMonolith.Flight.Airports.ValueObjects;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
-namespace BookingMonolith.Flight.Data.Configurations;
-
-[RegisterFlightConfiguration]
-public class AirportConfiguration : IEntityTypeConfiguration
-{
- public void Configure(EntityTypeBuilder builder)
- {
-
- builder.ToTable(nameof(Airport));
-
- builder.HasKey(r => r.Id);
- builder.Property(r => r.Id).ValueGeneratedNever()
- .HasConversion(airportId => airportId.Value, dbId => AirportId.Of(dbId));
- // // ref: https://learn.microsoft.com/en-us/ef/core/saving/concurrency?tabs=fluent-api
- builder.Property(r => r.Version).IsConcurrencyToken();
-
-
- builder.OwnsOne(
- x => x.Name,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Airport.Name))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
-
- builder.OwnsOne(
- x => x.Address,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Airport.Address))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
-
- builder.OwnsOne(
- x => x.Code,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Airport.Code))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/FlightConfiguration.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/FlightConfiguration.cs
deleted file mode 100644
index b3f3b36..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/FlightConfiguration.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Models;
-using BookingMonolith.Flight.Airports.Models;
-using BookingMonolith.Flight.Flights.ValueObjects;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
-
-namespace BookingMonolith.Flight.Data.Configurations;
-
-[RegisterFlightConfiguration]
-public class FlightConfiguration : IEntityTypeConfiguration
-{
- public void Configure(EntityTypeBuilder builder)
- {
- RelationalEntityTypeBuilderExtensions.ToTable((EntityTypeBuilder)builder, nameof(Flight));
-
- builder.HasKey(r => r.Id);
- builder.Property(r => r.Id).ValueGeneratedNever()
- .HasConversion(flight => flight.Value, dbId => FlightId.Of(dbId));
-
- builder.Property(r => r.Version).IsConcurrencyToken();
-
-
- builder.OwnsOne(
- x => x.FlightNumber,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Flights.Models.Flight.FlightNumber))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
-
- builder
- .HasOne()
- .WithMany()
- .HasForeignKey(p => p.AircraftId)
- .IsRequired();
-
- builder
- .HasOne()
- .WithMany()
- .HasForeignKey(d => d.DepartureAirportId)
- .IsRequired();
-
- builder
- .HasOne()
- .WithMany()
- .HasForeignKey(d => d.ArriveAirportId)
- .IsRequired();
-
-
- builder.OwnsOne(
- x => x.DurationMinutes,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Flights.Models.Flight.DurationMinutes))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
-
- builder.Property(x => x.Status)
- .HasDefaultValue(Flights.Enums.FlightStatus.Unknown)
- .HasConversion(
- x => x.ToString(),
- x => (Flights.Enums.FlightStatus)Enum.Parse(typeof(Flights.Enums.FlightStatus), x));
-
- builder.OwnsOne(
- x => x.Price,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Flights.Models.Flight.Price))
- .HasMaxLength(10)
- .IsRequired();
- }
- );
-
- builder.OwnsOne(
- x => x.ArriveDate,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Flights.Models.Flight.ArriveDate))
- .IsRequired();
- }
- );
-
- builder.OwnsOne(
- x => x.DepartureDate,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Flights.Models.Flight.DepartureDate))
- .IsRequired();
- }
- );
-
- builder.OwnsOne(
- x => x.FlightDate,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Flights.Models.Flight.FlightDate))
- .IsRequired();
- }
- );
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/SeatConfiguration.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/SeatConfiguration.cs
deleted file mode 100644
index e76ed31..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Configurations/SeatConfiguration.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using BookingMonolith.Flight.Seats.Models;
-using BookingMonolith.Flight.Seats.ValueObjects;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
-namespace BookingMonolith.Flight.Data.Configurations;
-
-[RegisterFlightConfiguration]
-public class SeatConfiguration : IEntityTypeConfiguration
-{
- public void Configure(EntityTypeBuilder builder)
- {
- builder.ToTable(nameof(Seat));
-
- builder.HasKey(r => r.Id);
- builder.Property(r => r.Id).ValueGeneratedNever()
- .HasConversion(seatId => seatId.Value, dbId => SeatId.Of(dbId));
-
- builder.Property(r => r.Version).IsConcurrencyToken();
-
- builder.OwnsOne(
- x => x.SeatNumber,
- a =>
- {
- a.Property(p => p.Value)
- .HasColumnName(nameof(Seat.SeatNumber))
- .HasMaxLength(50)
- .IsRequired();
- }
- );
-
- builder
- .HasOne()
- .WithMany()
- .HasForeignKey(p => p.FlightId);
-
- builder.Property(x => x.Class)
- .HasDefaultValue(Seats.Enums.SeatClass.Unknown)
- .HasConversion(
- x => x.ToString(),
- x => (Seats.Enums.SeatClass)Enum.Parse(typeof(Seats.Enums.SeatClass), x));
-
- builder.Property(x => x.Type)
- .HasDefaultValue(Seats.Enums.SeatType.Unknown)
- .HasConversion(
- x => x.ToString(),
- x => (Seats.Enums.SeatType)Enum.Parse(typeof(Seats.Enums.SeatType), x));
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/DesignTimeDbContextFactory.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/DesignTimeDbContextFactory.cs
deleted file mode 100644
index 018ec62..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/DesignTimeDbContextFactory.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Design;
-
-namespace BookingMonolith.Flight.Data
-{
- public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory
- {
- public FlightDbContext CreateDbContext(string[] args)
- {
- var builder = new DbContextOptionsBuilder();
-
- builder.UseNpgsql("Server=localhost;Port=5432;Database=booking_monolith;User Id=postgres;Password=postgres;Include Error Detail=true")
- .UseSnakeCaseNamingConvention();
- return new FlightDbContext(builder.Options);
- }
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/EfTxFlightBehavior.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/EfTxFlightBehavior.cs
deleted file mode 100644
index 44c706b..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/EfTxFlightBehavior.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-using System.Text.Json;
-using System.Transactions;
-using BuildingBlocks.Core;
-using BuildingBlocks.PersistMessageProcessor;
-using BuildingBlocks.Polly;
-using MediatR;
-using Microsoft.Extensions.Logging;
-
-namespace BookingMonolith.Flight.Data;
-
-public class EfTxFlightBehavior : IPipelineBehavior
-where TRequest : notnull, IRequest
-where TResponse : notnull
-{
- private readonly ILogger> _logger;
- private readonly FlightDbContext _flightDbContext;
- private readonly IPersistMessageDbContext _persistMessageDbContext;
- private readonly IEventDispatcher _eventDispatcher;
-
- public EfTxFlightBehavior(
- ILogger> logger,
- FlightDbContext flightDbContext,
- IPersistMessageDbContext persistMessageDbContext,
- IEventDispatcher eventDispatcher
- )
- {
- _logger = logger;
- _flightDbContext = flightDbContext;
- _persistMessageDbContext = persistMessageDbContext;
- _eventDispatcher = eventDispatcher;
- }
-
- public async Task Handle(
- TRequest request,
- RequestHandlerDelegate next,
- CancellationToken cancellationToken
- )
- {
- _logger.LogInformation(
- "{Prefix} Handled command {MediatrRequest}",
- GetType().Name,
- typeof(TRequest).FullName);
-
- _logger.LogDebug(
- "{Prefix} Handled command {MediatrRequest} with content {RequestContent}",
- GetType().Name,
- typeof(TRequest).FullName,
- JsonSerializer.Serialize(request));
-
- var response = await next();
-
- _logger.LogInformation(
- "{Prefix} Executed the {MediatrRequest} request",
- GetType().Name,
- typeof(TRequest).FullName);
-
- while (true)
- {
- var domainEvents = _flightDbContext.GetDomainEvents();
-
- if (domainEvents is null || !domainEvents.Any())
- {
- return response;
- }
-
- _logger.LogInformation(
- "{Prefix} Open the transaction for {MediatrRequest}",
- GetType().Name,
- typeof(TRequest).FullName);
-
- using var scope = new TransactionScope(
- TransactionScopeOption.Required,
- new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted },
- TransactionScopeAsyncFlowOption.Enabled);
-
- await _eventDispatcher.SendAsync(
- domainEvents.ToArray(),
- typeof(TRequest),
- cancellationToken);
-
- // Save data to database with some retry policy in distributed transaction
- await _flightDbContext.RetryOnFailure(
- async () =>
- {
- await _flightDbContext.SaveChangesAsync(cancellationToken);
- });
-
- // Save data to database with some retry policy in distributed transaction
- await _persistMessageDbContext.RetryOnFailure(
- async () =>
- {
- await _persistMessageDbContext.SaveChangesAsync(cancellationToken);
- });
-
- scope.Complete();
-
- return response;
- }
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/FlightDbContext.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/FlightDbContext.cs
deleted file mode 100644
index 811848d..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/FlightDbContext.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System.Reflection;
-using BookingMonolith.Flight.Aircrafts.Models;
-using BookingMonolith.Flight.Airports.Models;
-using BookingMonolith.Flight.Seats.Models;
-using BuildingBlocks.EFCore;
-using BuildingBlocks.Web;
-using Humanizer;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Logging;
-
-namespace BookingMonolith.Flight.Data;
-
-public sealed class FlightDbContext : AppDbContextBase
-{
- public FlightDbContext(DbContextOptions options, ICurrentUserProvider? currentUserProvider = null,
- ILogger? logger = null) : base(
- options, currentUserProvider, logger)
- {
- }
-
- public DbSet Flights => Set();
- public DbSet Airports => Set();
- public DbSet Aircraft => Set();
- public DbSet Seats => Set();
-
- protected override void OnModelCreating(ModelBuilder builder)
- {
- base.OnModelCreating(builder);
-
- var types = typeof(FlightRoot).Assembly.GetTypes()
- .Where(t => t.GetCustomAttribute() != null)
- .ToList();
-
- foreach (var type in types)
- {
- dynamic configuration = Activator.CreateInstance(type)!;
- builder.ApplyConfiguration(configuration);
- }
-
- builder.HasDefaultSchema(nameof(Flight).Underscore());
- builder.FilterSoftDeletedProperties();
- builder.ToSnakeCaseTables();
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/FlightReadDbContext.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/FlightReadDbContext.cs
deleted file mode 100644
index 2fda15d..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/FlightReadDbContext.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using BookingMonolith.Flight.Aircrafts.Models;
-using BookingMonolith.Flight.Airports.Models;
-using BookingMonolith.Flight.Flights.Models;
-using BookingMonolith.Flight.Seats.Models;
-using BuildingBlocks.Mongo;
-using Humanizer;
-using Microsoft.Extensions.Options;
-using MongoDB.Driver;
-
-namespace BookingMonolith.Flight.Data;
-
-public class FlightReadDbContext : MongoDbContext
-{
- public FlightReadDbContext(IOptions options) : base(options)
- {
- Flight = GetCollection(nameof(Flight).Underscore());
- Aircraft = GetCollection(nameof(Aircraft).Underscore());
- Airport = GetCollection(nameof(Airport).Underscore());
- Seat = GetCollection(nameof(Seat).Underscore());
- }
-
- public IMongoCollection Flight { get; }
- public IMongoCollection Aircraft { get; }
- public IMongoCollection Airport { get; }
- public IMongoCollection Seat { get; }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/20250407215512_initial.Designer.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/20250407215512_initial.Designer.cs
deleted file mode 100644
index 0a74e59..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/20250407215512_initial.Designer.cs
+++ /dev/null
@@ -1,584 +0,0 @@
-//
-using System;
-using BookingMonolith.Flight.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace BookingMonolith.Flight.Data.Migrations
-{
- [DbContext(typeof(FlightDbContext))]
- [Migration("20250407215512_initial")]
- partial class initial
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasDefaultSchema("flight")
- .HasAnnotation("ProductVersion", "9.0.0")
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("BookingMonolith.Flight.Aircrafts.Models.Aircraft", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property("Version")
- .IsConcurrencyToken()
- .HasColumnType("bigint")
- .HasColumnName("version");
-
- b.HasKey("Id")
- .HasName("pk_aircraft");
-
- b.ToTable("aircraft", "flight");
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Airports.Models.Airport", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property("Version")
- .IsConcurrencyToken()
- .HasColumnType("bigint")
- .HasColumnName("version");
-
- b.HasKey("Id")
- .HasName("pk_airport");
-
- b.ToTable("airport", "flight");
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Flights.Models.Flight", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("AircraftId")
- .HasColumnType("uuid")
- .HasColumnName("aircraft_id");
-
- b.Property("ArriveAirportId")
- .HasColumnType("uuid")
- .HasColumnName("arrive_airport_id");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("DepartureAirportId")
- .HasColumnType("uuid")
- .HasColumnName("departure_airport_id");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property("Status")
- .IsRequired()
- .ValueGeneratedOnAdd()
- .HasColumnType("text")
- .HasDefaultValue("Unknown")
- .HasColumnName("status");
-
- b.Property("Version")
- .IsConcurrencyToken()
- .HasColumnType("bigint")
- .HasColumnName("version");
-
- b.HasKey("Id")
- .HasName("pk_flight");
-
- b.HasIndex("AircraftId")
- .HasDatabaseName("ix_flight_aircraft_id");
-
- b.HasIndex("ArriveAirportId")
- .HasDatabaseName("ix_flight_arrive_airport_id");
-
- b.HasIndex("DepartureAirportId")
- .HasDatabaseName("ix_flight_departure_airport_id");
-
- b.ToTable("flight", "flight");
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Seats.Models.Seat", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("Class")
- .IsRequired()
- .ValueGeneratedOnAdd()
- .HasColumnType("text")
- .HasDefaultValue("Unknown")
- .HasColumnName("class");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("flight_id");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property("Type")
- .IsRequired()
- .ValueGeneratedOnAdd()
- .HasColumnType("text")
- .HasDefaultValue("Unknown")
- .HasColumnName("type");
-
- b.Property("Version")
- .IsConcurrencyToken()
- .HasColumnType("bigint")
- .HasColumnName("version");
-
- b.HasKey("Id")
- .HasName("pk_seat");
-
- b.HasIndex("FlightId")
- .HasDatabaseName("ix_seat_flight_id");
-
- b.ToTable("seat", "flight");
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Aircrafts.Models.Aircraft", b =>
- {
- b.OwnsOne("BookingMonolith.Flight.Aircrafts.ValueObjects.ManufacturingYear", "ManufacturingYear", b1 =>
- {
- b1.Property("AircraftId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .HasMaxLength(5)
- .HasColumnType("integer")
- .HasColumnName("manufacturing_year");
-
- b1.HasKey("AircraftId")
- .HasName("pk_aircraft");
-
- b1.ToTable("aircraft", "flight");
-
- b1.WithOwner()
- .HasForeignKey("AircraftId")
- .HasConstraintName("fk_aircraft_aircraft_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Aircrafts.ValueObjects.Model", "Model", b1 =>
- {
- b1.Property("AircraftId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)")
- .HasColumnName("model");
-
- b1.HasKey("AircraftId")
- .HasName("pk_aircraft");
-
- b1.ToTable("aircraft", "flight");
-
- b1.WithOwner()
- .HasForeignKey("AircraftId")
- .HasConstraintName("fk_aircraft_aircraft_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Aircrafts.ValueObjects.Name", "Name", b1 =>
- {
- b1.Property("AircraftId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)")
- .HasColumnName("name");
-
- b1.HasKey("AircraftId")
- .HasName("pk_aircraft");
-
- b1.ToTable("aircraft", "flight");
-
- b1.WithOwner()
- .HasForeignKey("AircraftId")
- .HasConstraintName("fk_aircraft_aircraft_id");
- });
-
- b.Navigation("ManufacturingYear")
- .IsRequired();
-
- b.Navigation("Model")
- .IsRequired();
-
- b.Navigation("Name")
- .IsRequired();
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Airports.Models.Airport", b =>
- {
- b.OwnsOne("BookingMonolith.Flight.Airports.ValueObjects.Address", "Address", b1 =>
- {
- b1.Property("AirportId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)")
- .HasColumnName("address");
-
- b1.HasKey("AirportId")
- .HasName("pk_airport");
-
- b1.ToTable("airport", "flight");
-
- b1.WithOwner()
- .HasForeignKey("AirportId")
- .HasConstraintName("fk_airport_airport_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Airports.ValueObjects.Code", "Code", b1 =>
- {
- b1.Property("AirportId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)")
- .HasColumnName("code");
-
- b1.HasKey("AirportId")
- .HasName("pk_airport");
-
- b1.ToTable("airport", "flight");
-
- b1.WithOwner()
- .HasForeignKey("AirportId")
- .HasConstraintName("fk_airport_airport_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Airports.ValueObjects.Name", "Name", b1 =>
- {
- b1.Property("AirportId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)")
- .HasColumnName("name");
-
- b1.HasKey("AirportId")
- .HasName("pk_airport");
-
- b1.ToTable("airport", "flight");
-
- b1.WithOwner()
- .HasForeignKey("AirportId")
- .HasConstraintName("fk_airport_airport_id");
- });
-
- b.Navigation("Address")
- .IsRequired();
-
- b.Navigation("Code")
- .IsRequired();
-
- b.Navigation("Name")
- .IsRequired();
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Flights.Models.Flight", b =>
- {
- b.HasOne("BookingMonolith.Flight.Aircrafts.Models.Aircraft", null)
- .WithMany()
- .HasForeignKey("AircraftId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_flight_aircraft_aircraft_id");
-
- b.HasOne("BookingMonolith.Flight.Airports.Models.Airport", null)
- .WithMany()
- .HasForeignKey("ArriveAirportId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_flight_airport_arrive_airport_id");
-
- b.HasOne("BookingMonolith.Flight.Airports.Models.Airport", null)
- .WithMany()
- .HasForeignKey("DepartureAirportId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_flight_airport_departure_airport_id");
-
- b.OwnsOne("BookingMonolith.Flight.Flights.ValueObjects.ArriveDate", "ArriveDate", b1 =>
- {
- b1.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("arrive_date");
-
- b1.HasKey("FlightId")
- .HasName("pk_flight");
-
- b1.ToTable("flight", "flight");
-
- b1.WithOwner()
- .HasForeignKey("FlightId")
- .HasConstraintName("fk_flight_flight_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Flights.ValueObjects.DepartureDate", "DepartureDate", b1 =>
- {
- b1.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("departure_date");
-
- b1.HasKey("FlightId")
- .HasName("pk_flight");
-
- b1.ToTable("flight", "flight");
-
- b1.WithOwner()
- .HasForeignKey("FlightId")
- .HasConstraintName("fk_flight_flight_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Flights.ValueObjects.DurationMinutes", "DurationMinutes", b1 =>
- {
- b1.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .HasMaxLength(50)
- .HasColumnType("numeric")
- .HasColumnName("duration_minutes");
-
- b1.HasKey("FlightId")
- .HasName("pk_flight");
-
- b1.ToTable("flight", "flight");
-
- b1.WithOwner()
- .HasForeignKey("FlightId")
- .HasConstraintName("fk_flight_flight_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Flights.ValueObjects.FlightDate", "FlightDate", b1 =>
- {
- b1.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("flight_date");
-
- b1.HasKey("FlightId")
- .HasName("pk_flight");
-
- b1.ToTable("flight", "flight");
-
- b1.WithOwner()
- .HasForeignKey("FlightId")
- .HasConstraintName("fk_flight_flight_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Flights.ValueObjects.FlightNumber", "FlightNumber", b1 =>
- {
- b1.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)")
- .HasColumnName("flight_number");
-
- b1.HasKey("FlightId")
- .HasName("pk_flight");
-
- b1.ToTable("flight", "flight");
-
- b1.WithOwner()
- .HasForeignKey("FlightId")
- .HasConstraintName("fk_flight_flight_id");
- });
-
- b.OwnsOne("BookingMonolith.Flight.Flights.ValueObjects.Price", "Price", b1 =>
- {
- b1.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .HasMaxLength(10)
- .HasColumnType("numeric")
- .HasColumnName("price");
-
- b1.HasKey("FlightId")
- .HasName("pk_flight");
-
- b1.ToTable("flight", "flight");
-
- b1.WithOwner()
- .HasForeignKey("FlightId")
- .HasConstraintName("fk_flight_flight_id");
- });
-
- b.Navigation("ArriveDate")
- .IsRequired();
-
- b.Navigation("DepartureDate")
- .IsRequired();
-
- b.Navigation("DurationMinutes")
- .IsRequired();
-
- b.Navigation("FlightDate")
- .IsRequired();
-
- b.Navigation("FlightNumber")
- .IsRequired();
-
- b.Navigation("Price")
- .IsRequired();
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Seats.Models.Seat", b =>
- {
- b.HasOne("BookingMonolith.Flight.Flights.Models.Flight", null)
- .WithMany()
- .HasForeignKey("FlightId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_seat_flight_flight_id");
-
- b.OwnsOne("BookingMonolith.Flight.Seats.ValueObjects.SeatNumber", "SeatNumber", b1 =>
- {
- b1.Property("SeatId")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b1.Property("Value")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)")
- .HasColumnName("seat_number");
-
- b1.HasKey("SeatId")
- .HasName("pk_seat");
-
- b1.ToTable("seat", "flight");
-
- b1.WithOwner()
- .HasForeignKey("SeatId")
- .HasConstraintName("fk_seat_seat_id");
- });
-
- b.Navigation("SeatNumber")
- .IsRequired();
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/20250407215512_initial.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/20250407215512_initial.cs
deleted file mode 100644
index b53404a..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/20250407215512_initial.cs
+++ /dev/null
@@ -1,182 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace BookingMonolith.Flight.Data.Migrations
-{
- ///
- public partial class initial : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.EnsureSchema(
- name: "flight");
-
- migrationBuilder.CreateTable(
- name: "aircraft",
- schema: "flight",
- columns: table => new
- {
- id = table.Column(type: "uuid", nullable: false),
- name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
- model = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
- manufacturing_year = table.Column(type: "integer", maxLength: 5, nullable: false),
- created_at = table.Column(type: "timestamp with time zone", nullable: true),
- created_by = table.Column(type: "bigint", nullable: true),
- last_modified = table.Column(type: "timestamp with time zone", nullable: true),
- last_modified_by = table.Column(type: "bigint", nullable: true),
- is_deleted = table.Column(type: "boolean", nullable: false),
- version = table.Column(type: "bigint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_aircraft", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "airport",
- schema: "flight",
- columns: table => new
- {
- id = table.Column(type: "uuid", nullable: false),
- name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
- address = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
- code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
- created_at = table.Column(type: "timestamp with time zone", nullable: true),
- created_by = table.Column(type: "bigint", nullable: true),
- last_modified = table.Column(type: "timestamp with time zone", nullable: true),
- last_modified_by = table.Column(type: "bigint", nullable: true),
- is_deleted = table.Column(type: "boolean", nullable: false),
- version = table.Column(type: "bigint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_airport", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "flight",
- schema: "flight",
- columns: table => new
- {
- id = table.Column(type: "uuid", nullable: false),
- flight_number = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
- aircraft_id = table.Column(type: "uuid", nullable: false),
- departure_airport_id = table.Column(type: "uuid", nullable: false),
- arrive_airport_id = table.Column(type: "uuid", nullable: false),
- duration_minutes = table.Column(type: "numeric", maxLength: 50, nullable: false),
- status = table.Column(type: "text", nullable: false, defaultValue: "Unknown"),
- price = table.Column(type: "numeric", maxLength: 10, nullable: false),
- arrive_date = table.Column(type: "timestamp with time zone", nullable: false),
- departure_date = table.Column(type: "timestamp with time zone", nullable: false),
- flight_date = table.Column(type: "timestamp with time zone", nullable: false),
- created_at = table.Column(type: "timestamp with time zone", nullable: true),
- created_by = table.Column(type: "bigint", nullable: true),
- last_modified = table.Column(type: "timestamp with time zone", nullable: true),
- last_modified_by = table.Column(type: "bigint", nullable: true),
- is_deleted = table.Column(type: "boolean", nullable: false),
- version = table.Column(type: "bigint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_flight", x => x.id);
- table.ForeignKey(
- name: "fk_flight_aircraft_aircraft_id",
- column: x => x.aircraft_id,
- principalSchema: "flight",
- principalTable: "aircraft",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "fk_flight_airport_arrive_airport_id",
- column: x => x.arrive_airport_id,
- principalSchema: "flight",
- principalTable: "airport",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "fk_flight_airport_departure_airport_id",
- column: x => x.departure_airport_id,
- principalSchema: "flight",
- principalTable: "airport",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "seat",
- schema: "flight",
- columns: table => new
- {
- id = table.Column(type: "uuid", nullable: false),
- seat_number = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
- type = table.Column(type: "text", nullable: false, defaultValue: "Unknown"),
- @class = table.Column(name: "class", type: "text", nullable: false, defaultValue: "Unknown"),
- flight_id = table.Column(type: "uuid", nullable: false),
- created_at = table.Column(type: "timestamp with time zone", nullable: true),
- created_by = table.Column(type: "bigint", nullable: true),
- last_modified = table.Column(type: "timestamp with time zone", nullable: true),
- last_modified_by = table.Column(type: "bigint", nullable: true),
- is_deleted = table.Column(type: "boolean", nullable: false),
- version = table.Column(type: "bigint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_seat", x => x.id);
- table.ForeignKey(
- name: "fk_seat_flight_flight_id",
- column: x => x.flight_id,
- principalSchema: "flight",
- principalTable: "flight",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "ix_flight_aircraft_id",
- schema: "flight",
- table: "flight",
- column: "aircraft_id");
-
- migrationBuilder.CreateIndex(
- name: "ix_flight_arrive_airport_id",
- schema: "flight",
- table: "flight",
- column: "arrive_airport_id");
-
- migrationBuilder.CreateIndex(
- name: "ix_flight_departure_airport_id",
- schema: "flight",
- table: "flight",
- column: "departure_airport_id");
-
- migrationBuilder.CreateIndex(
- name: "ix_seat_flight_id",
- schema: "flight",
- table: "seat",
- column: "flight_id");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "seat",
- schema: "flight");
-
- migrationBuilder.DropTable(
- name: "flight",
- schema: "flight");
-
- migrationBuilder.DropTable(
- name: "aircraft",
- schema: "flight");
-
- migrationBuilder.DropTable(
- name: "airport",
- schema: "flight");
- }
- }
-}
diff --git a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/FlightDbContextModelSnapshot.cs b/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/FlightDbContextModelSnapshot.cs
deleted file mode 100644
index b17cc3c..0000000
--- a/1-monolith-architecture-style/src/BookingMonolith/src/Flight/Data/Migrations/FlightDbContextModelSnapshot.cs
+++ /dev/null
@@ -1,581 +0,0 @@
-//
-using System;
-using BookingMonolith.Flight.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace BookingMonolith.Flight.Data.Migrations
-{
- [DbContext(typeof(FlightDbContext))]
- partial class FlightDbContextModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasDefaultSchema("flight")
- .HasAnnotation("ProductVersion", "9.0.0")
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("BookingMonolith.Flight.Aircrafts.Models.Aircraft", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property("Version")
- .IsConcurrencyToken()
- .HasColumnType("bigint")
- .HasColumnName("version");
-
- b.HasKey("Id")
- .HasName("pk_aircraft");
-
- b.ToTable("aircraft", "flight");
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Airports.Models.Airport", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property("Version")
- .IsConcurrencyToken()
- .HasColumnType("bigint")
- .HasColumnName("version");
-
- b.HasKey("Id")
- .HasName("pk_airport");
-
- b.ToTable("airport", "flight");
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Flights.Models.Flight", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("AircraftId")
- .HasColumnType("uuid")
- .HasColumnName("aircraft_id");
-
- b.Property("ArriveAirportId")
- .HasColumnType("uuid")
- .HasColumnName("arrive_airport_id");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("DepartureAirportId")
- .HasColumnType("uuid")
- .HasColumnName("departure_airport_id");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property("Status")
- .IsRequired()
- .ValueGeneratedOnAdd()
- .HasColumnType("text")
- .HasDefaultValue("Unknown")
- .HasColumnName("status");
-
- b.Property("Version")
- .IsConcurrencyToken()
- .HasColumnType("bigint")
- .HasColumnName("version");
-
- b.HasKey("Id")
- .HasName("pk_flight");
-
- b.HasIndex("AircraftId")
- .HasDatabaseName("ix_flight_aircraft_id");
-
- b.HasIndex("ArriveAirportId")
- .HasDatabaseName("ix_flight_arrive_airport_id");
-
- b.HasIndex("DepartureAirportId")
- .HasDatabaseName("ix_flight_departure_airport_id");
-
- b.ToTable("flight", "flight");
- });
-
- modelBuilder.Entity("BookingMonolith.Flight.Seats.Models.Seat", b =>
- {
- b.Property("Id")
- .HasColumnType("uuid")
- .HasColumnName("id");
-
- b.Property("Class")
- .IsRequired()
- .ValueGeneratedOnAdd()
- .HasColumnType("text")
- .HasDefaultValue("Unknown")
- .HasColumnName("class");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("created_at");
-
- b.Property("CreatedBy")
- .HasColumnType("bigint")
- .HasColumnName("created_by");
-
- b.Property("FlightId")
- .HasColumnType("uuid")
- .HasColumnName("flight_id");
-
- b.Property("IsDeleted")
- .HasColumnType("boolean")
- .HasColumnName("is_deleted");
-
- b.Property("LastModified")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("last_modified");
-
- b.Property("LastModifiedBy")
- .HasColumnType("bigint")
- .HasColumnName("last_modified_by");
-
- b.Property