{"id":18069965,"url":"https://github.com/gordonby/aksc-petclinic","last_synced_at":"2025-04-12T00:34:43.562Z","repository":{"id":113353043,"uuid":"486102035","full_name":"Gordonby/aksc-petclinic","owner":"Gordonby","description":"A bicep driven deployment of the Java Spring PetClinic sample App onto the Azure Kubernetes Service","archived":false,"fork":false,"pushed_at":"2022-06-20T12:13:09.000Z","size":397,"stargazers_count":0,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T20:21:26.607Z","etag":null,"topics":["bicep","code-golf","helm","java","kubernetes","spring"],"latest_commit_sha":null,"homepage":"","language":"Smarty","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gordonby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-27T08:06:46.000Z","updated_at":"2022-04-28T15:12:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"257d7834-91e4-4064-87c4-401f6101880f","html_url":"https://github.com/Gordonby/aksc-petclinic","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/Gordonby%2Faksc-petclinic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gordonby%2Faksc-petclinic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gordonby%2Faksc-petclinic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gordonby%2Faksc-petclinic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gordonby","download_url":"https://codeload.github.com/Gordonby/aksc-petclinic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501700,"owners_count":21114676,"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":["bicep","code-golf","helm","java","kubernetes","spring"],"created_at":"2024-10-31T08:23:42.609Z","updated_at":"2025-04-12T00:34:43.525Z","avatar_url":"https://github.com/Gordonby.png","language":"Smarty","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AKS-Construction - Spring PetClinic\n\n## Sample Objective\n\nTo deploy a sample of the [Java Spring Petclinic](https://spring-petclinic.github.io/) micro-services application, Azure Kubernetes Service and supporting infrastructure all using Bicep from a single `az deployment` command. \n\nDeploying web applications as part of a Bicep deployment is not a production pattern, but is great for producing samples quickly. `#iac-code-golf`\n\n## Notable components\n\n### ACR\n\nRather than use publicly hosted docker images, we will import them into an Azure Container Registry where they can be [scanned by Microsoft Defender](https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-introduction?tabs=defender-for-container-arch-aks#scanning-images-in-acr-registries) before being used in Kubernetes.\n\n### AKS\n\n[AKS Construction](https://github.com/Azure/Aks-Construction) is being leveraged to deploy a secure cluster in a simple way.\n\n## PetClinic - helm chart\n\nA simple helm chart for the PetClinic application has been created, read more about it [here](spring-petclinic-cloud-chart/README.md).\n\n## The bicep\n\nBicep File | Description\n---------- | -----------\nmain.bicep | Orchestrates creation of all resources\naks-construction/main.bicep | Creates AKS and associated infrastructure components\nimportImages.bicep | Imports container images into ACR from DockerHub\n\nTwo [public registry](https://github.com/Azure/bicep-registry-modules) bicep modules are leveraged in this sample.\n\n- AKS Run Command [[readme](https://github.com/Azure/bicep-registry-modules/blob/main/modules/deployment-scripts/aks-run-command/README.md)]\n- Import ACR Images [[readme](https://github.com/Azure/bicep-registry-modules/blob/main/modules/deployment-scripts/import-acr/README.md)]\n\nLeveraging bicep modules from the public registry is a great way to save the complexity and repetition in your own IaC library.\n\n```bash\nmodule kubeNamespace 'br/public:deployment-scripts/aks-run-command:1.0.1' = {\n\nmodule acrImport 'br/public:deployment-scripts/import-acr:2.0.1' = {\n```\n\n## Lets deploy it!\n\nThe Azure CLI is the only prerequisite. If you deploy from the Azure CloudShell then this makes the process even simpler.\n\n```bash\naz group create -n aks-petclinic -l eastus\naz deployment group create -g aks-petclinic -f main.bicep\n```\n\n## The Result\n\n## Deployed Resources\n\n![deployments](azDeployment.png)\n\n### Imported Container Images\n![acr](acrRepositories.png)\n\n### The Kubernetes Application\n\n```bash\naz aks get-credentials -n aks-petclinic -g aks-petclinic\nkubectl get pod -n spring-petclinic\nkubectl get svc -n spring-petclinic\n\nNAME                                 READY   STATUS                       RESTARTS   AGE\napi-gateway-5f74c7b69-flxrz          1/1     Running                      0          12m\ncustomers-db-mysql-0                 1/1     Running                      0          50m\ncustomers-service-77449fc644-kfnlr   1/1     Running                      0          12m\nvets-db-mysql-0                      1/1     Running                      0          50m\nvets-service-56d58bbdcb-vpr5z        1/1     Running                      0          12m\nvisits-db-mysql-0                    1/1     Running                      0          50m\nvisits-service-8474b89fdc-g9lvh      1/1     Running                      0          12m\nwavefront-proxy-648f66bbc5-72gsx     0/1     CreateContainerConfigError   0          12m\n\nNAME                          TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)             AGE\napi-gateway                   LoadBalancer   172.10.122.227   20.232.248.202   80:31524/TCP        12m\ncustomers-db-mysql            ClusterIP      172.10.123.52    \u003cnone\u003e           3306/TCP            50m\ncustomers-db-mysql-headless   ClusterIP      None             \u003cnone\u003e           3306/TCP            50m\ncustomers-service             ClusterIP      172.10.79.168    \u003cnone\u003e           8080/TCP            12m\nvets-db-mysql                 ClusterIP      172.10.222.167   \u003cnone\u003e           3306/TCP            50m\nvets-db-mysql-headless        ClusterIP      None             \u003cnone\u003e           3306/TCP            50m\nvets-service                  ClusterIP      172.10.247.35    \u003cnone\u003e           8080/TCP            12m\nvisits-db-mysql               ClusterIP      172.10.147.205   \u003cnone\u003e           3306/TCP            50m\nvisits-db-mysql-headless      ClusterIP      None             \u003cnone\u003e           3306/TCP            50m\nvisits-service                ClusterIP      172.10.184.235   \u003cnone\u003e           8080/TCP            12m\nwavefront-proxy               ClusterIP      172.10.234.200   \u003cnone\u003e           2878/TCP,9411/TCP   12m\n```\n\n![web app](webapp.png)\n\n## Deployment Troubleshooting/Notes\n\nIssue | Error | Impact  | Summary\n----- | ----- | ------- | ------\nWavefront | Error: secret \"wavefront\" not found |  This is an optional step to make use of VMWare Tanzu Observability. | Ideally we need to enhance helm chart to make wavefront install conditional. Additionally we can look to enable Azure Application Insights as a further option.\n\n## Repo Notes\n\nThis repo uses git submodules. The following commands were run to clone the respective repositories at a point in time.\nThis was done rather than forking as\n- This project will not be contributing back to the Petclinic sample\n- Submodules captures the repo at a point in time, which is good for our sample. We can fetch latest and test as this sample is periodically reviewed.\n\n```bash\ngit submodule add https://github.com/Azure/AKS-Construction.git aks-construction\ngit submodule add https://github.com/spring-petclinic/spring-petclinic-cloud.git spring-petclinic-cloud\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgordonby%2Faksc-petclinic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgordonby%2Faksc-petclinic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgordonby%2Faksc-petclinic/lists"}