Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec
- Add SonarCloud scan to Azure DevOps PR validation
- Add separate build pipelines in Azure DevOps
- Split pipelines by folders: pr validation, build, infrastructure
- Update Cloudflare step: add only DNS record for ingress
- Add deployed project URLs to README
- Platform: Change PostgeSQL to be cluster IP
- Disable terraform log info
- Add AKS node pool name
67 changes: 37 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,36 +57,6 @@ EventTriangleAPI offers realtime communication using SignalR.

![./img/infrastructure_diagram.png](./img/infrastructure_diagram.png)

## Screenshots

### Transactions

![./img/transactions.png](./img/transactions.png)

### Credit Cards

![./img/cards.png](./img/cards.png)

### Deposit

![./img/deposit.png](./img/deposit.png)

### Contacts

![./img/contacts.png](./img/contacts.png)

### Support

![./img/support.png](./img/support.png)

### Tickets

![./img/tickets.png](./img/tickets.png)

### Users

![./img/users.png](./img/users.png)

## Technology stack

- **SDK:** `.NET 8`
Expand All @@ -109,6 +79,13 @@ EventTriangleAPI offers realtime communication using SignalR.

## Useful links

### Deployments

- https://auth-eventtriangle.razumovsky.me/app/transactions
- https://auth-eventtriangle.razumovsky.me/swagger/index.html

### Management

- Docker: https://hub.docker.com/u/kaminome
- Azure DevOps: https://dev.azure.com/EventTriangle/EventTriangleAPI
- Renovate: https://developer.mend.io/github/EventTriangle/EventTriangleAPI
Expand All @@ -133,3 +110,33 @@ From `src` folder run:
- `docker build --build-arg FRONT_API_URL="http://localhost:7000/" -t eventtriangle/auth:1.0 -f ./authorization/Dockerfile .`
- `docker build -t eventtriangle/consumer:1.0 -f ./consumer/Dockerfile . `
- `docker build -t eventtriangle/sender:1.0 -f ./sender/Dockerfile .`

## Screenshots

### Transactions

![./img/transactions.png](./img/transactions.png)

### Credit Cards

![./img/cards.png](./img/cards.png)

### Deposit

![./img/deposit.png](./img/deposit.png)

### Contacts

![./img/contacts.png](./img/contacts.png)

### Support

![./img/support.png](./img/support.png)

### Tickets

![./img/tickets.png](./img/tickets.png)

### Users

![./img/users.png](./img/users.png)
4 changes: 2 additions & 2 deletions azure-pipelines/infrastructure/configure-aks-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ variables:
value: 'false'

stages:
- template: templates/configure-cluster-stages.yml
- template: ../templates/configure-cluster-stages.yml
parameters:
vmImage: windows-latest
environment: aks
workingDirectory: $(System.DefaultWorkingDirectory)/kubernetes
workingDirectory: $(System.DefaultWorkingDirectory)/platform
serviceConnection: Azure_Connection
azureResourceGroup: $(library-aks-resource-group)
kubernetesCluster: $(library-aks-cluster-name)
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines/infrastructure/terraform-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ variables:
- name: System.Debug
value: 'false'
- name: planStageName
value: "Terraform_Plan_AKS_Cluster"
value: "Terraform_Plan"
- name: applyStageName
value: "Terraform_Apply_AKS_Cluster"
value: "Terraform_Apply"

stages:
- template: templates/terraform-plan-stages.yml
- template: ../templates/terraform-plan-stages.yml
parameters:
stageName: ${{ variables.planStageName }}
VmImage: windows-latest
Expand All @@ -45,7 +45,7 @@ stages:
tenantId: $(library-tenant-id)
destroy: false

- template: templates/terraform-apply-stages.yml
- template: ../templates/terraform-apply-stages.yml
parameters:
stageName: ${{ variables.applyStageName }}
VmImage: windows-latest
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines/infrastructure/terraform-destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ variables:
- name: System.Debug
value: 'false'
- name: planStageName
value: "Terraform_Plan_Destroy_AKS_Cluster"
value: "Terraform_Plan_Destroy"
- name: applyStageName
value: "Terraform_Apply_Destroy_AKS_Cluster"
value: "Terraform_Destroy"

stages:
- template: templates/terraform-plan-stages.yml
- template: ../templates/terraform-plan-stages.yml
parameters:
stageName: ${{ variables.planStageName }}
VmImage: windows-latest
Expand All @@ -40,7 +40,7 @@ stages:
tenantId: $(library-tenant-id)
destroy: true

