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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github:, [Nano-Core]
34 changes: 34 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Deploy
on:
pull_request:
branches:
- master
push:
branches:
- master
env:
VERSION: 10.0.0-rc1
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
concurrency:
group: ${{ github.repository }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v6

- name: GitHub Release
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
tag: v${{ env.VERSION }}.${{ github.run_number }}
name: "Release ${{ env.VERSION }}"
body: |
Version: ${{ env.VERSION }}
Commit: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: ${{ contains(env.VERSION, '-') }}
File renamed without changes.
44 changes: 44 additions & 0 deletions Api.ApiClients.Audit/.docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
services:
api.apiclients.audit:
image: api.apiclients.audit
hostname: api-apiclients-audit
restart: on-failure
ports:
- 8080:8080
build:
context: ../Api.ApiClients.Audit
dockerfile: "Dockerfile.Local"
networks:
- network

api.apiclients.audit.service:
image: api.apiclients.audit.service
hostname: api-apiclients-audit-service
restart: on-failure
ports:
- 8181:8181
build:
context: ../Api.ApiClients.Audit.Service
dockerfile: "Dockerfile.Local"
depends_on:
- database
networks:
- network

database:
image: mysql/mysql-server:latest
ports:
- 3306:3306
networks:
- network
environment:
MYSQL_USER: sa
MYSQL_PASSWORD: myPassword_123
MYSQL_ROOT_PASSWORD: myPassword_123
MYSQL_DATABASE: nanoDb
MYSQL_ROOT_HOST: '%'

networks:
network:
name: network
driver: bridge
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
name: Build And Deploy
on:
push
pull_request:
branches:
- master
push:
branches:
- master
env:
APP_NAME: Api.Documentation.Nonce
IMAGE_NAME: api.documentation.nonce
SERVICE_NAME: api-documentation-nonce
APP_NAME: Api.ApiClients.Audit
IMAGE_NAME: api.apiclients.audit
SERVICE_NAME: api-apiclients-audit
VERSION: '${{ vars.VERSION }}.${{ github.run_number }}.${{ github.run_attempt }}'
DOTNET_SDK_VERSION: 10.0
DOTNET_ASPNET_VERSION: 10.0
AZURE_GROUP: ${{ vars.AZURE_KUBERNETES_RESOURCE_GROUP }}
AZURE_GROUP_KUBERNETES: ${{ vars.AZURE_RESOURCE_GROUP_KUBERNETES }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ github.ref == 'refs/heads/master' && secrets.PRODUCTION_AZURE_SUBSCRIPTION_ID || secrets.STAGING_AZURE_SUBSCRIPTION_ID }}
NUGET_HOST: ${{ secrets.NUGET_HOST }}
NUGET_USERNAME: ${{ secrets.NUGET_USERNAME }}
NUGET_PASSWORD: ${{ secrets.NUGET_APIKEY }}
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
CONTAINER_REGISTRY_HOST: ${{ vars.CONTAINER_REGISTRY_HOST }}
CONTAINER_REGISTRY_USERNAME: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
NUGET_HOST: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
NUGET_USERNAME: ${{ github.actor }}
NUGET_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
CONTAINER_REGISTRY_HOST: ghcr.io
CONTAINER_REGISTRY_USERNAME: ${{ github.actor }}
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
CONTAINER_REGISTRY_SOURCE_LABEL: https://github.com/${{ github.repository }}
KUBERNETES_CLUSTER: ${{ github.ref == 'refs/heads/master' && vars.PRODUCTION_KUBERNETES_CLUSTER || vars.STAGING_KUBERNETES_CLUSTER }}
KUBERNETES_NODEPOOL_COMPUTE: cpu
KUBERNETES_NAMESPACE: default
KUBERNETES_NAMESPACE: apps
KUBERNETES_REPLICA_COUNT: ${{ github.ref == 'refs/heads/master' && 3 || 2 }}
KUBERNETES_REPLICA_COUNT_MAX: ${{ github.ref == 'refs/heads/master' && 8 || 5 }}
KUBERNETES_REPLICA_HISTORY_COUNT: 0
Expand All @@ -33,30 +36,31 @@ env:
KUBERNETES_CPU_REQUEST: 200m
KUBERNETES_CPU_LIMIT: 600m
KUBERNETES_CPU_SCALING: 180
CERTIFICATE_ISSUER: letsencrypt-prod
CERTIFICATE_ORGANIZATION: ${{ vars.CERTIFICATE_ORGANIZATION }}
CERTIFICATE_HOST: ${{ github.ref == 'refs/heads/master' && vars.HOST_API_SUBDOMAIN + '.' + vars.PRODUCTION_HOST || vars.HOST_API_SUBDOMAIN + '.' + vars.STAGING_HOST }}
ASPNETCORE_ENVIRONMENT: ${{ github.ref == 'refs/heads/master' && 'Production' || 'Staging' }}
NONCE_TOKEN: ${{ github.ref == 'refs/heads/master' && secrets.PRODUCTION_NONCE_TOKEN || secrets.STAGING_NONCE_TOKEN }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
runs-on:
- self-hosted
- linux
- ${{ github.ref == 'refs/heads/master' && 'Production' || 'Staging' }}
permissions:
contents: read
contents: write
packages: write
id-token: write
concurrency:
group: ${{ github.repository }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Azure Login
shell: pwsh
run: |
sudo az login --service-principal -u $env:AZURE_CLIENT_ID -p $env:AZURE_CLIENT_SECRET --tenant $env:AZURE_TENANT_ID -o none;
sudo az account set -s $env:AZURE_SUBSCRIPTION_ID -o none;
sudo az aks get-credentials -g $env:AZURE_GROUP -n $env:KUBERNETES_CLUSTER --overwrite -o none;
az login --service-principal -u $env:AZURE_CLIENT_ID -p $env:AZURE_CLIENT_SECRET --tenant $env:AZURE_TENANT_ID -o none;
az account set -s $env:AZURE_SUBSCRIPTION_ID -o none;

$env:KUBERNETES_CLUSTER = az aks list -g $env:AZURE_GROUP_KUBERNETES --query [0].name -o tsv;
az aks get-credentials -g $env:AZURE_GROUP_KUBERNETES -n $env:KUBERNETES_CLUSTER --overwrite -o none;

- name: Build
shell: pwsh
Expand Down Expand Up @@ -85,7 +89,7 @@ jobs:
$imageLatestTag = $registryHost + "/" + $env:IMAGE_NAME + ":latest";
$imageVersionTag = $registryHost + "/" + $env:IMAGE_NAME + ":" + $env:VERSION

sudo docker build `
docker build `
-t $imageLatestTag `
-t $imageVersionTag `
--build-arg DOTNET_SDK_VERSION=$env:DOTNET_SDK_VERSION `
Expand All @@ -101,9 +105,9 @@ jobs:
throw "error";
};

sudo docker login -u="$env:CONTAINER_REGISTRY_USERNAME" -p="$env:CONTAINER_REGISTRY_PASSWORD" $env:CONTAINER_REGISTRY_HOST;
sudo docker push $imageLatestTag;
sudo docker push $imageVersionTag;
echo $env:CONTAINER_REGISTRY_PASSWORD | docker login $env:CONTAINER_REGISTRY_HOST -u $env:CONTAINER_REGISTRY_USERNAME --password-stdin;
docker push $imageLatestTag;
docker push $imageVersionTag;
if ($LastExitCode -ne 0)
{
throw "error";
Expand All @@ -114,7 +118,7 @@ jobs:
run: |
$nugetProjectModels=$env:APP_NAME + ".Models/" + $env:APP_NAME + ".Models.csproj";
dotnet pack $nugetProjectModels -c Release --output nupkgs /p:PackageVersion=$env:VERSION --include-symbols --no-build;
dotnet nuget push nupkgs/$env:APP_NAME".Models."$env:VERSION.nupkg -s $env:NUGET_HOST -k $env:NUGET_APIKEY;
dotnet nuget push nupkgs/$env:APP_NAME".Models."$env:VERSION.nupkg -s $env:NUGET_HOST -k $env:NUGET_PASSWORD;
if ($LastExitCode -ne 0)
{
throw "error";
Expand All @@ -123,43 +127,29 @@ jobs:
- name: Kubernetes Deploy
shell: pwsh
run: |
Get-Content .kubernetes/service.yaml | foreach { [Environment]::ExpandEnvironmentVariables($_) } | Set-Content .kubernetes/service.tmp.yaml;
sudo kubectl apply -f .kubernetes/service.tmp.yaml;
Get-Content .kubernetes/service.yaml | foreach { [Environment]::ExpandEnvironmentVariables($_) } | Set-Content .kubernetes/service.tmp.yaml;
kubectl apply -f .kubernetes/service.tmp.yaml;
if ($LastExitCode -ne 0)
{
throw "error";
};

Get-Content .kubernetes/configmap.yaml | foreach { [Environment]::ExpandEnvironmentVariables($_) } | Set-Content .kubernetes/configmap.tmp.yaml;
sudo kubectl apply -f .kubernetes/configmap.tmp.yaml;
kubectl apply -f .kubernetes/configmap.tmp.yaml;
if ($LastExitCode -ne 0)
{
throw "error";
};

Get-Content .kubernetes/deployment.yaml | foreach { [Environment]::ExpandEnvironmentVariables($_) } | Set-Content .kubernetes/deployment.tmp.yaml;
sudo kubectl apply -f .kubernetes/deployment.tmp.yaml;
kubectl apply -f .kubernetes/deployment.tmp.yaml;
if ($LastExitCode -ne 0)
{
throw "error";
};

Get-Content .kubernetes/autoscaler.yaml | foreach { [Environment]::ExpandEnvironmentVariables($_) } | Set-Content .kubernetes/autoscaler.tmp.yaml;
sudo kubectl apply -f .kubernetes/autoscaler.tmp.yaml;
if ($LastExitCode -ne 0)
{
throw "error";
};

Get-Content .kubernetes/certificate.yaml | foreach { [Environment]::ExpandEnvironmentVariables($_) } | Set-Content .kubernetes/certificate.tmp.yaml;
sudo kubectl apply -f .kubernetes/certificate.tmp.yaml;
if ($LastExitCode -ne 0)
{
throw "error";
};

Get-Content .kubernetes/ingress.yaml | foreach { [Environment]::ExpandEnvironmentVariables($_) } | Set-Content .kubernetes/ingress.tmp.yaml;
sudo kubectl apply -f .kubernetes/ingress.tmp.yaml;
kubectl apply -f .kubernetes/autoscaler.tmp.yaml;
if ($LastExitCode -ne 0)
{
throw "error";
Expand Down
11 changes: 11 additions & 0 deletions Api.ApiClients.Audit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.vs
*.user
*.userprefs
*.suo
_ReSharper*
**/bin
**/obj
*.DotSettings.User
packages
.env
**/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ spec:
securityContext:
runAsUser: 1000
runAsGroup: 2000
fsGroup: 2000
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: %SERVICE_NAME%
automountServiceAccountToken: false
nodeSelector:
nodepool.compute: %KUBERNETES_NODEPOOL_COMPUTE%
kubernetes.io/os: linux
Expand Down Expand Up @@ -73,11 +73,6 @@ spec:
periodSeconds: 5
initialDelaySeconds: 20
timeoutSeconds: 2
volumeMounts:
- name: tmp
mountPath: /tmp
- name: %SERVICE_NAME%-volume
mountPath: /mnt/%STORAGE_SHARE_NAME%
imagePullSecrets:
- name: ghcr-pull-secret

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<NoWarn />
<WarningsAsErrors />
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="4.2.1" />
<PackageReference Include="MSTest.TestFramework" Version="4.2.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Api.ApiClients.Audit.Models\Api.ApiClients.Audit.Models.csproj" />
<ProjectReference Include="..\..\Api.ApiClients.Audit\Api.ApiClients.Audit.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<NoWarn />
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<FileVersion>10.0.0.0</FileVersion>
<Version>10.0.0.0</Version>
<PlatformTarget>AnyCPU</PlatformTarget>
<Configurations>Debug;Release</Configurations>
<LangVersion>latest</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<nullable>enable</nullable>
<License>LICENSE</License>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IsPackable>true</IsPackable>
<Authors>Michael Vivet</Authors>
<Owners>Michael Vivet</Owners>
<Product>$(ProjectName)</Product>
<Summary>Example project demonstrating a focused aspect of the Nano Library.</Summary>
<Description>
A practical example highlighting a specific area or scenario of Nano for learning
and experimentation. Shows how features or patterns can be applied without
representing a full application or complete reference.
</Description>
<PackageReleaseNotes>
- Added .NET 10 support
</PackageReleaseNotes>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>master</RepositoryBranch>
<RepositoryUrl>https://github.com/Nano-Core/Nano.Examples.git</RepositoryUrl>
<RepositoryCommit>$(GitCommitHash)</RepositoryCommit>
<EmbedAllSources>true</EmbedAllSources>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageVersion>$(Version)</PackageVersion>
<PackageTags>nano;example;sample;framework;library;learning;showcase</PackageTags>
<PackageProjectUrl>https://github.com/Nano-Core/Nano.Library/$(ProjectName)</PackageProjectUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='RELEASE'">
<Optimize>True</Optimize>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE" Pack="true" Visible="false" PackagePath="" />
<None Include="..\icon.png" Pack="true" Visible="false" PackagePath="" />
<None Include="..\README.md" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="10.0.103" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Nano.Library\Nano.App.Api\Nano.App.Api.csproj" />
<ProjectReference Include="..\..\..\Nano.Library\Nano.App\Nano.App.csproj" />
<ProjectReference Include="..\..\..\Nano.Library\Nano.Common\Nano.Common.csproj" />
<ProjectReference Include="..\..\..\Nano.Library\Nano.Data.Abstractions\Nano.Data.Abstractions.csproj" />
<ProjectReference Include="..\..\..\Nano.Library\Nano.Eventing.Abstractions\Nano.Eventing.Abstractions.csproj" />
<ProjectReference Include="..\..\..\Nano.Library\Nano.Logging.Abstractions\Nano.Logging.Abstractions.csproj" />
<ProjectReference Include="..\..\..\Nano.Library\Nano.Storage.Abstractions\Nano.Storage.Abstractions.csproj" />
</ItemGroup>

</Project>
Loading
Loading