{"id":18328484,"url":"https://github.com/thorstenhans/aks-demo-app","last_synced_at":"2025-04-06T01:32:24.983Z","repository":{"id":38815079,"uuid":"130706380","full_name":"ThorstenHans/aks-demo-app","owner":"ThorstenHans","description":"Sample Application for AKS demonstrations","archived":false,"fork":false,"pushed_at":"2023-01-07T02:20:30.000Z","size":1751,"stargazers_count":30,"open_issues_count":34,"forks_count":37,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T15:11:02.752Z","etag":null,"topics":["aks","aspnet-core","azure-container-service","docker","dotnet-core","kubernetes"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThorstenHans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-23T14:09:08.000Z","updated_at":"2024-12-17T21:50:34.000Z","dependencies_parsed_at":"2023-02-06T10:31:17.418Z","dependency_job_id":null,"html_url":"https://github.com/ThorstenHans/aks-demo-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2Faks-demo-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2Faks-demo-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2Faks-demo-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2Faks-demo-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThorstenHans","download_url":"https://codeload.github.com/ThorstenHans/aks-demo-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423476,"owners_count":20936621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aks","aspnet-core","azure-container-service","docker","dotnet-core","kubernetes"],"created_at":"2024-11-05T19:14:14.302Z","updated_at":"2025-04-06T01:32:22.472Z","avatar_url":"https://github.com/ThorstenHans.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AKS Demo App\n\n## A simple .NET Core / Angular application\n\n`aks-demo-app` is a simple application to demonstrate basic concepts of [kubernetes](http://kubernetes.io) (k8s) and Azure Kubernetes Services (AKS). The app consists of four Docker images and a SQL database. The SQL database won't be hosted inside of k8s, instead Microsoft's PaaS offering (SQL Azure) is used. The Sample is licensed under [MIT](./LICENSE)\n\n-   An Angular SPA\n-   .NET Core 2.0\n    -   An API for reading Sessions `Sessions.API`\n-   .NET Core 2.0\n    -   An API for reading votes and persisting new votes `Votings.API`\n-   .NET Core 2.0 CronJob\n    -   Which will remove old audit logs from SQL database `Sessions.AuditLogCleaner`\n\n## Cloud Environment\n\nFor running and hosting the application, the following environment is required.\n\n    - SQL Azure\n    - Azure Container Registry (ACR)\n    - Azure Kubernetes Service (AKS)\n\nThe cloud environment can be deployed using [Terraform](https://github.com/hashicorp/terraform). The subfolder `terraform` contains already the environment and can be configured according to your needs by specifying your settings in a `terraform.tfvars` file. The `terraform/terraform.tfvars.sample` contains an example configuration.\n\n## Developer Environment Requirements\n\n    - Azure CLI (`az`)\n    - Kubernetes Control (`kubectl`)\n    - Docker (`docker`)\n\n## Generating the Database\n\n-   Define a firewall exception for your local IP address on SQL Azure (SQL Server).\n-   Create a new (empty) SQL Database\n-   Set the connection string **temporary** as _ENVIRONMENT Variable_ with the name `DbConnectionString`\n-   Execute EF Migrations (Sessions.Migrations C# Project in `/backend/Sessions.Migrations`) using VS or Rider to generate the database from the current C# model\n\n## Building Docker images\n\nDocker images must be generated for all four components. Replace `thhdemo.azurecr.io` with your ACR instance identifier.\n\n```\n$ cd backend\nbackend $ docker build -t thhdemo.azurecr.io/sessions:latest -f sessions-ms.Dockerfile .\nbackend $ docker build -t thhdemo.azurecr.io/votings:latest -f votings-ms.Dockerfile .\nbackend $ docker build -t thhdemo.azurecr.io/sessions-cleaner:latest -f log-cleaner.Dockerfile .\nbackend $ cd ..\ncd frontend\nfrontend $ docker build -t thhdemo.azurecr.io/frontend:latest .\n```\n\n## Push images to ACR\n\nReplace `thhdemo` with your ACR instance identifier\n\n```\n$ az acr login --name thhdemo\n$ docker push thhdemo.azurecr.io/sessions-api:1.0.0\n$ docker push thhdemo.azurecr.io/votings-api:1.0.0\n$ docker push thhdemo.azurecr.io/sessions-cleaner:1.0.0\n$ docker push thhdemo.azurecr.io/sessions-spa:1.0.0\n```\n\n## Prepare AKS deployment\n\nAll kubernetes resources are defined in `deployment` directory. You'll find a `secrets.template.yaml` there. Rename it to `secrets.yaml` and replace the token `\u003c\u003cbase64 ...\u003e\u003e` with your DB connection string in base64. You can generate a `base64` representation using the following command:\n\n```\n$ echo -n 'my connectionstring' | base64\n```\n\nUpdate `backend.yaml`, `frontend.yaml` and `cronjob.yaml` and provide correct name for your docker images (again replace `thhdemo.azurecr.io` with your ACR stuff).\n\n## Deploy to AKS\n\nExecute the following commands to deploy everything to AKS:\n\n```\n$ cd deployment\ndeployment $ kubectl create -f secrets.yaml\ndeployment $ kubectl create -f services.yaml\ndeployment $ kubectl create -f backend.yaml\ndeployment $ kubectl create -f frontend.yaml\ndeployment $ kubectl create -f cronjob.yaml\n```\n\n# Scale deployments\n\n```\n$ kubectl scale deployment sessions-api --replicas 5\n$ kubectl scale deployment votings-api --replicas 5\n$ kubectl scale deployment sessions-spa --replicas 3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorstenhans%2Faks-demo-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthorstenhans%2Faks-demo-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorstenhans%2Faks-demo-app/lists"}