{"id":18736770,"url":"https://github.com/selvasingh/e2e-java-experience-in-app-service-linux","last_synced_at":"2025-11-17T04:30:13.807Z","repository":{"id":82967558,"uuid":"147264833","full_name":"selvasingh/e2e-java-experience-in-app-service-linux","owner":"selvasingh","description":"End-to-end Java experience in App Service Linux","archived":false,"fork":false,"pushed_at":"2019-12-16T03:05:18.000Z","size":347,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T17:13:58.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Azure-Samples/e2e-java-experience-in-app-service-linux","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selvasingh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2018-09-03T23:59:36.000Z","updated_at":"2023-09-28T21:18:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"b59bcc1a-e992-4ab2-8832-e7aecf028e8d","html_url":"https://github.com/selvasingh/e2e-java-experience-in-app-service-linux","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/selvasingh%2Fe2e-java-experience-in-app-service-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fe2e-java-experience-in-app-service-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fe2e-java-experience-in-app-service-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fe2e-java-experience-in-app-service-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selvasingh","download_url":"https://codeload.github.com/selvasingh/e2e-java-experience-in-app-service-linux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239611993,"owners_count":19668274,"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":[],"created_at":"2024-11-07T15:22:25.327Z","updated_at":"2025-11-17T04:30:13.726Z","avatar_url":"https://github.com/selvasingh.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nservices: app-service, MySQL\nplatforms: java\nauthor: selvasingh\n---\n\n# End-to-end Java Experience in App Service Linux \n\nThis guide walks you through the process of building, \nconfiguring, deploying, trouble shooting and scaling \nJava Web apps in App Service Linux. \n\n## What you will build\n\nYou will build a Java Web app using Spring Framework, \nJSP, Spring Data, Hibernate, JDBC, App Service Linux and\nAzure Database for MySQL.\n\n## What you will need\n\nIn order to deploy a Java Web app to cloud, you need \nan Azure subscription. If you do not already have an Azure \nsubscription, you can activate your \n[MSDN subscriber benefits](https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details/) \nor sign up for a \n[free Azure account]((https://azure.microsoft.com/pricing/free-trial/)).\n\nIn addition, you will need the following:\n\n| [Azure CLI](http://docs.microsoft.com/cli/azure/overview) \n| [Java 8](http://java.oracle.com/) \n| [Maven 3](http://maven.apache.org/) \n| [Git](https://github.com/) \n| [Tomcat](https://tomcat.apache.org/download-80.cgi)\n| [MySQL CLI](http://dev.mysql.com/downloads/mysql/) |\n\n## Getting Started\n\nYou can start from scratch and complete each step, or \nyou can bypass basic setup steps that you are already \nfamiliar with. Either way, you will end up with working code.\n\nWhen you are finished, you can check your results \nagainst YOUR code in \n[e2e-java-experience-in-app-service-linux/complete](https://github.com/Azure-Samples/e2e-java-experience-in-app-service-linux/tree/master/complete).\n\nYou can start from [e2e-java-experience-in-app-service-linux/initial-hsqldb](https://github.com/Azure-Samples/e2e-java-experience-in-app-service-linux/tree/master/initial-hsqldb).\nOr, you can clone from [spring-framework-petclinic](https://github.com/spring-petclinic/spring-framework-petclinic) \n\nIf you are starting from scratch, you can scaffold a Web app using \n[Maven Web app archetype](https://maven.apache.org/archetypes/maven-archetype-webapp/)\nor [start.spring.io](https://start.spring.io/).\n\n#### Step ONE - Clone and Prep\n\n```bash\ngit clone --recurse-submodules https://github.com/Azure-Samples/e2e-java-experience-in-app-service-linux.git\nyes | cp -rf .prep/* .\n```\n\n## Build and Deploy Pet Clinic Powered Using HSQLDB\n\nOpen the [initial-hsqldb/spring-framework-petclinic](https://github.com/Azure-Samples/e2e-java-experience-in-app-service-linux/tree/master/initial-hsqldb)\nsample app in your favorite IDE - IntelliJ | Eclipse | VS Code.\n\n#### Build Pet Clinic\n   ```bash\ncd initial-hsqldb/spring-framework-petclinic\n\nbash-3.2$ mvn package\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building petclinic 5.0.8\n[INFO] ------------------------------------------------------------------------\n...\n...\n\n[INFO] --- maven-war-plugin:2.3:war (default-war) @ spring-petclinic ---\n[INFO] Packaging webapp\n[INFO] Assembling webapp [spring-petclinic] in [/Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-hsqldb/spring-framework-petclinic/target/petclinic]\n[INFO] Processing war project\n[INFO] Copying webapp resources [/Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-hsqldb/spring-framework-petclinic/src/main/webapp]\n[INFO] Webapp assembled in [288 msecs]\n[INFO] Building war: /Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-hsqldb/spring-framework-petclinic/target/petclinic.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 24.727 s\n[INFO] Finished at: 2018-09-02T22:17:02-07:00\n[INFO] Final Memory: 91M/848M\n[INFO] ------------------------------------------------------------------------\n\n   ```\n    \n#### Deploy to Local Tomcat\n\nAdd local Tomcat configuration to POM.xml and deploy\nPet Clinic to a Tomcat in your local machine: \n\n```xml\n\u003cplugins\u003e\n\n    \u003c!--*************************************************--\u003e\n    \u003c!-- Deploy to Tomcat on localhost                   --\u003e\n    \u003c!--*************************************************--\u003e\n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.codehaus.cargo\u003c/groupId\u003e\n        \u003cartifactId\u003ecargo-maven2-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.6.7\u003c/version\u003e\n        \u003cconfiguration\u003e\n            \u003ccontainer\u003e\n                \u003ccontainerId\u003etomcat8x\u003c/containerId\u003e\n                \u003ctype\u003einstalled\u003c/type\u003e\n                \u003chome\u003e${TOMCAT_HOME}\u003c/home\u003e\n            \u003c/container\u003e\n            \u003cconfiguration\u003e\n                \u003ctype\u003eexisting\u003c/type\u003e\n                \u003chome\u003e${TOMCAT_HOME}\u003c/home\u003e\n            \u003c/configuration\u003e\n            \u003c!-- Deployables configuration --\u003e\n            \u003cdeployables\u003e\n                \u003cdeployable\u003e\n                    \u003cgroupId\u003e${project.groupId}\u003c/groupId\u003e\n                    \u003cartifactId\u003e${project.artifactId}\u003c/artifactId\u003e\n                    \u003ctype\u003ewar\u003c/type\u003e\n                    \u003cproperties\u003e\n                        \u003ccontext\u003e/\u003c/context\u003e\n                    \u003c/properties\u003e\n                \u003c/deployable\u003e\n            \u003c/deployables\u003e\n        \u003c/configuration\u003e\n    \u003c/plugin\u003e\n    ...\n    \n\u003c/plugins\u003e\n```\nSet environment variables for binding secrets at runtime:\n\n```bash\ncp set-env-variables-template.sh .scripts/set-env-variables.sh\n```\n\nModify `.scripts/set-env-variables.sh` and set Azure Resource Group name, \nApp Service Web App Name, Azure Region and Tomcat directory in\n the local machine. Then, set environment variables:\n \n```bash\nsource .scripts/set-env-variables.sh\n```\n \nDeploy to a local Tomcat:\n\n```bash\nbash-3.2$ mvn cargo:deploy\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building petclinic 5.0.8\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- cargo-maven2-plugin:1.6.7:deploy (default-cli) @ spring-petclinic ---\n[INFO] [edDeployerDeployMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.6.7 for container tomcat8x\n[INFO] [stalledLocalDeployer] Deploying [/Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-hsqldb/spring-framework-petclinic/target/petclinic.war] to [/Users/selvasingh/apache-tomcat-8.5.29/webapps]...\n[INFO] [stalledLocalDeployer] The WAR file has its context set to / and will therefore be deployed as ROOT.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 1.639 s\n[INFO] Finished at: 2018-09-02T22:20:54-07:00\n[INFO] Final Memory: 14M/309M\n[INFO] ------------------------------------------------------------------------\n```\n    \n#### Start Tomcat\n\n```bash\ncd ${TOMCAT_HOME}\n./bin/catalina.sh run\n```\n\n#### Open Pet Clinic (HSQLDB) running on Local Tomcat\n\n```bash\nopen http://localhost:8080\n```\n\n![](./media/petclinic-on-local-tomcat.jpg)\n\n#### Deploy to App Service Linux \n\nAdd [Maven Plugin for Azure App Service](https://github.com/Microsoft/azure-maven-plugins/blob/develop/azure-webapp-maven-plugin/README.md) configuration to POM.xml and deploy\nPet Clinic to Tomcat in App Service Linux:\n\n```xml    \n\u003cplugins\u003e \n\n    \u003c!--*************************************************--\u003e\n    \u003c!-- Deploy to Tomcat in App Service Linux           --\u003e\n    \u003c!--*************************************************--\u003e\n       \n    \u003cplugin\u003e\n        \u003cgroupId\u003ecom.microsoft.azure\u003c/groupId\u003e\n        \u003cartifactId\u003eazure-webapp-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.8.0\u003c/version\u003e\n        \u003cconfiguration\u003e\n    \n            \u003c!-- Web App information --\u003e\n            \u003cresourceGroup\u003e${RESOURCEGROUP_NAME}\u003c/resourceGroup\u003e\n            \u003cappServicePlanName\u003e${WEBAPP_PLAN_NAME}\u003c/appServicePlanName\u003e\n            \u003cappName\u003e${WEBAPP_NAME}\u003c/appName\u003e\n            \u003cregion\u003e${REGION}\u003c/region\u003e\n    \n            \u003c!-- Java Runtime Stack for Web App on Linux--\u003e\n            \u003clinuxRuntime\u003etomcat 9.0-jre8\u003c/linuxRuntime\u003e\n    \n        \u003c/configuration\u003e\n    \u003c/plugin\u003e\n    ...\n\u003c/plugins\u003e\n```\n\nDeploy to Tomcat in App Service Linux:\n\n```bash\n// Log into Azure\naz login\n\n// Deploy\nbash-3.2$ mvn azure-webapp:deploy\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building petclinic 5.0.8\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- azure-webapp-maven-plugin:1.8.0:deploy (default-cli) @ spring-petclinic ---\n[INFO] Authenticate with Azure CLI 2.0\n[INFO] Target Web App doesn't exist. Creating a new one...\n[INFO] Creating App Service Plan 'petclinic-hsqldb-appservice-plan'...\n[INFO] Successfully created App Service Plan.\n[INFO] Successfully created Web App.\n[INFO] Trying to deploy artifact to petclinic-hsqldb...\n[INFO] Deploying the war file...\n[INFO] Successfully deployed the artifact to https://petclinic-hsqldb.azurewebsites.net\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 03:27 min\n[INFO] Finished at: 2018-09-02T22:33:54-07:00\n[INFO] Final Memory: 57M/874M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Open Pet Clinic running on Tomcat in App Service Linux\n\n```bash\nopen https://petclinic-hsqldb.azurewebsites.net\n```\n![](./media/petclinic-on-tomcat-in-app-service-linux.jpg)\n\nWhen you are finished, you can check your results \nagainst YOUR code in \n[e2e-java-experience-in-app-service-linux/initial-mysql](https://github.com/Azure-Samples/e2e-java-experience-in-app-service-linux/tree/master/initial-mysql).\n\n## Build and Deploy Pet Clinic Powered Using Azure Database for MySQL\n\nStart your next leg of your journey ... change directory:\n\n```bash\ncd ../../initial-mysql/spring-framework-petclinic\n```\n\n#### Activate MySQL Profile\n\nActivate MySQL profile in POM.xml by moving the \n```xml \u003cactivation\u003e\u003c/activation\u003e``` markup to MySQL profile:\n\n```xml\n        \u003cprofile\u003e\n            \u003cid\u003eMySQL\u003c/id\u003e\n            \u003c!-- Activate MySQL profile --\u003e\n            \u003cactivation\u003e\n                \u003cactiveByDefault\u003etrue\u003c/activeByDefault\u003e\n            \u003c/activation\u003e\n            ...\n        \u003c/profile\u003e\n``` \n\n#### Set environment variables for binding secrets at runtime\n\n```bash\ncp set-env-variables-template.sh .scripts/set-env-variables.sh\n```\n\nModify `.scripts/set-env-variables.sh` and set Azure Resource Group name, \nApp Service Web App Name, Azure Region, Tomcat directory in\n the local machine and MySQL server info. \n Then, set environment variables:\n \n```bash\nsource .scripts/set-env-variables.sh\n```\n\n#### Provision and Configure Pet Clinic DB in Azure Database for MySQL\n\nProvision Pet Clinic DB using Azure CLI and MySQL CLI:\n\n```bash\n// create mysql server\naz mysql server create --resource-group ${RESOURCEGROUP_NAME} \\\n --name ${MYSQL_SERVER_NAME}  --location westus2 \\\n --admin-user ${MYSQL_SERVER_ADMIN_LOGIN_NAME} \\\n --admin-password ${MYSQL_SERVER_ADMIN_PASSWORD} \\\n --sku-name GP_Gen4_2 \\\n --ssl-enforcement Disabled \\\n --version 5.7\n\n// allow access from Azure resources\naz mysql server firewall-rule create --name allAzureIPs \\\n --server ${MYSQL_SERVER_NAME} \\\n --resource-group ${RESOURCEGROUP_NAME} \\\n --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0\n\n// allow access from your dev machine for testing\naz mysql server firewall-rule create --name allAzureIPs \\\n --server ${MYSQL_SERVER_NAME} \\\n --resource-group ${RESOURCEGROUP_NAME} \\\n --start-ip-address \u003cip-address-of-your-dev-machine\u003e \\\n --end-ip-address \u003cip-address-of-your-dev-machine\u003e\n\n// increase connection timeout\naz mysql server configuration set --name wait_timeout \\\n --resource-group ${RESOURCEGROUP_NAME} \\\n --server ${MYSQL_SERVER_NAME} --value 2147483\n\n// set server timezone\naz mysql server configuration set --name time_zone \\\n --resource-group ${RESOURCEGROUP_NAME} \\\n --server ${MYSQL_SERVER_NAME} --value US/Pacific\n \nmysql -u ${MYSQL_SERVER_ADMIN_LOGIN_NAME} \\\n -h ${MYSQL_SERVER_FULL_NAME} -P 3306 -p\n \nEnter password: \nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 64379\nServer version: 5.6.39.0 MySQL Community Server (GPL)\n\nCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.\n\nOracle is a registered trademark of Oracle Corporation and/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql\u003e CREATE DATABASE ${MYSQL_DATABASE_NAME};\nQuery OK, 1 row affected (0.10 sec)\n\nmysql\u003e CREATE USER 'root' IDENTIFIED BY '${MYSQL_DATABASE_NAME}';\nQuery OK, 0 rows affected (0.11 sec)\n\nmysql\u003e GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE_NAME}.* TO 'root';\nQuery OK, 0 rows affected (1.29 sec)\n\nmysql\u003e quit\nBye\n```\n\n#### Setup configuration for binding secrets at runtime instead of compile time\n\nModify MySQL configuration in POM.xml to \nbind secrets at runtime:\n\n```xml\n\u003cprofile\u003e\n    \u003cid\u003eMySQL\u003c/id\u003e\n    \u003cactivation\u003e\n        \u003cactiveByDefault\u003etrue\u003c/activeByDefault\u003e\n    \u003c/activation\u003e\n    \u003cproperties\u003e\n        \u003cdb.script\u003emysql\u003c/db.script\u003e\n        \u003cjpa.database\u003eMYSQL\u003c/jpa.database\u003e\n        \u003cjdbc.driverClassName\u003ecom.mysql.jdbc.Driver\u003c/jdbc.driverClassName\u003e\n        \u003cjdbc.url\u003ejdbc:mysql://${DOLLAR}{MYSQL_SERVER_FULL_NAME}:3306/${DOLLAR}{MYSQL_DATABASE_NAME}?useUnicode=true\u003c/jdbc.url\u003e\n        \u003cjdbc.username\u003e${DOLLAR}{MYSQL_SERVER_ADMIN_LOGIN_NAME}\u003c/jdbc.username\u003e\n        \u003cjdbc.password\u003e${DOLLAR}{MYSQL_SERVER_ADMIN_PASSWORD}\u003c/jdbc.password\u003e\n    \u003c/properties\u003e\n    ...\n\u003c/profile\u003e\n```\n\nModify Maven Plugin for Azure App Service configuration in \nPOM.xml to bind secrets at runtime:\n\n```xml\n\u003c!--*************************************************--\u003e\n\u003c!-- Deploy to tomcat in app service linux           --\u003e\n\u003c!--*************************************************--\u003e\n\n\u003cplugin\u003e\n    \u003cgroupId\u003ecom.microsoft.azure\u003c/groupId\u003e\n    \u003cartifactId\u003eazure-webapp-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e1.8.0\u003c/version\u003e\n    \u003cconfiguration\u003e\n\n        \u003c!-- Web App information --\u003e\n        \u003cresourceGroup\u003e${RESOURCEGROUP_NAME}\u003c/resourceGroup\u003e\n        \u003cappServicePlanName\u003e${WEBAPP_PLAN_NAME}\u003c/appServicePlanName\u003e\n        \u003cappName\u003e${WEBAPP_NAME}\u003c/appName\u003e\n        \u003cregion\u003e${REGION}\u003c/region\u003e\n\n        \u003c!-- Java Runtime Stack for Web App on Linux--\u003e\n        \u003clinuxRuntime\u003etomcat 9.0-jre8\u003c/linuxRuntime\u003e\n\n        \u003cappSettings\u003e\n            \u003cproperty\u003e\n                \u003cname\u003eMYSQL_SERVER_FULL_NAME\u003c/name\u003e\n                \u003cvalue\u003e${MYSQL_SERVER_FULL_NAME}\u003c/value\u003e\n            \u003c/property\u003e\n            \u003cproperty\u003e\n                \u003cname\u003eMYSQL_SERVER_ADMIN_LOGIN_NAME\u003c/name\u003e\n                \u003cvalue\u003e${MYSQL_SERVER_ADMIN_LOGIN_NAME}\u003c/value\u003e\n            \u003c/property\u003e\n            \u003cproperty\u003e\n                \u003cname\u003eMYSQL_SERVER_ADMIN_PASSWORD\u003c/name\u003e\n                \u003cvalue\u003e${MYSQL_SERVER_ADMIN_PASSWORD}\u003c/value\u003e\n            \u003c/property\u003e\n            \u003cproperty\u003e\n                \u003cname\u003eMYSQL_DATABASE_NAME\u003c/name\u003e\n                \u003cvalue\u003e${MYSQL_DATABASE_NAME}\u003c/value\u003e\n            \u003c/property\u003e\n        \u003c/appSettings\u003e\n    \u003c/configuration\u003e\n\u003c/plugin\u003e\n```\n#### Build Pet Clinic\n\n```bash\nbash-3.2$ mvn package\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building petclinic 5.0.8\n[INFO] ------------------------------------------------------------------------\n...\n...\n[INFO] --- maven-war-plugin:2.3:war (default-war) @ spring-petclinic ---\n[INFO] Packaging webapp\n[INFO] Assembling webapp [spring-petclinic] in [/Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-mysql/spring-framework-petclinic/target/petclinic]\n[INFO] Processing war project\n[INFO] Copying webapp resources [/Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-mysql/spring-framework-petclinic/src/main/webapp]\n[INFO] Webapp assembled in [540 msecs]\n[INFO] Building war: /Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-mysql/spring-framework-petclinic/target/petclinic.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 47.670 s\n[INFO] Finished at: 2018-09-03T07:24:07-07:00\n[INFO] Final Memory: 87M/585M\n[INFO] -----------------------------------------------------------------------\n```\n#### Deploy to Local Tomcat and Test\n\nDeploy to a local Tomcat:\n\n```bash\nbash-3.2$ mvn cargo:deploy\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building petclinic 5.0.8\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- cargo-maven2-plugin:1.6.7:deploy (default-cli) @ spring-petclinic ---\n[INFO] [edDeployerDeployMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.6.7 for container tomcat8x\n[INFO] [stalledLocalDeployer] Deploying [/Users/selvasingh/GitHub/selvasingh/e2e-java-experience-in-app-service-linux/initial-mysql/spring-framework-petclinic/target/petclinic.war] to [/Users/selvasingh/apache-tomcat-8.5.29/webapps]...\n[INFO] [stalledLocalDeployer] The WAR file has its context set to / and will therefore be deployed as ROOT.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 1.795 s\n[INFO] Finished at: 2018-09-03T07:26:27-07:00\n[INFO] Final Memory: 17M/437M\n[INFO] ------------------------------------------------------------------------\n```\n\nStart local Tomcat:\n\n```bash\ncd ${TOMCAT_HOME}\n./bin/catalina.sh run\n```\n\nThe Pet Clinic app is now powered using Azure \nDatabase for MySQL. The app should look the same as before.\n\n#### Deploy to App Service Linux \n\nDeploy to Tomcat in App Service Linux:\n\n```bash\nbash-3.2$ mvn azure-webapp:deploy\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building petclinic 5.0.8\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- azure-webapp-maven-plugin:1.8.0:deploy (default-cli) @ spring-petclinic ---\n[INFO] Authenticate with Azure CLI 2.0\n[INFO] Target Web App doesn't exist. Creating a new one...\n[INFO] Creating App Service Plan 'petclinic-mysql-appservice-plan'...\n[INFO] Successfully created App Service Plan.\n[INFO] Successfully created Web App.\n[INFO] Trying to deploy artifact to petclinic-mysql...\n[INFO] Deploying the war file...\n[INFO] Successfully deployed the artifact to https://petclinic-mysql.azurewebsites.net\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 03:27 min\n[INFO] Finished at: 2018-09-03T07:39:42-07:00\n[INFO] Final Memory: 48M/572M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Trouble Shoot Pet Clinic on Azure by Viewing Logs\n\nConfigure logs for the deployed Java Web \napp in App Service Linux:\n\n```bash\naz webapp log config --name ${WEBAPP_NAME} \\\n --resource-group ${RESOURCEGROUP_NAME} \\\n  --web-server-logging filesystem\n```\n\nOpen Java Web app remote log stream from a local machine:\n\n```bash\naz webapp log tail --name ${WEBAPP_NAME} \\\n --resource-group ${RESOURCEGROUP_NAME}\n \n2018-09-03T14:45:21  Welcome, you are now connected to log-streaming service.\n\n2018-09-03 14:43:44.347 INFO  - Starting container for site\n2018-09-03 14:43:44.354 INFO  - docker run -d -p 17101:80 --name petclinic-mysql_2 -e WEBSITE_SITE_NAME=petclinic-mysql -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=4440212f0d71a318f30d6be76de43332336c145d0f11304df4b060a498433702 -e HTTP_LOGGING_ENABLED=1 appsvc/tomcat:8.5-jre8_0000000000  \n...\n...\n2018-09-03T14:45:20.208498228Z INFO  SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'\n2018-09-03T14:45:20.485989744Z INFO  DispatcherServlet - FrameworkServlet 'dispatcher': initialization completed in 6597 ms\n2018-09-03T14:45:20.751742047Z 03-Sep-2018 14:45:20.751 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/site/wwwroot/webapps/ROOT] has finished in [69,452] ms\n2018-09-03T14:45:20.771519969Z 03-Sep-2018 14:45:20.770 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [\"http-nio-80\"]\n2018-09-03T14:45:20.829513635Z 03-Sep-2018 14:45:20.829 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 70243 ms\n\n```\n\n#### Open Pet Clinic running on Tomcat in App Service Linux\n\n```bash\nopen https://petclinic-mysql.azurewebsites.net\n```\n![](./media/petclinic-on-tomcat-in-app-service-linux-with-data-from-mysql.jpg)\n\nWhen you are finished, you can check your results \nagainst YOUR code in \n[e2e-java-experience-in-app-service-linux/complete](https://github.com/Azure-Samples/e2e-java-experience-in-app-service-linux/tree/master/complete).\n\n## Scale out the Pet Clinic App\n\nScale out Java Web app using Azure CLI:\n\n```bash\naz appservice plan update --number-of-workers 2 \\\n   --name ${WEBAPP_PLAN_NAME} \\\n   --resource-group ${RESOURCEGROUP_NAME}\n```\n\n## Congratulations!\n\nCongratulations!! You built and scaled out a Java Web app using Spring Framework, \nJSP, Spring Data, Hibernate, JDBC, App Service Linux and\nAzure Database for MySQL.\n\n## Resources\n\n- Link to Java in App Service Linux dev guide (coming soon)\n- [Azure for Java Developers](https://docs.microsoft.com/en-us/java/azure/)\n\n---\n\nThis project has adopted \nthe [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). \nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or \ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) \nwith any additional \nquestions or comments.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselvasingh%2Fe2e-java-experience-in-app-service-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselvasingh%2Fe2e-java-experience-in-app-service-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselvasingh%2Fe2e-java-experience-in-app-service-linux/lists"}