{"id":16598573,"url":"https://github.com/snickerjp/mslearn-java-petclinic-simplified","last_synced_at":"2025-08-31T05:33:42.890Z","repository":{"id":230242268,"uuid":"778888860","full_name":"snickerjp/mslearn-java-petclinic-simplified","owner":"snickerjp","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-31T07:18:35.000Z","size":379,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-14T15:13:05.347Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/snickerjp.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":"2024-03-28T15:54:35.000Z","updated_at":"2024-03-28T15:54:41.000Z","dependencies_parsed_at":"2024-11-16T12:41:07.344Z","dependency_job_id":"a7d1c70d-0c0e-4bec-b9bd-97e39f21362e","html_url":"https://github.com/snickerjp/mslearn-java-petclinic-simplified","commit_stats":null,"previous_names":["snickerjp/mslearn-java-petclinic-simplified"],"tags_count":0,"template":false,"template_full_name":"MicrosoftDocs/mslearn-java-petclinic-simplified","purl":"pkg:github/snickerjp/mslearn-java-petclinic-simplified","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickerjp%2Fmslearn-java-petclinic-simplified","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickerjp%2Fmslearn-java-petclinic-simplified/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickerjp%2Fmslearn-java-petclinic-simplified/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickerjp%2Fmslearn-java-petclinic-simplified/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snickerjp","download_url":"https://codeload.github.com/snickerjp/mslearn-java-petclinic-simplified/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickerjp%2Fmslearn-java-petclinic-simplified/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272940940,"owners_count":25019004,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-12T00:09:01.397Z","updated_at":"2025-08-31T05:33:42.856Z","avatar_url":"https://github.com/snickerjp.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring PetClinic with GitHub Actions on Azure\n\n## Deploying to Azure\n\nWe use Terraform to create an Azure resource group with a MySQL database and an Azure App Service web application.\n\nYou will probably want to customize your application name, and maybe your resource group name: edit the `terraform/variables.tf` for this.\n\nTo create your Azure resources, install Terraform and run it:\n\n```bash\ncd terraform\nterraform init\nterraform apply\ncd ..\n```\n\nTo delete your resources, you will also be able to use Terraform:\n\n```bash\ncd terraform\nterraform destroy\ncd ..\n```\n\nTo deploy the application, you will need to edit the `pom.xml` and edit the `azure-webapp-maven-plugin` plugin\nsection, in order to configure the resource group and the application name (which should be the same as\nthe ones configured in Terraform).\n\nThen, deploy the application by running:\n\n```bash\n./mvnw com.microsoft.azure:azure-webapp-maven-plugin:1.12.0:deploy\n```\n\n## Use GitHub Actions\n\n## Set Up up your workflow\n\nCreate a service principal to deploy to Azure.\n\n\u003e [!IMPORTANT]\n\u003e Make sure you assign the name of your resource group to the variable `AZ_RESOURCE_GROUP` or substitute the value for it in the commands below.\n\u003e Replace `yourServicePrincipalName` with a name of your service principal you choose.\n\n```bash\nRESOURCE_ID=$(az group show --name \"$AZ_RESOURCE_GROUP\" --query id -o tsv)\naz ad sp create-for-rbac --name \"yourServicePrincipalName\" --role contributor --scopes \"$RESOURCE_ID\" --sdk-auth\n```\n\nThis command will return JSON - copy it and keep it safe as we'll use it in the next step:\n\n```bash\n{\n  \"clientId\": \"XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX\",\n  \"clientSecret\": \"XXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\n  \"subscriptionId\": \"XXXXXXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXXXXX\",\n  \"tenantId\": \"XXXXXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXXX\",\n  ...\n}\n```\n\n## GitHub Secrets\n\nOnce you have the required ID and Secrets, the next step is to add them the secret store in your GitHub project.\n\nGitHub repositories have a feature known as Secrets that allow you to store sensitive information related to a project. For this exercise, store three secrets – `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`, and `AZURE_TENANT_ID`.\nYou'll create these secrets because they'll be used by Terraform to authenticate to Azure.\n\nTo create the secrets, fork the GitHub repository, select the `Settings` menu and then on `Secrets`.\nCreate a GitHub secret for each of four secrets using the values returned the Azure service principal.\n\n## Workflow file\n\nInside the project directory, you'll see a directory called `.github/workflows` and a file called `main.yml` in it.\nThis file is a GitHub workflow and will use the secret we configured above to deploy the application to your Azure subscription.\n\nIn that file, you'll see the following content:\n\n```yaml\nname: CI\n\non:\n  push:\n    branches: [ main ]\n  pull_request:\n    branches: [ main ]\n\n  workflow_dispatch:\njobs:\n  terraform:\n    runs-on: ubuntu-latest\n\n    env:\n      ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}\n      ARM_CLIENT_SECRET: ${{secrets.AZURE_CLIENT_SECRET}}\n      ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}\n      ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}\n\n    defaults:\n      run:\n        working-directory: ./terraform\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Setup Terraform\n        uses: hashicorp/setup-terraform@v1\n\n      - name: Terraform Init\n        run: terraform init\n\n      - name: Terraform Plan\n        run: terraform plan\n\n      - name: Terraform Apply\n        run: terraform apply -auto-approve\n```\n\nThis workflow does the following actions:\n\n- Check whether the configuration is formatted properly\n- generate a plan for every pull requests\n- apply the configuration when you update the GitHub branch\n\nYour workflow will be triggered whenever code is pushed to the repository.\n\n## Test the GitHub Action\n\nYou can now manually trigger the GitHub Actions workflow by going to \"Actions\", then select the terraform workflow.\nThen, select the \"Terraform\" workflow. Notice how the \"Terraform Init\", \"Terraform Plan\" and \"Terraform Validate\" steps have been triggered.\nVerify your Azure App Instance is publicly available.\n\n## Deploy your application\n\nUse Maven, to deploy to your Azure instance.\n\n```bash\n./mvnw com.microsoft.azure:azure-webapp-maven-plugin:1.12.0:deploy\n```\n\n## Destroy your resources\n\nRemove the resources:\n\n```bash\nterraform destroy\n```\n\nEach time you `git push` your code, your TerraForm provisioned resources are now automatically deployed to production.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnickerjp%2Fmslearn-java-petclinic-simplified","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnickerjp%2Fmslearn-java-petclinic-simplified","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnickerjp%2Fmslearn-java-petclinic-simplified/lists"}