- template: templates/terraform-apply-stages.yml
- template: ../templates/terraform-apply-stages.yml
parameters:
stageName: ${{ variables.applyStageName }}
VmImage: windows-latest
Expand Down
9 changes: 5 additions & 4 deletions azure-pipelines/pr-validation/pr-validation-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ pr:
- main
paths:
include:
- build
- azure-pipelines
- platform
- helm
- cloudflare
- src/authorization/EventTriangleAPI.Authorization.BusinessLogic
- src/authorization/EventTriangleAPI.Authorization.Presentation
- src/shared/EventTriangleAPI.Shared.Application
- src/shared/EventTriangleAPI.Shared.DTO
exclude:
- '**/*.md'

variables:
- name: appName
Expand Down Expand Up @@ -46,5 +47,5 @@ stages:
shouldPushToAcr: true
acrRegistryUrl: 'acrsharedd01.azurecr.io'
acrServiceConnection: 'Azure_ACR_Connection'
sonarCloudEnabled: true
sonarCloudEnabled: false
workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src'
7 changes: 4 additions & 3 deletions azure-pipelines/pr-validation/pr-validation-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ pr:
- main
paths:
include:
- build
- azure-pipelines
- platform
- helm
- cloudflare
- src/consumer/EventTriangleAPI.Consumer.Application
- src/consumer/EventTriangleAPI.Consumer.BusinessLogic
- src/consumer/EventTriangleAPI.Consumer.Domain
Expand All @@ -16,8 +19,6 @@ pr:
- src/consumer/EventTriangleAPI.Consumer.UnitTests
- src/shared/EventTriangleAPI.Shared.Application
- src/shared/EventTriangleAPI.Shared.DTO
exclude:
- '**/*.md'

variables:
- name: appName
Expand Down
7 changes: 4 additions & 3 deletions azure-pipelines/pr-validation/pr-validation-sender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ pr:
- main
paths:
include:
- build
- azure-pipelines
- platform
- helm
- cloudflare
- src/sender/EventTriangleAPI.Sender.Application
- src/sender/EventTriangleAPI.Sender.BusinessLogic
- src/sender/EventTriangleAPI.Sender.Domain
Expand All @@ -16,8 +19,6 @@ pr:
- src/sender/EventTriangleAPI.Sender.UnitTests
- src/shared/EventTriangleAPI.Shared.Application
- src/shared/EventTriangleAPI.Shared.DTO
exclude:
- '**/*.md'

variables:
- name: appName
Expand Down
27 changes: 15 additions & 12 deletions azure-pipelines/templates/configure-cluster-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ stages:
displayName: 'Deploy Postgres'
inputs:
targetType: 'inline'
script: 'kubectl apply -f ./pgsql-deployment-load-balancer --namespace ${{ parameters.namespace }}'
script: 'kubectl apply -f ./pgsql-deployment --namespace ${{ parameters.namespace }}'
pwsh: true
workingDirectory: ${{ parameters.workingDirectory }}

Expand All @@ -113,17 +113,13 @@ stages:
pwsh: true
workingDirectory: ${{ parameters.workingDirectory }}

- task: PowerShell@2
displayName: 'Deploy RabbitMQ'
inputs:
targetType: 'filePath'
filePath: ${{ parameters.workingDirectory }}/helm-install-rabbit-mq/deploy-rabbitmq-helm.ps1
arguments: '-HelmReleaseName event-rabbitmq
-Namespace ${{ parameters.namespace }}
-RabbitMqUsername ${{ parameters.rabbitMqUser }}
-RabbitMqPassword ${{ parameters.rabbitMqPassword }}'
pwsh: true
workingDirectory: ${{ parameters.workingDirectory }}
- pwsh: |
kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml"
Write-Host "Waiting 60 sec for Operator to provision..."
Start-Sleep 60
kubectl apply -f ./helm-install-rabbit-mq/rabbit.yaml
workingDirectory: ${{ parameters.workingDirectory }}
displayName: 'Install Rabbit MQ'

- task: PowerShell@2
displayName: 'Deploy CertManager'
Expand Down Expand Up @@ -167,3 +163,10 @@ stages:
arguments: '-ApiToken ${{ parameters.cloudflareApiKey }} -ZoneName ${{ parameters.cloudflareZone }}'
pwsh: true
workingDirectory: '$(System.DefaultWorkingDirectory)/cloudflare'

