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: 2 additions & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- master
env:
VERSION: 10.0.0-rc1
VERSION: 10.0.0
jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand All @@ -28,6 +28,7 @@ jobs:
name: "Release ${{ env.VERSION }}"
body: |
Version: ${{ env.VERSION }}
Build run: ${{ github.run_number }}
Commit: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
Expand Down
2 changes: 1 addition & 1 deletion Api.ApiClients.Audit/.docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
hostname: api-apiclients-audit-service
restart: on-failure
ports:
- 8181:8181
- 8181:8080
build:
context: ../Api.ApiClients.Audit.Service
dockerfile: "Dockerfile.Local"
Expand Down
92 changes: 44 additions & 48 deletions Api.ApiClients.Audit/.github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,51 @@ name: Build And Deploy
on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main
workflow_dispatch:
env:
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
DOTNET_SDK_VERSION: "10.0"
DOTNET_ASPNET_VERSION: "10.0"
AZURE_GROUP_KUBERNETES: ${{ vars.AZURE_RESOURCE_GROUP_KUBERNETES }}
AZURE_GROUP_DELIVERY: ${{ vars.AZURE_RESOURCE_GROUP_DELIVERY }}
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 }}
AZURE_SUBSCRIPTION_ID: ${{ github.ref == 'refs/heads/main' && secrets.PRODUCTION_AZURE_SUBSCRIPTION_ID || secrets.STAGING_AZURE_SUBSCRIPTION_ID }}
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_NODEPOOL_COMPUTE: cpu
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_NAMESPACE: ${{ vars.KUBERNETES_NAMESPACE }}
KUBERNETES_REPLICA_COUNT: ${{ github.ref == 'refs/heads/main' && 3 || 2 }}
KUBERNETES_REPLICA_COUNT_MAX: ${{ github.ref == 'refs/heads/main' && 8 || 5 }}
KUBERNETES_REPLICA_HISTORY_COUNT: 0
KUBERNETES_MEMORY_REQUEST: 512Mi
KUBERNETES_MEMORY_LIMIT: 1536Mi
KUBERNETES_MEMORY_SCALING: 180
KUBERNETES_CPU_REQUEST: 200m
KUBERNETES_CPU_LIMIT: 600m
KUBERNETES_CPU_SCALING: 180
ASPNETCORE_ENVIRONMENT: ${{ github.ref == 'refs/heads/master' && 'Production' || 'Staging' }}
ASPNETCORE_ENVIRONMENT: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Staging' }}
concurrency:
group: ${{ github.workflow }}-${{ github.repository }}
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on:
- self-hosted
- linux
- ${{ github.ref == 'refs/heads/master' && 'Production' || 'Staging' }}
- ${{ github.ref == 'refs/heads/main' && 'Production' || 'Staging' }}
permissions:
contents: write
packages: write
id-token: write
concurrency:
group: ${{ github.repository }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v6

Expand All @@ -62,68 +59,65 @@ jobs:
$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
- name: Build Solution
shell: pwsh
run: |
dotnet nuget add source $env:NUGET_HOST -n private -u $env:NUGET_USERNAME -p $env:NUGET_PASSWORD --store-password-in-clear-text;

dotnet build -c Release .\$env:APP_NAME.sln;

if ($LastExitCode -ne 0)
{
throw "error";
};

- name: Test
- name: Test Solution
shell: pwsh
run: |
dotnet test .\.tests\Tests.$env:APP_NAME\Tests.$env:APP_NAME.csproj;

if ($LastExitCode -ne 0)
{
throw "error";
};

- name: Publish Image
- name: Publish NuGet
shell: pwsh
run: |
$registryHost = $env:CONTAINER_REGISTRY_HOST.ToLower()
$imageLatestTag = $registryHost + "/" + $env:IMAGE_NAME + ":latest";
$imageVersionTag = $registryHost + "/" + $env:IMAGE_NAME + ":" + $env:VERSION

docker build `
-t $imageLatestTag `
-t $imageVersionTag `
--build-arg DOTNET_SDK_VERSION=$env:DOTNET_SDK_VERSION `
--build-arg DOTNET_ASPNET_VERSION=$env:DOTNET_ASPNET_VERSION `
--build-arg CONTAINER_REGISTRY_SOURCE_LABEL=$env:CONTAINER_REGISTRY_SOURCE_LABEL `
--build-arg NUGET_HOST=$env:NUGET_HOST `
--build-arg NUGET_USERNAME=$env:NUGET_USERNAME `
--build-arg NUGET_PASSWORD=$env:NUGET_PASSWORD `
./;

if ($LastExitCode -ne 0)
{
throw "error";
};
$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_PASSWORD;

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";
};

- name: Publish NuGet
- name: Build & Push Image
shell: pwsh
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_PASSWORD;
$env:CONTAINER_REGISTRY_HOST = az acr list -g $env:AZURE_GROUP_DELIVERY --query [0].loginServer -o tsv;

az acr build `
--registry $env:CONTAINER_REGISTRY_HOST `
--agent-pool buildpool `
-t "$($env:IMAGE_NAME):latest" `
-t "$($env:IMAGE_NAME):$($env:VERSION)" `
--build-arg DOTNET_SDK_VERSION=$env:DOTNET_SDK_VERSION `
--build-arg DOTNET_ASPNET_VERSION=$env:DOTNET_ASPNET_VERSION `
--build-arg CONTAINER_REGISTRY_SOURCE_LABEL=https://github.com/$env:GITHUB_REPOSITORY `
--build-arg NUGET_HOST=$env:NUGET_HOST `
--build-arg NUGET_USERNAME=$env:NUGET_USERNAME `
--build-arg NUGET_PASSWORD=$env:NUGET_PASSWORD `
./

if ($LastExitCode -ne 0)
{
throw "error";
};

echo "CONTAINER_REGISTRY_HOST=$env:CONTAINER_REGISTRY_HOST" >> $env:GITHUB_ENV;

- name: Kubernetes Deploy
shell: pwsh
run: |
Expand Down Expand Up @@ -156,14 +150,16 @@ jobs:
};

- name: GitHub Release
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/main'
uses: ncipollo/release-action@v1
with:
tag: v${{ env.VERSION }}
name: "Release ${{ env.VERSION }}"
body: |
Version: ${{ env.VERSION }}
Commit: ${{ github.sha }}
Build run: ${{ github.run_number }}
Image: ${{ env.CONTAINER_REGISTRY_HOST }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
artifacts: "nupkgs/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
Expand Down
2 changes: 1 addition & 1 deletion Api.ApiClients.Audit/.kubernetes/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
apiVersion: v1
kind: ConfigMap
metadata:
name: %SERVICE_NAME%-config
Expand Down
3 changes: 0 additions & 3 deletions Api.ApiClients.Audit/.kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,3 @@ spec:
periodSeconds: 5
initialDelaySeconds: 20
timeoutSeconds: 2
imagePullSecrets:
- name: ghcr-pull-secret

Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@
<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>
<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></PackageReleaseNotes>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>master</RepositoryBranch>
<RepositoryUrl>https://github.com/Nano-Core/Nano.Examples.git</RepositoryUrl>
<RepositoryBranch>main</RepositoryBranch>
<RepositoryUrl>https://github.com/Nano-Core/Nano.Lessons.git</RepositoryUrl>
<RepositoryCommit>$(GitCommitHash)</RepositoryCommit>
<EmbedAllSources>true</EmbedAllSources>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand All @@ -41,7 +35,7 @@
<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>
<PackageProjectUrl>https://github.com/Nano-Core/Nano.Lessons/$(ProjectName)</PackageProjectUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@
<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>
<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></PackageReleaseNotes>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>master</RepositoryBranch>
<RepositoryUrl>https://github.com/Nano-Core/Nano.Examples.git</RepositoryUrl>
<RepositoryBranch>main</RepositoryBranch>
<RepositoryUrl>https://github.com/Nano-Core/Nano.Lessons.git</RepositoryUrl>
<RepositoryCommit>$(GitCommitHash)</RepositoryCommit>
<EmbedAllSources>true</EmbedAllSources>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand All @@ -41,7 +35,7 @@
<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>
<PackageProjectUrl>https://github.com/Nano-Core/Nano.Lessons/$(ProjectName)</PackageProjectUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:$DOTNET_ASPNET_VERSION AS base

EXPOSE 8080

ENV ASPNETCORE_HTTP_PORTS=

ENTRYPOINT ["dotnet", "Api.ApiClients.Audit.Service.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Root": "api",
"Http": {
"Ports": [
8181
8080
]
}
}
Expand Down
2 changes: 2 additions & 0 deletions Api.ApiClients.Audit/Api.ApiClients.Audit/Dockerfile.Local
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:$DOTNET_ASPNET_VERSION AS base

EXPOSE 8080

ENV ASPNETCORE_HTTP_PORTS=

ENTRYPOINT ["dotnet", "Api.ApiClients.Audit.dll"]
4 changes: 4 additions & 0 deletions Api.ApiClients.Audit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .

RUN mkdir -p /app/wwwroot

ENV ASPNETCORE_HTTP_PORTS=
ENV COMPlus_EnableDiagnostics=0
ENV DOTNET_USE_POLLING_FILE_WATCHER=true

Expand Down
2 changes: 1 addition & 1 deletion Api.ApiClients.Entity/.docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
hostname: api-apiclients-entity-service
restart: on-failure
ports:
- 8181:8181
- 8181:8080
build:
context: ../Api.ApiClients.Entity.Service
dockerfile: "Dockerfile.Local"
Expand Down
Loading
Loading