- pwsh: |
helm upgrade --install auth-app .\auth-service-chart\ --values .\auth-service-chart\values.yaml --namespace "event-triangle"
helm upgrade --install consumer-app .\consumer-service-chart\ --values .\consumer-service-chart\values.yaml --namespace "event-triangle"
helm upgrade --install sender-app .\sender-service-chart\ --values .\sender-service-chart\values.yaml --namespace "event-triangle"
workingDirectory: $(System.DefaultWorkingDirectory)\helm
displayName: Deploy Web Apps
3 changes: 0 additions & 3 deletions azure-pipelines/templates/terraform-apply-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ stages:
pool:
vmImage: ${{ parameters.VmImage }}
environment: ${{ parameters.environment }}
variables:
- name: 'TF_LOG'
value: 'INFO'
strategy:
runOnce:
deploy:
Expand Down
3 changes: 0 additions & 3 deletions azure-pipelines/templates/terraform-plan-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ stages:
displayName: ${{ parameters.stageName }}
pool:
vmImage: ${{ parameters.VmImage }}
variables:
- name: 'TF_LOG'
value: 'INFO'
steps:
- checkout: self
fetchDepth: 0
Expand Down
8 changes: 8 additions & 0 deletions cloudflare/Cloudflare_curl.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
curl https://api.cloudflare.com/client/v4/zones -H "X-Auth-Email: $env:CLOUDFLARE_EMAIL" -H "X-Auth-Key: $env:CLOUDFLARE_API_KEY"

curl https://api.cloudflare.com/client/v4/zones -H "Authorization: Bearer $env:CLOUDFLARE_API_KEY" -H "Content-Type: application/json"

curl https://api.cloudflare.com/client/v4/user/tokens/verify -H "Authorization: Bearer $env:CLOUDFLARE_API_KEY" -H "Content-Type: application/json"

curl https://api.cloudflare.com/client/v4/zones/d8bdf4c7860b59eddfd9fcc7bf864b47/dns_records `
-H "Authorization: Bearer $env:CLOUDFLARE_API_KEY" -H "Content-Type: application/json"
27 changes: 27 additions & 0 deletions cloudflare/Get-CloudflareDnsRecords.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
param (
[Parameter(Mandatory = $true)]
[string]$ApiToken,

[Parameter(Mandatory = $true)]
[string]$ZoneId
)

$url = "https://api.cloudflare.com/client/v4/zones/$ZoneId/dns_records"

# Perform the API request
$response = $( curl $url -H "Authorization: Bearer $ApiToken" -H "Content-Type: application/json" )

# Parse the JSON response
$json = $response | ConvertFrom-Json

# Create a hashtable to hold the records
$dnsRecords = @{}

# Loop through the result and populate the hashtable
$json.result | ForEach-Object {
# Use the DNS record id as the key and the name as the value
$dnsRecords[$_.name] = $_.id
}

# Return the hashtable
return $dnsRecords
33 changes: 33 additions & 0 deletions cloudflare/Get-CloudflareZoneId.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
param (
[Parameter(Mandatory = $true)]
[string]$ApiToken,

[Parameter(Mandatory = $true)]
[string]$ZoneName
)

$ErrorActionPreference = "Stop"

$url = "https://api.cloudflare.com/client/v4/zones"

# Perform the API request
$response = $( curl $url -H "Authorization: Bearer $ApiToken" -H "Content-Type: application/json" )

# Parse the JSON response
$json = $response | ConvertFrom-Json

# Filter the result for the zone named 'razumovsky.me'
$zone = $json.result | Where-Object { $_.name -eq "$ZoneName" }

# Output the Zone ID
if ($zone)
{
return $zone.id
}
else
{
Write-Output "Zone '$ZoneName' not found."
}



9 changes: 9 additions & 0 deletions cloudflare/Get-NewDnsEntries.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

$ingressService = $( kubectl get service "event-ingress-ingress-nginx-controller" -n "event-triangle" -o json ) | ConvertFrom-Json
$ingressPublicIp = $ingressService.status.loadBalancer.ingress[0].ip

$dnsRecords = @{}

$dnsRecords["auth-eventtriangle.razumovsky.me"] = $ingressPublicIp

return $dnsRecords
Loading