{"id":18736774,"url":"https://github.com/selvasingh/migrate-java-ee-app-to-azure","last_synced_at":"2025-06-20T15:11:39.117Z","repository":{"id":82967587,"uuid":"164037573","full_name":"selvasingh/migrate-Java-EE-app-to-azure","owner":"selvasingh","description":"Migrate an existing Java EE workload to Azure","archived":false,"fork":false,"pushed_at":"2020-12-28T05:21:20.000Z","size":4258,"stargazers_count":1,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T19:46:46.441Z","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/migrate-Java-EE-app-to-azure","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":"2019-01-04T00:35:01.000Z","updated_at":"2023-11-07T12:50:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"ee36dbe4-57bc-4468-99e2-41d98a4eb7d4","html_url":"https://github.com/selvasingh/migrate-Java-EE-app-to-azure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/selvasingh/migrate-Java-EE-app-to-azure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fmigrate-Java-EE-app-to-azure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fmigrate-Java-EE-app-to-azure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fmigrate-Java-EE-app-to-azure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fmigrate-Java-EE-app-to-azure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selvasingh","download_url":"https://codeload.github.com/selvasingh/migrate-Java-EE-app-to-azure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selvasingh%2Fmigrate-Java-EE-app-to-azure/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260967899,"owners_count":23090107,"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.643Z","updated_at":"2025-06-20T15:11:34.104Z","avatar_url":"https://github.com/selvasingh.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nservices: app-service, PostgreSQL, MySQL\nplatforms: java\nauthor: selvasingh, sadigopu\n---\n\n# Migrate Java EE App to Azure\n\nThis guide walks you through the process of migrating an \nexisting Java EE workload to Azure, aka:\n \n- Java EE app to App Service Linux and \n- App's data to Azure Database for PostgreSQL, MySQL and or SQL Database. \n\n## Table of Contents\n\n   * [Migrate Java EE App to Azure](#migrate-java-ee-app-to-azure)\n      * [Table of Contents](#table-of-contents)\n      * [What you will migrate to cloud](#what-you-will-migrate-to-cloud)\n      * [What you will need](#what-you-will-need)\n      * [Getting Started](#getting-started)\n         * [Step ONE - Clone and Prep](#step-one---clone-and-prep)\n      * [Build and Deploy Pet Store Powered Using H2](#build-and-deploy-pet-store-powered-using-h2)\n         * [Build Pet Store](#build-pet-store)\n         * [Deploy to WildFly in App Service Linux](#deploy-to-wildfly-in-app-service-linux)\n         * [Open Pet Store running on App Service in App Service Linux](#open-pet-store-running-on-app-service-in-app-service-linux)\n      * [Build and Deploy Pet Store Powered Using Azure Database for PostgreSQL](#build-and-deploy-pet-store-powered-using-azure-database-for-postgresql)\n         * [Add PostgreSQL Profile](#add-postgresql-profile)\n         * [Set environment variables for binding secrets at runtime](#set-environment-variables-for-binding-secrets-at-runtime)\n         * [Create and Configure Petstore DB in Azure Database for PostgreSQL](#create-and-configure-petstore-db-in-azure-database-for-postgresql)\n         * [Configure PostgreSQL Data Source](#configure-postgresql-data-source)\n            * [Step 1: Understand How to configure WildFly](#step-1-understand-how-to-configure-wildfly)\n            * [Step 2: Upload data source artifacts to App Service linux](#step-2-upload-data-source-artifacts-to-app-service-linux)\n            * [Step 3: Set PostgreSQL database connection info in the Web app environment](#step-3-set-postgresql-database-connection-info-in-the-web-app-environment)\n            * [Step 4: Test the JBoss/WildFly CLI commands to configure data source](#step-4-test-the-jbosswildfly-cli-commands-to-configure-data-source)\n            * [Step 5: Restart the remote WildFly app server](#step-5-restart-the-remote-wildfly-app-server)\n         * [Build PetStore to interact with Azure Database for PostgreSQL](#build-petstore-to-interact-with-azure-database-for-postgresql)\n         * [Deploy to App Service Linux](#deploy-to-app-service-linux)\n         * [Open Pet Store running on App Service Linux and interacting with Azure Database for PostgreSQL](#open-pet-store-running-on-app-service-linux-and-interacting-with-azure-database-for-postgresql)\n         * [Log into Azure Database for PostgreSQL and Validate Tables were Created and Populated](#log-into-azure-database-for-postgresql-and-validate-tables-were-created-and-populated)\n         * [Trouble Shoot Petstore on Azure by Viewing Logs](#trouble-shoot-petstore-on-azure-by-viewing-logs)\n      * [Build and Deploy Pet Store Powered Using Azure Database for MySQL](#build-and-deploy-pet-store-powered-using-azure-database-for-mysql)\n         * [Add MySQL Profile](#add-mysql-profile)\n         * [Set environment variables for binding secrets at runtime](#set-environment-variables-for-binding-secrets-at-runtime-1)\n         * [Create and Configure MySQL DB in Azure Database for MySQL](#create-and-configure-mysql-db-in-azure-database-for-mysql)\n         * [Configure MySQL Data Source](#configure-mysql-data-source)\n            * [Step 1: Understand How to configure WildFly](#step-1-understand-how-to-configure-wildfly-1)\n            * [Step 2: Upload data source artifacts to App Service linux](#step-2-upload-data-source-artifacts-to-app-service-linux-1)\n            * [Step 3: Set MySQL database connection info in the Web app environment](#step-3-set-mysql-database-connection-info-in-the-web-app-environment)\n            * [Step 4: Test the JBoss/WildFly CLI commands to configure data source](#step-4-test-the-jbosswildfly-cli-commands-to-configure-data-source-1)\n            * [Step 5: Restart the remote WildFly app server](#step-5-restart-the-remote-wildfly-app-server-1)\n         * [Build PetStore to interact with Azure Database for MySQL](#build-petstore-to-interact-with-azure-database-for-mysql)\n         * [Deploy to App Service Linux](#deploy-to-app-service-linux-1)\n         * [Open Pet Store running on App Service Linux and interacting with Azure Database for MySQL](#open-pet-store-running-on-app-service-linux-and-interacting-with-azure-database-for-mysql)\n         * [Log into Azure Database for MySQL and Validate Tables were Created and Populated](#log-into-azure-database-for-mysql-and-validate-tables-were-created-and-populated)\n         * [Trouble Shoot Petstore on Azure by Viewing Logs](#trouble-shoot-petstore-on-azure-by-viewing-logs-1)\n      * [Build and Deploy Pet Store Powered Using Azure SQL Database](#build-and-deploy-pet-store-powered-using-azure-sql-database)\n         * [Add SQL Database Profile](#add-sql-database-profile)\n         * [Set environment variables for binding secrets at runtime](#set-environment-variables-for-binding-secrets-at-runtime-2)\n         * [Create and Configure SQL DB in Azure SQL Database](#create-and-configure-sql-db-in-azure-sql-database)\n         * [Configure SQL Database Data Source](#configure-sql-database-data-source)\n            * [Step 1: Understand How to configure WildFly](#step-1-understand-how-to-configure-wildfly-2)\n            * [Step 2: Upload data source artifacts to App Service linux](#step-2-upload-data-source-artifacts-to-app-service-linux-2)\n            * [Step 3: Set SQL Database connection info in the Web app environment](#step-3-set-sql-database-connection-info-in-the-web-app-environment)\n            * [Step 4: Test the JBoss/WildFly CLI commands to configure data source](#step-4-test-the-jbosswildfly-cli-commands-to-configure-data-source-2)\n            * [Step 5: Restart the remote WildFly app server](#step-5-restart-the-remote-wildfly-app-server-2)\n         * [Build PetStore to interact with Azure SQL Database](#build-petstore-to-interact-with-azure-sql-database)\n         * [Deploy to App Service Linux](#deploy-to-app-service-linux-2)\n         * [Open Pet Store running on App Service Linux and interacting with Azure SQL Database](#open-pet-store-running-on-app-service-linux-and-interacting-with-azure-sql-database)\n         * [Log into Azure SQL Database and Validate Tables were Created and Populated](#log-into-azure-sql-database-and-validate-tables-were-created-and-populated)\n         * [Trouble Shoot Petstore on Azure by Viewing Logs](#trouble-shoot-petstore-on-azure-by-viewing-logs-2)\n      * [Scale out the Pet Store app](#scale-out-the-pet-store-app)\n      * [Congratulations!](#congratulations)\n      * [Resources](#resources)\n\n## What you will migrate to cloud\n\nYou will migrate the famous Sun's 2003 Java EE Blue Print \nsample app. The most recent incarnation of the sample uses:\n\n- Java SE 8\n- Java EE 7\n- JSR 338 Java Persistence API (JPA 2.2)\n- JSR 346 Context and Dependency Injection (CDI 1.1)\n- JSR 345 Enterprise Java Beans 3.2 (EJB 3.2)\n- JSR 344 Java Server Faces (JSF 2.2) \n- JSR 339 Java API for RESTful Web Services (JAX-RS 2.0)\n- Twitter Bootstrap (Bootstrap 3.x, JQuery 2.x, PrimeFaces 6.x) \n\nUpon migration, you will power the app using \nAzure Database for PostgreSQL, MySQL and or SQL Database.\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](https://www.azul.com/downloads/azure-only/zulu/) \n| [Maven 3](http://maven.apache.org/) \n| [Git](https://github.com/) \n| [PostgreSQL CLI](https://www.postgresql.org/docs/current/app-psql.html)\n| [MySQL CLI](https://dev.mysql.com/downloads/shell/)\n|\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[migrate-Java-EE-app-to-azure/complete](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/complete).\n\nYou can start from [migrate-Java-EE-app-to-azure/initial-h2](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/initial-h2).\nOr, you can clone from [agoncal-application-petstore-ee7](https://github.com/agoncal/agoncal-application-petstore-ee7) \n\n### Step ONE - Clone and Prep\n\n```bash\ngit clone --recurse-submodules https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure.git\ncd migrate-Java-EE-app-to-azure\nyes | cp -rf .prep/* .\n```\n\n## Build and Deploy Pet Store Powered Using H2\n\nOpen the [initial-h2/agoncal-application-petstore-ee7](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/initial-h2/agoncal-application-petstore-ee7)\nsample app in your favorite IDE - IntelliJ | Eclipse | VS Code.\n\n#### Build Pet Store\n   ```bash\ncd initial-h2/agoncal-application-petstore-ee7\n\nbash-3.2$ mvn package -Dmaven.test.skip=true\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ petstoreee7 ---\n...\n...\n[INFO] --- maven-war-plugin:3.1.0:war (default-war) @ petstoreee7 ---\n[INFO] Packaging webapp\n[INFO] Assembling webapp [petstoreee7] in [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-h2/agoncal-application-petstore-ee7/target/applicationPetstore]\n[INFO] Processing war project\n[INFO] Copying webapp resources [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-h2/agoncal-application-petstore-ee7/src/main/webapp]\n[INFO] Webapp assembled in [440 msecs]\n[INFO] Building war: /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-h2/agoncal-application-petstore-ee7/target/applicationPetstore.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 5.340 s\n[INFO] Finished at: 2018-12-21T14:46:35-08:00\n[INFO] Final Memory: 33M/326M\n[INFO] ------------------------------------------------------------------------\n\n   ```\n    \n#### Deploy to WildFly in App Service Linux\n\nLogin to Azure by using the 'az login' command and follow the instructions that give a device code to be entered in browser\n\n```bash\naz login\n```\nSet environment variables for binding secrets at runtime, \nparticularly Azure resource group and Web app names. You can \nexport them to your local environment, say using the supplied\nBash shell script template.\n\n```bash\nmkdir .scripts\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 WildFly directory in\n the local machine. Then, set environment variables:\n \n```bash\nsource .scripts/set-env-variables.sh\n```\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 Store to WildFly in App Service Linux:\n\n```xml    \n\u003cplugins\u003e \n\n    \u003c!--*************************************************--\u003e\n    \u003c!-- Deploy to WildFly 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.6.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\u003ewildfly 14-jre8\u003c/linuxRuntime\u003e\n    \n        \u003c/configuration\u003e\n    \u003c/plugin\u003e\n    ...\n\u003c/plugins\u003e\n```\n \nDeploy to App Service Linux:\n\n```bash\nmvn azure-webapp:deploy\n\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- azure-webapp-maven-plugin:1.6.0:deploy (default-cli) @ petstoreee7 ---\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 'petstore-java-ee-appservice-plan'...\n[INFO] Successfully created App Service Plan.\n[INFO] Successfully created Web App.\n[INFO] Trying to deploy artifact to petstore-java-ee...\n[INFO] Deploying the war file...\n[INFO] Successfully deployed the artifact to https://petstore-java-ee.azurewebsites.net\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 02:19 min\n[INFO] Finished at: 2018-12-21T14:51:08-08:00\n[INFO] Final Memory: 61M/628M\n[INFO] ------------------------------------------------------------------------\n```\n    \n#### Open Pet Store running on App Service in App Service Linux\n\n```bash\nopen https://petstore-java-ee.azurewebsites.net\n```\n![](./media/YAPS-PetStore-on-h2-small.jpg)\n\nWhen you are finished, you can check your results \nagainst YOUR code in \n[migrate-Java-EE-app-to-azure/initial-postgresql](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/initial-postgresql).\n\n## Build and Deploy Pet Store Powered Using Azure Database for PostgreSQL\n\nStart your next leg of your journey ... change directory:\n\n```bash\ncd ../../initial-postgresql/agoncal-application-petstore-ee7\n```\n\n#### Add PostgreSQL Profile\n\nAdd a new profile for PostgreSQL in `pom.xml`:\n\n```xml\n\u003cprofile\u003e\n  \u003cid\u003epostgresql\u003c/id\u003e\n  \u003cactivation\u003e\n    \u003cproperty\u003e\n      \u003cname\u003edb\u003c/name\u003e\n      \u003cvalue\u003epostgresql\u003c/value\u003e\n    \u003c/property\u003e\n  \u003c/activation\u003e\n  \u003cbuild\u003e\n\n    \u003cplugins\u003e\n\n      \u003c!-- copy the correct persistence.xml file --\u003e\n      \u003cplugin\u003e\n        \u003cgroupId\u003ecom.coderplus.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003ecopy-rename-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.0\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cid\u003ecopy-file\u003c/id\u003e\n            \u003cphase\u003evalidate\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003ecopy\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n              \u003csourceFile\u003e${project.basedir}/src/main/resources/META-INF/persistence-postgresql.xml\u003c/sourceFile\u003e\n              \u003cdestinationFile\u003e${project.basedir}/src/main/resources/META-INF/persistence.xml\u003c/destinationFile\u003e\n            \u003c/configuration\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n\n    \u003c/plugins\u003e\n  \u003c/build\u003e\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, FTP details in\n the local machine and PostgreSQL server info. Make sure to pick a password that adheres to the following rules :\n Your password must be at least 8 characters in length.\nYour password must contain characters from three of the following categories – English uppercase letters, English lowercase letters, numbers (0-9), and non-alphanumeric characters (!, $, #, %, etc.)\nYour password can not contain all or part of the username ( 3 or more consecutive alphanumeric characters) \n\n Get the FTP details by using the webapp and resource group created in the previous H2-based lab, with the following command, which displays profile values\n\n```bash\naz webapp deployment list-publishing-profiles -g \u003cresource-group\u003e -n \u003cwebapp\u003e\n```\n{\n   ...\n   ...\n    \"profileName\": \"petstore-java-ee - FTP\",\n    \"publishMethod\": \"FTP\",\n    \"publishUrl\": \"ftp://waws-prod-bay-063.ftp.azurewebsites.windows.net/site/wwwroot\",\n    \"userName\": \"petstore-java-ee\\\\$petstore-java-ee\",\n    \"userPWD\": \"============MASKED===========================================\",\n    \"webSystem\": \"WebSites\"\n  }\n```\n\nStore FTP host name, say `waws-prod-bay-063.ftp.azurewebsites.windows.net`, user name and user password in .scripts/set-env-variables.sh file.\n \n Note the ip of the local machine\n```bash\ncurl ifconfig.me\n```\n\n Then, set environment variables:\n \n```bash\nsource .scripts/set-env-variables.sh\n```\n\n#### Create and Configure Petstore DB in Azure Database for PostgreSQL\n\nCreate a Petstore DB using Azure CLI and PostgreSQL CLI:\n\n```bash\naz postgres server create --resource-group ${RESOURCEGROUP_NAME} \\\n    --name ${POSTGRES_SERVER_NAME} \\\n    --location ${REGION} \\\n    --admin-user ${POSTGRES_SERVER_ADMIN_LOGIN_NAME} \\\n    --admin-password ${POSTGRES_SERVER_ADMIN_PASSWORD} \\\n    --sku-name GP_Gen4_2 --version 9.6\n\naz postgres server firewall-rule create \\\n    --resource-group ${RESOURCEGROUP_NAME} \\\n    --server ${POSTGRES_SERVER_NAME} --name allAzureIPs \\\n    --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0\n\ncurl ifconfig.me\n\naz postgres server firewall-rule create \\\n    --resource-group ${RESOURCEGROUP_NAME} \\\n    --server ${POSTGRES_SERVER_NAME} --name myDevBox \\\n    --start-ip-address ${DEVBOX_IP_ADDRESS} --end-ip-address ${DEVBOX_IP_ADDRESS}\n\npsql --host=${POSTGRES_SERVER_FULL_NAME} --port=5432 \\\n    --username=${POSTGRES_SERVER_ADMIN_FULL_NAME} \\\n    --dbname=${POSTGRES_DATABASE_NAME} --set=sslmode=require\n\nPassword for user postgres@petstore-db:\npsql (11.1, server 9.6.10)\nSSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-SHA384, bits: 256, compression: off)\nType \"help\" for help.\n\npostgres=\u003e \\l\n                                                               List of databases\n       Name        |      Owner      | Encoding |          Collate           |           Ctype            |          Access privileges          \n-------------------+-----------------+----------+----------------------------+----------------------------+-------------------------------------\n azure_maintenance | azure_superuser | UTF8     | English_United States.1252 | English_United States.1252 | azure_superuser=CTc/azure_superuser\n azure_sys         | azure_superuser | UTF8     | English_United States.1252 | English_United States.1252 | \n postgres          | azure_superuser | UTF8     | English_United States.1252 | English_United States.1252 | \n template0         | azure_superuser | UTF8     | English_United States.1252 | English_United States.1252 | =c/azure_superuser                 +\n                   |                 |          |                            |                            | azure_superuser=CTc/azure_superuser\n template1         | azure_superuser | UTF8     | English_United States.1252 | English_United States.1252 | =c/azure_superuser                 +\n                   |                 |          |                            |                            | azure_superuser=CTc/azure_superuser\n(5 rows)\n\npostgres=\u003e \\q\n```\n\nWhen you migrate Java workloads to cloud, you will be considering moving data to cloud. \nTo accelerate your transition to cloud, \nAzure offers plenty of options to [migrate your data](https://azure.microsoft.com/en-us/services/database-migration/) \nto cloud.\n\nAlso, for your convenience, there is a [cheat sheet for PostgreSQL CLI](http://www.postgresqltutorial.com/postgresql-cheat-sheet/).\n\n#### Configure PostgreSQL Data Source\n\nThere are 5 steps to configure a data source. These steps are similar to configuring data sources \nin any on premise Java EE app servers:\n\n##### Step 1: Understand How to configure WildFly\n\nIn App Service, each instance of an app server is stateless. Therefore, each instance must be \nconfigured on startup to support a Wildfly configuration needed by your application. You can configure at \nstartup by supplying a startup Bash script that calls [JBoss/WildFly CLI commands](https://docs.jboss.org/author/display/WFLY/Command+Line+Interface) to setup data sources, messaging \n providers and any other dependencies. We will create a startup.sh script and place it in the `/home` \n directory of the Web app. The script will:\n \nInstall a WildFly module:\n\n```bash\n# where resources point to JDBC driver for PostgreSQL\n# and module xml points to module description, see below\n\nmodule add --name=org.postgres --resources=/home/site/deployments/tools/postgresql-42.2.5.jar --module-xml=/home/site/deployments/tools/postgresql-module.xml\n```\nWhere `postgresql-module.xml` describes the module:\n\n```xml\n\u003c?xml version=\"1.0\" ?\u003e\n\u003cmodule xmlns=\"urn:jboss:module:1.1\" name=\"org.postgres\"\u003e\n    \u003cresources\u003e\n     \u003c!-- ***** IMPORTANT : PATH should point to PostgreSQL Java driver on App Service Linux *******--\u003e\n       \u003cresource-root path=\"/home/site/deployments/tools/postgresql-42.2.5.jar\" /\u003e\n    \u003c/resources\u003e\n    \u003cdependencies\u003e\n        \u003cmodule name=\"javax.api\"/\u003e\n        \u003cmodule name=\"javax.transaction.api\"/\u003e\n    \u003c/dependencies\u003e\n\u003c/module\u003e\n```\n \nAdd a JDBC driver for PostgreSQL:\n\n```bash\n/subsystem=datasources/jdbc-driver=postgres:add(driver-name=\"postgres\",driver-module-name=\"org.postgres\",driver-class-name=org.postgresql.Driver,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)\n```\n\nInstall a data source by using the data-source shortcut command:\n\n```bash\ndata-source add --name=postgresDS --driver-name=postgres --jndi-name=java:jboss/datasources/postgresDS --connection-url=${POSTGRES_CONNECTION_URL,env.POSTGRES_CONNECTION_URL:jdbc:postgresql://db:5432/postgres} --user-name=${POSTGRES_SERVER_ADMIN_FULL_NAME,env.POSTGRES_SERVER_ADMIN_FULL_NAME:postgres} --password=${POSTGRES_SERVER_ADMIN_PASSWORD,env.POSTGRES_SERVER_ADMIN_PASSWORD:example} --use-ccm=true --max-pool-size=5 --blocking-timeout-wait-millis=5000 --enabled=true --driver-class=org.postgresql.Driver --exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter --jta=true --use-java-context=true --valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker\n```\n\nA server reload may be required for the changes to take effect:\n\n```bash\nreload --use-current-server-config=true\n```\n\nThese JBoss CLI commands, JDBC driver for PostgreSQL and module XML are available in \n[initial-postgresql/agoncal-application-petstore-ee7/.scripts](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/initial-postgresql/agoncal-application-petstore-ee7/.scripts) \n\nAlso, you can directly download the latest version of [JDBC driver for PostgreSQL](https://jdbc.postgresql.org/download.html)\n\n##### Step 2: Upload data source artifacts to App Service linux\n\nOpen an FTP connection to App Service Linux to upload data source artifacts:\n\n```bash\npwd\n/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-postgresql/agoncal-application-petstore-ee7\n\ncd .scripts\n\nftp\nftp\u003e open waws-prod-bay-063.drip.azurewebsites.windows.net\nTrying 23.99.84.148...\nConnected to waws-prod-bay-063.drip.azurewebsites.windows.net.\n220 Microsoft FTP Service\nName (waws-prod-bay-063.drip.azurewebsites.windows.net:selvasingh): \n331 Password required\nPassword: \n230 User logged in.\nRemote system type is Windows_NT.\nftp\u003e ascii\n200 Type set to A.\n\nftp\u003e passive\n\n# Upload startup.sh to /home directory\nftp\u003e put startup.sh\nlocal: startup.sh remote: startup.sh\n229 Entering Extended Passive Mode (|||10204|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|   236       39.33 KiB/s    --:-- ETA\n226 Transfer complete.\n236 bytes sent in 00:00 (5.01 KiB/s)\n\n# Upload CLI Commands, Module XML and JDBC Driver for PostgreSQL to /home/site/deployments/tools\nftp\u003e cd site/deployments/tools\n250 CWD command successful.\nftp\u003e put postgresql-datasource-commands.cli \nlocal: postgresql-datasource-commands.cli remote: postgresql-datasource-commands.cli\n229 Entering Extended Passive Mode (|||10205|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|  1444      234.94 KiB/s    --:-- ETA\n226 Transfer complete.\n1444 bytes sent in 00:00 (32.31 KiB/s)\nftp\u003e put postgresql-module.xml \nlocal: postgresql-module.xml remote: postgresql-module.xml\n229 Entering Extended Passive Mode (|||10206|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|   404      192.17 KiB/s    --:-- ETA\n226 Transfer complete.\n404 bytes sent in 00:00 (5.86 KiB/s)\nftp\u003e binary\n200 Type set to I.\nftp\u003e put postgresql-42.2.5.jar \nlocal: postgresql-42.2.5.jar remote: postgresql-42.2.5.jar\n229 Entering Extended Passive Mode (|||10207|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|   806 KiB  506.52 KiB/s    00:00 ETA\n226 Transfer complete.\n825943 bytes sent in 00:01 (469.59 KiB/s)\nftp\u003e bye\n221 Goodbye.\n```\n\n##### Step 3: Set PostgreSQL database connection info in the Web app environment\n\nUse Azure CLI to set database connection info:\n   \n```bash\naz webapp config appsettings set \\\n --resource-group ${RESOURCEGROUP_NAME} --name ${WEBAPP_NAME} \\\n --settings \\\n POSTGRES_CONNECTION_URL=${POSTGRES_CONNECTION_URL} \\\n POSTGRES_SERVER_ADMIN_PASSWORD=${POSTGRES_SERVER_ADMIN_PASSWORD} \\\n POSTGRES_SERVER_ADMIN_FULL_NAME=${POSTGRES_SERVER_ADMIN_FULL_NAME}\n\n[\n {\n   \"name\": \"WEBSITE_HTTPLOGGING_RETENTION_DAYS\",\n   \"slotSetting\": false,\n   \"value\": \"3\"\n },\n {\n   \"name\": \"POSTGRES_CONNECTION_URL\",\n   \"slotSetting\": false,\n   \"value\": \"jdbc:postgresql://petstore-db.postgres.database.azure.com:5432/postgres?ssl=true\"\n },\n {\n   \"name\": \"POSTGRES_SERVER_ADMIN_PASSWORD\",\n   \"slotSetting\": false,\n   \"value\": \"======= MASKED =======\"\n },\n {\n   \"name\": \"POSTGRES_SERVER_ADMIN_FULL_NAME\",\n   \"slotSetting\": false,\n   \"value\": \"postgres@petstore-db\"\n }\n] \n \n```\n\n##### Step 4: Test the JBoss/WildFly CLI commands to configure data source\n\nYou can test Bash script for configuring data source by running them on App Service Linux \nby [opening an SSH connection from your development machine](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#open-ssh-session-from-remote-shell):\n\n```bash\n# ======== first terminal window =========\naz webapp remote-connection create --resource-group ${RESOURCEGROUP_NAME} --name ${WEBAPP_NAME} \u0026\n[18] 7422\nbash-3.2$ Auto-selecting port: 60029\nSSH is available { username: root, password: Docker! }\nStart your favorite client and connect to port 60029\nWebsocket tracing disabled, use --verbose flag to enable\nSuccessfully connected to local server..\n\n# ======== second terminal window ========\nssh root@localhost -p 60029\nThe authenticity of host '[localhost]:60029 ([127.0.0.1]:60029)' can't be established.\nECDSA key fingerprint is SHA256:Lys3Kd4sNJc7X8LVMRP89GKbOzlOGp03tGYj+mY4Kic.\nAre you sure you want to continue connecting (yes/no)? yes\nWarning: Permanently added '[localhost]:60029' (ECDSA) to the list of known hosts.\nroot@localhost's password:\n  _____\n  /  _  \\ __________ _________   ____\n /  /_\\  \\___   /  |  \\_  __ \\_/ __ \\\n/    |    \\/    /|  |  /|  | \\/\\  ___/\n\\____|__  /_____ \\____/ |__|    \\___  \u003e\n        \\/      \\/                  \\/\nA P P   S E R V I C E   O N   L I N U X\n\nDocumentation: http://aka.ms/webapp-linux\nc315a18b39d2:/home#\n\n#========= open a vi window to edit startup.sh ============\nc315a18b39d2:/home# vi startup.sh\n\n# ======== vi window =====================\n#!/usr/bin/env bash^M\n/opt/jboss/wildfly/bin/jboss-cli.sh -c --file=/home/site/deployments/tools/postgresql-datasource-commands.cli^M\n~\n\nremove those '^M' end of line characters and save the file\n\n# ======== run JBoss/WildFly CLI commands to configure a data source ===========\n\nc315a18b39d2:/home# /opt/jboss/wildfly/bin/jboss-cli.sh --connect\nPicked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true\n\n[standalone@localhost:9990 /] module add --name=org.postgres --resources=/home/site/deployments/tools/postgresql-42.2.5.jar --module-xml=/home/site/deployments/tools/postgresql-module.xml\n[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=postgres:add(driver-name=\"postgres\",driver-module-name=\"org.postgres\",driver-class-name=org.postgresql.Driver,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)\n{\"outcome\" =\u003e \"success\"}\n\n[standalone@localhost:9990 /] data-source add --name=postgresDS --driver-name=postgres --jndi-name=java:jboss/datasources/postgresDS --connection-url=${POSTGRES_CONNECTION_URL,env.POSTGRES_CONNECTION_URL:jdbc:postgresql://db:5432/postgres} --user-name=${POSTGRES_SERVER_ADMIN_FULL_NAME,env.POSTGRES_SERVER_ADMIN_FULL_NAME:postgres} --password=${POSTGRES_SERVER_ADMIN_PASSWORD,env.POSTGRES_SERVER_ADMIN_PASSWORD:example} --use-ccm=true --max-pool-size=5 --blocking-timeout-wait-millis=5000 --enabled=true --driver-class=org.postgresql.Driver --exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter --jta=true --use-java-context=true --valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker\n[standalone@localhost:9990 /] /subsystem=datasources/data-source=postgresDS:test-connection-in-pool()\n{\n    \"outcome\" =\u003e \"success\",\n    \"result\" =\u003e [true]\n}\n``` \n\n##### Step 5: Restart the remote WildFly app server\n\nUse Azure CLI to restart the remote WildFly app server:\n   \n```bash\naz webapp stop -g ${RESOURCEGROUP_NAME} -n ${WEBAPP_NAME}\naz webapp start -g ${RESOURCEGROUP_NAME} -n ${WEBAPP_NAME}\n```\n\nFor additional info, please refer to: \n\n- [JBoss Data Source Management](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/datasource_management).\n- [JBoss/WildFly CLI Guide](https://docs.jboss.org/author/display/WFLY/Command+Line+Interface)\n- [Open SSH session from your development machine to App Service Linux](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#open-ssh-session-from-remote-shell)\n\n\n#### Build PetStore to interact with Azure Database for PostgreSQL\n\n```bash\n# Use the Maven profile for PostgreSQL to build\n\nmvn package -Dmaven.test.skip=true -Ddb=postgresql\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- copy-rename-maven-plugin:1.0:copy (copy-file) @ petstoreee7 ---\n[INFO] Copied /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-postgresql/agoncal-application-petstore-ee7/src/main/resources/META-INF/persistence-postgresql.xml to /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-postgresql/agoncal-application-petstore-ee7/src/main/resources/META-INF/persistence.xml\n...\n...\n[INFO] --- maven-war-plugin:3.1.0:war (default-war) @ petstoreee7 ---\n[INFO] Packaging webapp\n[INFO] Assembling webapp [petstoreee7] in [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-postgresql/agoncal-application-petstore-ee7/target/applicationPetstore]\n[INFO] Processing war project\n[INFO] Copying webapp resources [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-postgresql/agoncal-application-petstore-ee7/src/main/webapp]\n[INFO] Webapp assembled in [243 msecs]\n[INFO] Building war: /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-postgresql/agoncal-application-petstore-ee7/target/applicationPetstore.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 4.161 s\n[INFO] Finished at: 2018-12-21T16:27:42-08:00\n[INFO] Final Memory: 31M/513M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Deploy to App Service Linux \n\nDeploy to WildFly in App Service Linux:\n\n```bash\nmvn azure-webapp:deploy\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- azure-webapp-maven-plugin:1.6.0:deploy (default-cli) @ petstoreee7 ---\n[INFO] Authenticate with Azure CLI 2.0\n[INFO] Updating target Web App...\n[INFO] Successfully updated Web App.\n[INFO] Trying to deploy artifact to petstore-java-ee...\n[INFO] Deploying the war file...\n[INFO] Successfully deployed the artifact to https://petstore-java-ee.azurewebsites.net\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 04:07 min\n[INFO] Finished at: 2018-12-21T16:45:12-08:00\n[INFO] Final Memory: 60M/631M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Open Pet Store running on App Service Linux and interacting with Azure Database for PostgreSQL\n\n```bash\nopen https://petstore-java-ee.azurewebsites.net\n```\n\n![](./media/YAPS-PetStore-on-h2-small.jpg)\n\n#### Log into Azure Database for PostgreSQL and Validate Tables were Created and Populated\n\n```bash\npsql --host=${POSTGRES_SERVER_FULL_NAME} --port=5432 \\\n     --username=${POSTGRES_SERVER_ADMIN_FULL_NAME} \\\n     --dbname=${POSTGRES_DATABASE_NAME} --set=sslmode=require\nPassword for user postgres@petstore-db: \npsql (11.1, server 9.6.10)\nSSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-SHA384, bits: 256, compression: off)\nType \"help\" for help.\n\npostgres=\u003e \\l\npostgres=\u003e \\dt\n               List of relations\n Schema |        Name        | Type  |  Owner   \n--------+--------------------+-------+----------\n public | category           | table | postgres\n public | country            | table | postgres\n public | customer           | table | postgres\n public | item               | table | postgres\n public | order_line         | table | postgres\n public | product            | table | postgres\n public | purchase_order     | table | postgres\n public | t_order_order_line | table | postgres\n(8 rows)\n\npostgres=\u003e select name from category;\n   name   \n----------\n Fish\n Dogs\n Reptiles\n Cats\n Birds\n(5 rows)\n\npostgres=\u003e \\q\nbash-3.2$ \n\n```\n\n#### Trouble Shoot Petstore 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-12-22T00:47:48  Welcome, you are now connected to log-streaming service.\n2018-12-22T00:41:45.064280703Z   _____                               \n2018-12-22T00:41:45.064325203Z   /  _  \\ __________ _________   ____  \n2018-12-22T00:41:45.064331403Z  /  /_\\  \\___   /  |  \\_  __ \\_/ __ \\ \n2018-12-22T00:41:45.064335603Z /    |    \\/    /|  |  /|  | \\/\\  ___/ \n2018-12-22T00:41:45.064339403Z \\____|__  /_____ \\____/ |__|    \\___  \u003e\n2018-12-22T00:41:45.064343503Z         \\/      \\/                  \\/ \n2018-12-22T00:41:45.064347403Z A P P   S E R V I C E   O N   L I N U X  \n...\n...\n2018-12-22T00:41:47.124232726Z ***Copying /home/site/wwwroot/webapps/ROOT to /opt/jboss/wildfly/standalone/deployments/ROOT.war\n2018-12-22T00:41:48.193646648Z ***Creating marker file /opt/jboss/wildfly/standalone/deployments/ROOT.war.dodeploy\n...\n...\n2018-12-22T00:41:52.895075005Z 00:41:52,770 INFO  [org.jboss.modules] (main) JBoss Modules version 1.8.6.Final\n2018-12-22T00:41:55.713960188Z 00:41:55,704 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.3.Final\n2018-12-22T00:41:55.817008239Z 00:41:55,816 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.2.Final\n2018-12-22T00:41:57.201980849Z 00:41:57,201 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) starting\n...\n...\n2018-12-22T00:42:19.043814396Z 00:42:19,043 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 41) WFLYJCA0005: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 42.2)\n2018-12-22T00:42:19.050046930Z 00:42:19,042 INFO  [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=5.0.3.Final\n2018-12-22T00:42:19.086580525Z 00:42:19,086 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0003: Undertow 2.0.13.Final starting\n2018-12-22T00:42:19.155234792Z 00:42:19,155 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2\n2018-12-22T00:42:19.173958592Z 00:42:19,173 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = postgres\n...\n...\n2018-12-22T00:42:40.634081365Z 00:42:40,633 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) started in 22695ms - Started 801 of 972 services (328 services are lazy, passive or on-demand)\n\n```\n\nWhen you are finished, you can check your results \nagainst YOUR code in \n[migrate-Java-EE-app-to-azure/initial-mysql](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/initial-mysql).\n\n## Build and Deploy Pet Store Powered Using Azure Database for MySQL\n\nStart your next leg of your journey ... change directory:\n\n```bash\ncd ../../initial-mysql/agoncal-application-petstore-ee7\n```\n\n#### Add MySQL Profile\n\nAdd a new profile for MySQL in `pom.xml`:\n\n```xml\n\u003cprofile\u003e\n  \u003cid\u003emysql\u003c/id\u003e\n  \u003cactivation\u003e\n    \u003cproperty\u003e\n      \u003cname\u003edb\u003c/name\u003e\n      \u003cvalue\u003emysql\u003c/value\u003e\n    \u003c/property\u003e\n  \u003c/activation\u003e\n  \u003cbuild\u003e\n\n    \u003cplugins\u003e\n\n      \u003c!-- copy the MySQL persistence.xml file --\u003e\n      \u003cplugin\u003e\n        \u003cgroupId\u003ecom.coderplus.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003ecopy-rename-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.0\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cid\u003ecopy-file\u003c/id\u003e\n            \u003cphase\u003evalidate\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003ecopy\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n              \u003csourceFile\u003e${project.basedir}/src/main/resources/META-INF/persistence-mysql.xml\u003c/sourceFile\u003e\n              \u003cdestinationFile\u003e${project.basedir}/src/main/resources/META-INF/persistence.xml\u003c/destinationFile\u003e\n            \u003c/configuration\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n\n    \u003c/plugins\u003e\n  \u003c/build\u003e\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, WildFly directory in\n the local machine, FTP deployment credentials and MySQL server info. \n Then, set environment variables:\n \n```bash\nsource .scripts/set-env-variables.sh\n```\n\n#### Create and Configure MySQL DB in Azure Database for MySQL\n\nCreate a Petstore DB using Azure CLI and MySQL CLI:\n\n```bash\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_Gen5_32 \\\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 myDevBox \\\n --server ${MYSQL_SERVER_NAME} \\\n --resource-group ${RESOURCEGROUP_NAME} \\\n --start-ip-address ${DEVBOX_IP_ADDRESS} --end-ip-address ${DEVBOX_IP_ADDRESS}\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// log into mysql\nmysql -u ${MYSQL_SERVER_ADMIN_FULL_NAME}  -h ${MYSQL_SERVER_FULL_NAME} -P 3306 -p\nEnter password:\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 64096\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 petstore;\nQuery OK, 1 row affected (0.05 sec)\n\nmysql\u003e CREATE USER 'root' IDENTIFIED BY 'petstore';\nQuery OK, 0 rows affected (0.04 sec)\n\nmysql\u003e GRANT ALL PRIVILEGES ON petstore.* TO 'root';\nQuery OK, 0 rows affected (0.05 sec)\n\nmysql\u003e quit\nBye\n```\n\nWhen you migrate Java workloads to cloud, you will be considering moving data to cloud. \nTo accelerate your transition to cloud, \nAzure offers plenty of options to [migrate your data](https://azure.microsoft.com/en-us/services/database-migration/) \nto cloud.\n\nAlso, for your convenience, there is a [cheat sheet for MySQL CLI](http://www.mysqltutorial.org/mysql-cheat-sheet.aspx).\n\n#### Configure MySQL Data Source\n\nThere are 5 steps to configure a data source. These steps are similar to configuring data sources \nin any on premise Java EE app servers:\n\n##### Step 1: Understand How to configure WildFly\n\nIn App Service, each instance of an app server is stateless. Therefore, each instance must be \nconfigured on startup to support a Wildfly configuration needed by your application. You can configure at \nstartup by supplying a startup Bash script that calls [JBoss/WildFly CLI commands](https://docs.jboss.org/author/display/WFLY/Command+Line+Interface) to setup data sources, messaging \n providers and any other dependencies. We will create a startup.sh script and place it in the `/home` \n directory of the Web app. The script will:\n \nInstall a WildFly module:\n\n```bash\n# where resources point to JDBC driver for MySQL\n# and module xml points to module description, see below\n\nmodule add --name=com.mysql --resources=/home/site/deployments/tools/mysql-connector-java-8.0.13.jar --module-xml=/home/site/deployments/tools/mysql-module.xml\n```\nWhere `mysql-module.xml` describes the module:\n\n```xml\n\u003c?xml version=\"1.0\" ?\u003e\n\u003cmodule xmlns=\"urn:jboss:module:1.1\" name=\"com.mysql\"\u003e\n    \u003cresources\u003e\n     \u003c!-- ***** IMPORTANT : REPLACE THIS PLACEHOLDER *******--\u003e\n       \u003cresource-root path=\"/home/site/deployments/tools/mysql-connector-java-8.0.13.jar\" /\u003e\n    \u003c/resources\u003e\n    \u003cdependencies\u003e\n        \u003cmodule name=\"javax.api\"/\u003e\n        \u003cmodule name=\"javax.transaction.api\"/\u003e\n    \u003c/dependencies\u003e\n\u003c/module\u003e\n```\n \nAdd a JDBC driver for MySQL:\n\n```bash\n/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-class-name=com.mysql.cj.jdbc.Driver)\n```\n\nInstall a data source by using the data-source shortcut command:\n\n```bash\ndata-source add --name=mysqlDS --jndi-name=java:jboss/datasources/mysqlDS --connection-url=${MYSQL_CONNECTION_URL,env.MYSQL_CONNECTION_URL:jdbc:mysql://db:3306/petstore} --driver-name=mysql --user-name=${MYSQL_SERVER_ADMIN_FULL_NAME,env.MYSQL_SERVER_ADMIN_FULL_NAME:mysql} --password=${MYSQL_SERVER_ADMIN_PASSWORD,env.MYSQL_SERVER_ADMIN_PASSWORD:example} --use-ccm=true --max-pool-size=5 --blocking-timeout-wait-millis=5000 --enabled=true --driver-class=com.mysql.cj.jdbc.Driver --jta=true --use-java-context=true --exception-sorter-class-name=com.mysql.cj.jdbc.integration.jboss.ExtendedMysqlExceptionSorter\n```\n\nA server reload may be required for the changes to take effect:\n\n```bash\nreload --use-current-server-config=true\n```\n\nThese JBoss CLI commands, JDBC driver for MySQL and module XML are available in \n[initial-mysql/agoncal-application-petstore-ee7/.scripts](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/initial-mysql/agoncal-application-petstore-ee7/.scripts) \n\nAlso, you can directly download [JDBC driver for MySQL](https://dev.mysql.com/downloads/connector/j/). For example:\n\n```bash\nwget -q \"http://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar\" -O mysql-connector-java-8.0.13.jar\n```\n\n##### Step 2: Upload data source artifacts to App Service linux\n\nOpen an FTP connection to App Service Linux to upload data source artifacts:\n\n```bash\npwd\n/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-mysql/agoncal-application-petstore-ee7\n\ncd .scripts\n\nftp\nftp\u003e open waws-prod-bay-063.drip.azurewebsites.windows.net\nTrying 23.99.84.148...\nConnected to waws-prod-bay-063.drip.azurewebsites.windows.net.\n220 Microsoft FTP Service\nName (waws-prod-bay-063.drip.azurewebsites.windows.net:selvasingh): petstore-java-ee\\\\$petstore-java-ee\n331 Password required\nPassword:\n230 User logged in.\nRemote system type is Windows_NT.\nftp\u003e ascii\n200 Type set to A.\nftp\u003e put startup.sh\nlocal: startup.sh remote: startup.sh\n229 Entering Extended Passive Mode (|||10208|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|   236       40.58 KiB/s    --:-- ETA\n226 Transfer complete.\n236 bytes sent in 00:00 (5.18 KiB/s)\nftp\u003e cd site/deployments/tools\n250 CWD command successful.\nftp\u003e put mysql-datasource-commands.cli\nlocal: mysql-datasource-commands.cli remote: mysql-datasource-commands.cli\n229 Entering Extended Passive Mode (|||10209|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|  1375      226.39 KiB/s    --:-- ETA\n226 Transfer complete.\n1375 bytes sent in 00:00 (30.81 KiB/s)\nftp\u003e put mysql-module.xml\nlocal: mysql-module.xml remote: mysql-module.xml\n229 Entering Extended Passive Mode (|||10210|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|   411        1.29 MiB/s    --:-- ETA\n226 Transfer complete.\n411 bytes sent in 00:00 (9.34 KiB/s)\nftp\u003e binary\n200 Type set to I.\nftp\u003e put mysql-connector-java-8.0.13.jar\nlocal: mysql-connector-java-8.0.13.jar remote: mysql-connector-java-8.0.13.jar\n229 Entering Extended Passive Mode (|||10211|)\n125 Data connection already open; Transfer starting.\n100% |************************************************|  2082 KiB  622.64 KiB/s    00:00 ETA\n226 Transfer complete.\n2132635 bytes sent in 00:03 (597.54 KiB/s)\nftp\u003e bye\n221 Goodbye.\n```\n\n##### Step 3: Set MySQL database connection info in the Web app environment\n\nUse Azure CLI to set database connection info:\n   \n```bash\naz webapp config appsettings set \\\n  --resource-group ${RESOURCEGROUP_NAME} --name ${WEBAPP_NAME} \\\n  --settings \\\n  MYSQL_CONNECTION_URL=${MYSQL_CONNECTION_URL} \\\n  MYSQL_SERVER_ADMIN_PASSWORD=${MYSQL_SERVER_ADMIN_PASSWORD} \\\n  MYSQL_SERVER_ADMIN_FULL_NAME=${MYSQL_SERVER_ADMIN_FULL_NAME}\n\n[\n {\n   \"name\": \"WEBSITE_HTTPLOGGING_RETENTION_DAYS\",\n   \"slotSetting\": false,\n   \"value\": \"3\"\n },\n {\n   \"name\": \"MYSQL_CONNECTION_URL\",\n   \"slotSetting\": false,\n   \"value\": \"jdbc:mysql://petstore-db1221.mysql.database.azure.com:3306/petstore?ssl=true\"\n },\n {\n   \"name\": \"MYSQL_SERVER_ADMIN_PASSWORD\",\n   \"slotSetting\": false,\n   \"value\": \"======= MASKED =======\"\n },\n {\n   \"name\": \"MYSQL_SERVER_ADMIN_FULL_NAME\",\n   \"slotSetting\": false,\n   \"value\": \"selvasingh@petstore-db1221\"\n }\n] \n \n```\n\n##### Step 4: Test the JBoss/WildFly CLI commands to configure data source\n\nYou can test Bash script for configuring data source by running them on App Service Linux \nby [opening an SSH connection from your development machine](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#open-ssh-session-from-remote-shell):\n\n```bash\n# ======== first terminal window =========\naz webapp remote-connection create --resource-group ${RESOURCEGROUP_NAME} --name ${WEBAPP_NAME} \u0026\n[18] 7422\nbash-3.2$ Auto-selecting port: 60029\nSSH is available { username: root, password: Docker! }\nStart your favorite client and connect to port 60029\nWebsocket tracing disabled, use --verbose flag to enable\nSuccessfully connected to local server..\n\n# ======== second terminal window ========\nssh root@localhost -p 60029\nThe authenticity of host '[localhost]:60029 ([127.0.0.1]:60029)' can't be established.\nECDSA key fingerprint is SHA256:Lys3Kd4sNJc7X8LVMRP89GKbOzlOGp03tGYj+mY4Kic.\nAre you sure you want to continue connecting (yes/no)? yes\nWarning: Permanently added '[localhost]:60029' (ECDSA) to the list of known hosts.\nroot@localhost's password:\n  _____\n  /  _  \\ __________ _________   ____\n /  /_\\  \\___   /  |  \\_  __ \\_/ __ \\\n/    |    \\/    /|  |  /|  | \\/\\  ___/\n\\____|__  /_____ \\____/ |__|    \\___  \u003e\n        \\/      \\/                  \\/\nA P P   S E R V I C E   O N   L I N U X\n\nDocumentation: http://aka.ms/webapp-linux\nc315a18b39d2:/home#\n\n#========= open a vi window to edit startup.sh ============\nc315a18b39d2:/home# vi startup.sh\n\n# ======= vi window second time ==========\n#!/usr/bin/env bash^M\n/opt/jboss/wildfly/bin/jboss-cli.sh -c --file=/home/site/deployments/tools/postgresql-datasource-commands.cli^M\n/opt/jboss/wildfly/bin/jboss-cli.sh -c --file=/home/site/deployments/tools/mysql-datasource-commands.cli^M\n~\n\n\nremove those '^M' end of line characters and save the file\n\n# ======== run JBoss/WildFly CLI commands to configure a data source ===========\n\nc315a18b39d2:/home# /opt/jboss/wildfly/bin/jboss-cli.sh --connect\nPicked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true\n\n[standalone@localhost:9990 /] module add --name=com.mysql --resources=/home/site/deployments/tools/mysql-connector-java-8.0.13.jar --module-xml=/home/site/deployments/tools/mysql-module.xml\n[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-class-name=com.mysql.cj.jdbc.Driver)\n{\"outcome\" =\u003e \"success\"}\n\n[standalone@localhost:9990 /] data-source add --name=mysqlDS --jndi-name=java:jboss/datasources/mysqlDS --connection-url=${MYSQL_CONNECTION_URL,env.MYSQL_CONNECTION_URL:jdbc:mysql://db:3306/petstore} --driver-name=mysql --user-name=${MYSQL_SERVER_ADMIN_FULL_NAME,env.MYSQL_SERVER_ADMIN_FULL_NAME:mysql} --password=${MYSQL_SERVER_ADMIN_PASSWORD,env.MYSQL_SERVER_ADMIN_PASSWORD:example} --use-ccm=true --max-pool-size=5 --blocking-timeout-wait-millis=5000 --enabled=true --driver-class=com.mysql.cj.jdbc.Driver --jta=true --use-java-context=true --exception-sorter-class-name=com.mysql.cj.jdbc.integration.jboss.ExtendedMysqlExceptionSorter\n[standalone@localhost:9990 /] /subsystem=datasources/data-source=mysqlDS:test-connection-in-pool()\n{\n    \"outcome\" =\u003e \"success\",\n    \"result\" =\u003e [true]\n}\n``` \n\n##### Step 5: Restart the remote WildFly app server\n\nUse Azure CLI to restart the remote WildFly app server:\n   \n```bash\naz webapp stop -g ${RESOURCEGROUP_NAME} -n ${WEBAPP_NAME}\naz webapp start -g ${RESOURCEGROUP_NAME} -n ${WEBAPP_NAME}\n```\n\nFor additional info, please refer to: \n\n- [JBoss Data Source Management](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/datasource_management).\n- [JBoss/WildFly CLI Guide](https://docs.jboss.org/author/display/WFLY/Command+Line+Interface)\n- [Open SSH session from your development machine to App Service Linux](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#open-ssh-session-from-remote-shell)\n\n\n#### Build PetStore to interact with Azure Database for MySQL\n\n```bash\n# Use the Maven profile for MySQL to build\n\nbash-3.2$ mvn package -Dmaven.test.skip=true -Ddb=mysql\n[INFO] Scanning for projects...\n[INFO]\n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO]\n[INFO] --- copy-rename-maven-plugin:1.0:copy (copy-file) @ petstoreee7 ---\n[INFO] Copied /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-mysql/agoncal-application-petstore-ee7/src/main/resources/META-INF/persistence-mysql.xml to /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-mysql/agoncal-application-petstore-ee7/src/main/resources/META-INF/persistence.xml\n...\n...\n[INFO] --- maven-war-plugin:3.1.0:war (default-war) @ petstoreee7 ---\n[INFO] Packaging webapp\n[INFO] Assembling webapp [petstoreee7] in [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-mysql/agoncal-application-petstore-ee7/target/applicationPetstore]\n[INFO] Processing war project\n[INFO] Copying webapp resources [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-mysql/agoncal-application-petstore-ee7/src/main/webapp]\n[INFO] Webapp assembled in [258 msecs]\n[INFO] Building war: /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-mysql/agoncal-application-petstore-ee7/target/applicationPetstore.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 3.199 s\n[INFO] Finished at: 2018-12-22T10:47:23-08:00\n[INFO] Final Memory: 26M/388M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Deploy to App Service Linux \n\nDeploy to WildFly in App Service Linux:\n\n```bash\nmvn azure-webapp:deploy\n[INFO] Scanning for projects...\n[INFO]\n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO]\n[INFO] --- azure-webapp-maven-plugin:1.6.0:deploy (default-cli) @ petstoreee7 ---\n[INFO] Authenticate with Azure CLI 2.0\n[INFO] Updating target Web App...\n[INFO] Successfully updated Web App.\n[INFO] Trying to deploy artifact to petstore-java-ee...\n[INFO] Deploying the war file...\n[INFO] Successfully deployed the artifact to https://petstore-java-ee.azurewebsites.net\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 56.128 s\n[INFO] Finished at: 2018-12-22T10:51:13-08:00\n[INFO] Final Memory: 60M/626M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Open Pet Store running on App Service Linux and interacting with Azure Database for MySQL\n\n```bash\nopen https://petstore-java-ee.azurewebsites.net\n```\n\n![](./media/YAPS-PetStore-on-h2-small.jpg)\n\n#### Log into Azure Database for MySQL and Validate Tables were Created and Populated\n\n```bash\nmysql -u ${MYSQL_SERVER_ADMIN_FULL_NAME}  -h ${MYSQL_SERVER_FULL_NAME} -P 3306 -p\nEnter password:\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 64167\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 use petstore;\nReading table information for completion of table and column names\nYou can turn off this feature to get a quicker startup with -A\n\nDatabase changed\nmysql\u003e show tables;\n+--------------------+\n| Tables_in_petstore |\n+--------------------+\n| category           |\n| country            |\n| customer           |\n| hibernate_sequence |\n| item               |\n| order_line         |\n| product            |\n| purchase_order     |\n| t_order_order_line |\n+--------------------+\n9 rows in set (0.03 sec)\n\nmysql\u003e select name from category;\n+----------+\n| name     |\n+----------+\n| Fish     |\n| Dogs     |\n| Reptiles |\n| Cats     |\n| Birds    |\n+----------+\n5 rows in set (0.03 sec)\n\nmysql\u003e quit\nBye\n```\n\n#### Trouble Shoot Petstore on Azure by Viewing Logs\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-12-22T00:47:48  Welcome, you are now connected to log-streaming service.\n2018-12-22T00:41:45.064280703Z   _____                               \n2018-12-22T00:41:45.064325203Z   /  _  \\ __________ _________   ____  \n2018-12-22T00:41:45.064331403Z  /  /_\\  \\___   /  |  \\_  __ \\_/ __ \\ \n2018-12-22T00:41:45.064335603Z /    |    \\/    /|  |  /|  | \\/\\  ___/ \n2018-12-22T00:41:45.064339403Z \\____|__  /_____ \\____/ |__|    \\___  \u003e\n2018-12-22T00:41:45.064343503Z         \\/      \\/                  \\/ \n2018-12-22T00:41:45.064347403Z A P P   S E R V I C E   O N   L I N U X  \n...\n...\n2018-12-22T00:41:47.124232726Z ***Copying /home/site/wwwroot/webapps/ROOT to /opt/jboss/wildfly/standalone/deployments/ROOT.war\n2018-12-22T00:41:48.193646648Z ***Creating marker file /opt/jboss/wildfly/standalone/deployments/ROOT.war.dodeploy\n...\n...\n2018-12-22T00:41:52.895075005Z 00:41:52,770 INFO  [org.jboss.modules] (main) JBoss Modules version 1.8.6.Final\n2018-12-22T00:41:55.713960188Z 00:41:55,704 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.3.Final\n2018-12-22T00:41:55.817008239Z 00:41:55,816 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.2.Final\n2018-12-22T00:41:57.201980849Z 00:41:57,201 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) starting\n...\n...\n2018-12-22T00:42:19.043814396Z 00:42:19,043 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 41) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.cj.jdbc.Driver (version 8.0)\n2018-12-22T00:42:19.050046930Z 00:42:19,042 INFO  [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=5.0.3.Final\n2018-12-22T00:42:19.086580525Z 00:42:19,086 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0003: Undertow 2.0.13.Final starting\n2018-12-22T00:42:19.155234792Z 00:42:19,155 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2\n2018-12-22T00:42:19.173958592Z 00:42:19,173 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = mysql\n2018-12-22T00:42:19.173958592Z 00:42:19,187 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = postgres\n...\n...\n2018-12-22T00:42:40.634081365Z 00:42:40,633 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) started in 22695ms - Started 801 of 972 services (328 services are lazy, passive or on-demand)\n\n```\n\n## Build and Deploy Pet Store Powered Using Azure SQL Database\n\nStart your next leg of your journey ... change directory:\n\n```bash\ncd ../../initial-sql/agoncal-application-petstore-ee7\n```\n\n#### Add SQL Database Profile\n\nAdd a new profile for sql in `pom.xml`:\n\n```xml\n\u003cprofile\u003e\n  \u003cid\u003esql\u003c/id\u003e\n  \u003cactivation\u003e\n  \u003cproperty\u003e\n    \u003cname\u003edb\u003c/name\u003e\n    \u003cvalue\u003esql\u003c/value\u003e\n  \u003c/property\u003e\n  \u003c/activation\u003e\n  \u003cbuild\u003e\n\n    \u003cplugins\u003e\n\n      \u003c!-- copy the correct persistence.xml file --\u003e\n      \u003cplugin\u003e\n        \u003cgroupId\u003ecom.coderplus.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003ecopy-rename-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.0\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cid\u003ecopy-file\u003c/id\u003e\n            \u003cphase\u003evalidate\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003ecopy\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n              \u003csourceFile\u003e${project.basedir}/src/main/resources/META-INF/persistence-sql.xml\u003c/sourceFile\u003e\n              \u003cdestinationFile\u003e${project.basedir}/src/main/resources/META-INF/persistence.xml\u003c/destinationFile\u003e\n            \u003c/configuration\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n    \u003c/plugins\u003e\n  \u003c/build\u003e\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, WildFly directory in\n the local machine, FTP deployment credentials and SQL Database info. \n Then, set environment variables:\n \n```bash\nsource .scripts/set-env-variables.sh\n```\n\n#### Create and Configure SQL DB in Azure SQL Database\n\nInstall the Azure CLI `db-up` extension:\n```bash\naz extension add --name db-up\n```\n\nCreate a Petstore DB using Azure CLI and sql CLI:\n```bash\naz sql up --resource-group ${RESOURCEGROUP_NAME} \\\n --server-name ${SQL_SERVER_NAME} \\\n --database-name ${SQL_DATABASE_NAME} --admin-user ${SQL_SERVER_ADMIN_LOGIN_NAME} \\\n --admin-password ${SQL_SERVER_ADMIN_PASSWORD} \\\n --location ${REGION}\n\nCreating SQL Server 'petstore-sql-0601' in group 'e2e-java-ee'...\nConfiguring server firewall rule, 'azure-access', to accept connections from all Azure resources...\nCreating SQL database 'sqldb'...\nChecking your ip address...\nConfiguring server firewall rule, 'devbox', to allow for your ip address: 98.225.36.126\nIf SQL server declines your IP address, please create a new firewall rule using:\n    `az sql server firewall-rule create -g e2e-java-ee -s petstore-sql-0601 -n {rule_name} --start-ip-address {ip_address} --end-ip-address {ip_address}`\nSuccessfully Connected to SQL Database.\nRan Database Query: `CREATE USER root WITH PASSWORD = \"======= MASKED =======\"\nRan Database Query: `GRANT ALL TO root`\n...\n...\n\n```\n\nWhen you migrate Java workloads to cloud, you will be considering moving data to cloud. \nTo accelerate your transition to cloud, \nAzure offers plenty of options to [migrate your data](https://azure.microsoft.com/en-us/services/database-migration/) \nto cloud.\n\nAlso, for your convenience, there is a [cheat sheet for sqlcmd CLI](https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility).\n\n#### Configure SQL Database Data Source\n\nThere are 5 steps to configure a data source. These steps are similar to configuring data sources \nin any on premise Java EE app servers:\n\n##### Step 1: Understand How to configure WildFly\n\nIn App Service, each instance of an app server is stateless. Therefore, each instance must be \nconfigured on startup to support a Wildfly configuration needed by your application. You can configure at \nstartup by supplying a startup Bash script that calls [JBoss/WildFly CLI commands](https://docs.jboss.org/author/display/WFLY/Command+Line+Interface) to setup data sources, messaging \n providers and any other dependencies. We will create a startup.sh script and place it in the `/home` \n directory of the Web app. The script will:\n \nInstall a WildFly module:\n\n```bash\n# where resources point to JDBC driver for SQL Database\n# and module xml points to module description, see below\n\nmodule add --name=com.microsoft --resources=/home/site/deployments/tools/mssql-jdbc-7.2.1.jre8.jar --module-xml=/home/site/deployments/tools/mssql-module.xml\n```\nWhere `mssql-module.xml` describes the module:\n\n```xml\n\u003c?xml version=\"1.0\" ?\u003e\n\u003cmodule xmlns=\"urn:jboss:module:1.1\" name=\"com.microsoft\"\u003e\n  \u003cresources\u003e\n\t\u003cresource-root path=\"/home/site/deployments/tools/mssql-jdbc-7.2.1.jre8.jar\"/\u003e\n  \u003c/resources\u003e\n  \u003cdependencies\u003e\n    \u003cmodule name=\"javax.api\"/\u003e\n    \u003cmodule name=\"javax.transaction.api\"/\u003e\n  \u003c/dependencies\u003e\n\u003c/module\u003e\n```\n \nAdd a JDBC driver for SQL Database:\n\n```bash\n/subsystem=datasources/jdbc-driver=sqlserver:add(driver-name=\"sqlserver\",driver-module-name=\"com.microsoft\",driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver,driver-datasource-class-name=com.microsoft.sqlserver.jdbc.SQLServerDataSource)\n```\n\nInstall a data source by using the data-source shortcut command:\n\n```bash\ndata-source add --name=sqlDS --jndi-name=java:jboss/datasources/sqlDS --driver-name=sqlserver --connection-url=${SQL_CONNECTION_URL,env.SQL_CONNECTION_URL:example} --validate-on-match=true --background-validation=false --valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker --exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLExceptionSorter\n```\n\nA server reload may be required for the changes to take effect:\n\n```bash\nreload --use-current-server-config=true\n```\n\nThese JBoss CLI commands, JDBC driver for SQL Database and module XML are available in \n[initial-sql/agoncal-application-petstore-ee7/.scripts](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/initial-sql/agoncal-application-petstore-ee7/.scripts) \n\nAlso, you can directly download [JDBC driver for SQL Database](https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server). For example:\n\n\n##### Step 2: Upload data source artifacts to App Service linux\n\nOpen an FTP connection to App Service Linux to upload data source artifacts:\n\n```bash\npwd\n/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-sql/agoncal-application-petstore-ee7\n\ncd .scripts\n\nftp\nftp\u003e open waws-prod-bay-063.ftp.azurewebsites.windows.net\nTrying 23.99.87.125...\nConnected to waws-prod-bay-063.drip.azurewebsites.windows.net.\n220 Microsoft FTP Service\nName (waws-prod-bay-063.ftp.azurewebsites.windows.net:selvasingh):\n331 Password required\nPassword:\n230 User logged in.\nRemote system type is Windows_NT.\nftp\u003e pwd\nRemote directory: /\nftp\u003e ascii\n200 Type set to A.\nftp\u003e put startup.sh\nlocal: startup.sh remote: startup.sh\n229 Entering Extended Passive Mode (|||10199|)\n125 Data connection already open; Transfer starting.\n100% |*******************************************************|   125       21.36 KiB/s    --:-- ETA\n226 Transfer complete.\n125 bytes sent in 00:00 (2.71 KiB/s)\nftp\u003e cd site/deployments/tools\n250 CWD command successful.\nftp\u003e put mssql-datasource-commands.cli\nlocal: mssql-datasource-commands.cli remote: mssql-datasource-commands.cli\n229 Entering Extended Passive Mode (|||10200|)\n125 Data connection already open; Transfer starting.\n100% |*******************************************************|  1751      301.42 KiB/s    --:-- ETA\n226 Transfer complete.\n1751 bytes sent in 00:00 (35.69 KiB/s)\nftp\u003e put mssql-module.xml\nlocal: mssql-module.xml remote: mssql-module.xml\n229 Entering Extended Passive Mode (|||10201|)\n125 Data connection already open; Transfer starting.\n100% |*******************************************************|   305       51.39 KiB/s    --:-- ETA\n226 Transfer complete.\n305 bytes sent in 00:00 (7.07 KiB/s)\nftp\u003e bin\n200 Type set to I.\nftp\u003e put mssql-jdbc-7.2.1.jre8.jar\nlocal: mssql-jdbc-7.2.1.jre8.jar remote: mssql-jdbc-7.2.1.jre8.jar\n229 Entering Extended Passive Mode (|||10202|)\n125 Data connection already open; Transfer starting.\n100% |*******************************************************|  1135 KiB    1.62 MiB/s    00:00 ETA\n226 Transfer complete.\n1162710 bytes sent in 00:00 (1.48 MiB/s)\nftp\u003e bye\n221 Goodbye.\n```\n\n##### Step 3: Set SQL Database connection info in the Web app environment\n\nUse Azure CLI to set database connection info:\n   \n```bash\n\naz webapp config appsettings set  \\\n    --resource-group ${RESOURCEGROUP_NAME} \\\n    --name ${WEBAPP_NAME}  \\\n    --settings  SQL_CONNECTION_URL=${SQL_CONNECTION_URL}\n\n[\n  {\n    \"name\": \"WEBSITE_HTTPLOGGING_RETENTION_DAYS\",\n    \"slotSetting\": false,\n    \"value\": \"3\"\n  },\n  {\n    \"name\": \"SQL_CONNECTION_URL\",\n    \"slotSetting\": false,\n    \"value\": \"======= MASKED =======\"\n  }\n]\n```\n\n##### Step 4: Test the JBoss/WildFly CLI commands to configure data source\n\nYou can test Bash script for configuring data source by running them on App Service Linux \nby [opening an SSH connection from your development machine](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#open-ssh-session-from-remote-shell):\n\n```bash\n# ======== first terminal window =========\naz webapp remote-connection create --resource-group ${RESOURCEGROUP_NAME} --name ${WEBAPP_NAME} \u0026\n[1] 10851\nbash-3.2$ Auto-selecting port: 54155\nSSH is available { username: root, password: Docker! }\nStart your favorite client and connect to port 54155\nWebsocket tracing disabled, use --verbose flag to enable\nSuccessfully connected to local server..\n\nssh root@localhost -p 58386\nThe authenticity of host '[localhost]:58386 ([127.0.0.1]:58386)' can't be established.\nECDSA key fingerprint is SHA256:7EHlhnWmPC600borWmiBMP43SdXIHedlk4sKIfJKu3I.\nAre you sure you want to continue connecting (yes/no)? yes\nWarning: Permanently added '[localhost]:58386' (ECDSA) to the list of known hosts.\nroot@localhost's password:\n  _____\n  /  _  \\ __________ _________   ____\n /  /_\\  \\___   /  |  \\_  __ \\_/ __ \\\n/    |    \\/    /|  |  /|  | \\/\\  ___/\n\\____|__  /_____ \\____/ |__|    \\___  \u003e\n        \\/      \\/                  \\/\nA P P   S E R V I C E   O N   L I N U X\n\nDocumentation: http://aka.ms/webapp-linux\nee72972be508:/home#\n\n# ======== run JBoss/WildFly CLI commands to configure a data source ===========\n\nee72972be508:/home# source startup.sh\nPicked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true\n\"Configuring sqlDS ===================\"\n\"Installing MSSQL module\"\n\"Installing MSSQL driver\"\n\"Installing MSSQL datasource\"\nThe batch executed successfully\nee72972be508:/home# /opt/jboss/wildfly/bin/jboss-cli.sh -c\nPicked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true\n\n[standalone@localhost:9990 /] /subsystem=datasources/data-source=sqlDS:test-connection-in-pool()\n{\n    \"outcome\" =\u003e \"success\",\n    \"result\" =\u003e [true]\n}\n\n[standalone@localhost:9990 /] exit\n``` \n\n##### Step 5: Restart the remote WildFly app server\n\nUse Azure CLI to restart the remote WildFly app server:\n   \n```bash\naz webapp stop -g ${RESOURCEGROUP_NAME} -n ${WEBAPP_NAME}\naz webapp start -g ${RESOURCEGROUP_NAME} -n ${WEBAPP_NAME}\n```\n\nFor additional info, please refer to: \n\n- [JBoss Data Source Management](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/datasource_management).\n- [JBoss/WildFly CLI Guide](https://docs.jboss.org/author/display/WFLY/Command+Line+Interface)\n- [Open SSH session from your development machine to App Service Linux](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#open-ssh-session-from-remote-shell)\n\n\n#### Build PetStore to interact with Azure SQL Database\n\n```bash\n# Use the Maven profile for Azure SQL Database to build\n\nmvn package -Dmaven.test.skip=true -Ddb=sql\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- copy-rename-maven-plugin:1.0:copy (copy-file) @ petstoreee7 ---\n[INFO] Copied /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-sql/agoncal-application-petstore-ee7/src/main/resources/META-INF/persistence-sql.xml to /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-sql/agoncal-application-petstore-ee7/src/main/resources/META-INF/persistence.xml\n[INFO] \n[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ petstoreee7 ---\n[INFO] Using 'UTF-8' encoding to copy filtered resources.\n[INFO] Copying 14 resources\n[INFO] \n[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ petstoreee7 ---\n[INFO] Nothing to compile - all classes are up to date\n[INFO] \n[INFO] --- swagger-maven-plugin:3.1.6:generate (default) @ petstoreee7 ---\n[INFO] \n[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ petstoreee7 ---\n[INFO] Not copying test resources\n[INFO] \n[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ petstoreee7 ---\n[INFO] Not compiling test sources\n[INFO] \n[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ petstoreee7 ---\n[INFO] Tests are skipped.\n[INFO] \n[INFO] --- maven-war-plugin:3.1.0:war (default-war) @ petstoreee7 ---\n[INFO] Packaging webapp\n[INFO] Assembling webapp [petstoreee7] in [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-sql/agoncal-application-petstore-ee7/target/applicationPetstore]\n[INFO] Processing war project\n[INFO] Copying webapp resources [/Users/selvasingh/migrate-Java-EE-app-to-azure/initial-sql/agoncal-application-petstore-ee7/src/main/webapp]\n[INFO] Webapp assembled in [394 msecs]\n[INFO] Building war: /Users/selvasingh/migrate-Java-EE-app-to-azure/initial-sql/agoncal-application-petstore-ee7/target/applicationPetstore.war\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 3.850 s\n[INFO] Finished at: 2019-06-01T17:47:53-07:00\n[INFO] Final Memory: 22M/338M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Deploy to App Service Linux \n\nDeploy to WildFly in App Service Linux:\n\n```bash\nmvn azure-webapp:deploy\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building Petstore application using Java EE 7 7.0\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- azure-webapp-maven-plugin:1.6.0:deploy (default-cli) @ petstoreee7 ---\n[INFO] Authenticate with Azure CLI 2.0\n[INFO] Updating target Web App...\n[INFO] Successfully updated Web App.\n[INFO] Trying to deploy artifact to petstore-java-ee...\n[INFO] Deploying the war file...\n[INFO] Successfully deployed the artifact to https://petstore-java-ee.azurewebsites.net\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 01:25 min\n[INFO] Finished at: 2019-06-01T17:54:14-07:00\n[INFO] Final Memory: 50M/635M\n[INFO] ------------------------------------------------------------------------\n```\n\n#### Open Pet Store running on App Service Linux and interacting with Azure SQL Database\n\n```bash\nopen https://petstore-java-ee.azurewebsites.net\n```\n\n![](./media/YAPS-PetStore-on-h2-small.jpg)\n\n#### Log into Azure SQL Database and Validate Tables were Created and Populated\n\n```bash\n# Show tables in SQL Database\nsqlcmd -S ${SQL_SERVER_FULL_NAME} \\\n    -d ${SQL_DATABASE_NAME} \\\n    -U ${SQL_SERVER_ADMIN_FULL_NAME} \\\n    -P ${SQL_SERVER_ADMIN_PASSWORD} \\\n    -Q \"SELECT name, id, crdate FROM SYSOBJECTS WHERE xtype = 'U'\"\n\n--------------------- ----------- -----------------------\nCategory                 18099105 2019-05-31 14:41:52.280\nCountry                  50099219 2019-05-31 14:41:52.320\nCustomer                 82099333 2019-05-31 14:41:52.330\nItem                    114099447 2019-05-31 14:41:52.347\norder_line              146099561 2019-05-31 14:41:52.373\nProduct                 194099732 2019-05-31 14:41:52.390\npurchase_order          226099846 2019-05-31 14:41:52.427\nt_order_order_line      258099960 2019-05-31 14:41:52.483\n\n(8 rows affected)\n\n# Show contents in category table\n\nsqlcmd -S ${SQL_SERVER_FULL_NAME} \\\n    -d ${SQL_DATABASE_NAME} \\\n    -U ${SQL_SERVER_ADMIN_FULL_NAME} \\\n    -P ${SQL_SERVER_ADMIN_PASSWORD} \\\n    -Q \"select name from category\"\n\nname                          \n------------------------------\nFish                          \nDogs                          \nReptiles                      \nCats                          \nBirds                         \n\n(5 rows affected)\n\n```\n\n#### Trouble Shoot Petstore on Azure by Viewing Logs\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-12-22T00:47:48  Welcome, you are now connected to log-streaming service.\n2018-12-22T00:41:45.064280703Z   _____                               \n2018-12-22T00:41:45.064325203Z   /  _  \\ __________ _________   ____  \n2018-12-22T00:41:45.064331403Z  /  /_\\  \\___   /  |  \\_  __ \\_/ __ \\ \n2018-12-22T00:41:45.064335603Z /    |    \\/    /|  |  /|  | \\/\\  ___/ \n2018-12-22T00:41:45.064339403Z \\____|__  /_____ \\____/ |__|    \\___  \u003e\n2018-12-22T00:41:45.064343503Z         \\/      \\/                  \\/ \n2018-12-22T00:41:45.064347403Z A P P   S E R V I C E   O N   L I N U X  \n...\n...\n\n2019-06-02T00:55:35.520469647Z 00:55:35,520 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) started in 9816ms - Started 81 of 93 services (31 services are lazy, passive or on-demand)\n2019-06-02T00:55:38.548395649Z ***Admin server is ready\n2019-06-02T00:55:38.555859867Z STARTUP_FILE=/home/startup.sh\n2019-06-02T00:55:38.582558031Z STARTUP_COMMAND=\n2019-06-02T00:55:38.587032142Z Copying /home/startup.sh to /tmp/startup.sh and fixing EOL characters in /tmp/startup.sh\n2019-06-02T00:55:38.593801458Z Running STARTUP_FILE: /tmp/startup.sh\n2019-06-02T00:55:38.628501142Z Picked up JAVA_TOOL_OPTIONS:  -Djava.net.preferIPv4Stack=true\n2019-06-02T00:55:42.206161168Z \"Configuring sqlDS ===================\"\n2019-06-02T00:55:42.211727982Z \"Installing MSSQL module\"\n2019-06-02T00:55:42.253643983Z \"Installing MSSQL driver\"\n2019-06-02T00:55:42.284713558Z \"Installing MSSQL datasource\"\n2019-06-02T00:55:42.490971355Z The batch executed successfully\n2019-06-02T00:55:42.552288503Z 00:55:42,552 INFO  [org.jboss.as] (MSC service thread 1-1) WFLYSRV0050: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) stopped in 47ms\n2019-06-02T00:55:42.564687033Z 00:55:42,564 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) starting\n...\n...\n2019-06-02T00:55:44.293778902Z 00:55:44,293 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 44) WFLYJCA0004: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 7.2)\n2019-06-02T00:55:44.594576027Z 00:55:44,594 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = sqlserver\n2019-06-02T00:55:44.607447158Z 00:55:44,601 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]\n2019-06-02T00:55:44.610591266Z 00:55:44,610 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:jboss/datasources/sqlDS]\n...\n...\n019-06-02T00:55:56.153951398Z 00:55:56,152 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 79) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'ROOT.war#applicationPetstorePU'\n2019-06-02T00:55:57.237113910Z 00:55:57,232 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 79) HHH000400: Using dialect: org.hibernate.dialect.SQLServer2012Dialect\n\n```\n\nWhen you are finished, you can check your results \nagainst YOUR code in \n[migrate-Java-EE-app-to-azure/complete](https://github.com/Azure-Samples/migrate-Java-EE-app-to-azure/tree/master/complete).\n\n## Scale out the Pet Store 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 migrated an \nexisting Java EE workload to Azure, aka app to App Service Linux and \napp's data to Azure Database for PostgreSQL, MySQL and or SQL Database.\n\n## Resources\n\n- [Java Enterprise Guide for App Service on Linux](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-java-enterprise)\n- [Maven Plugin for Azure App Service](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme?view=azure-java-stable)\n- [JBoss Data Source Management](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/datasource_management)\n- [JBoss/WildFly CLI Guide](https://docs.jboss.org/author/display/WFLY/Command+Line+Interface)\n- [JDBC driver for PostgreSQL](https://jdbc.postgresql.org/download.html)\n- [PostgreSQL CLI Cheat Sheet](http://www.postgresqltutorial.com/postgresql-cheat-sheet/)\n- [JDBC driver for MySQL](https://dev.mysql.com/downloads/connector/j/)\n- [MySQL CLI Cheat Sheet](http://www.mysqltutorial.org/mysql-cheat-sheet.aspx)\n- [Cheat sheet for sqlcmd CLI](https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility)\n- [Opening an SSH connection from your development machine](https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#open-ssh-session-from-remote-shell)\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%2Fmigrate-java-ee-app-to-azure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselvasingh%2Fmigrate-java-ee-app-to-azure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselvasingh%2Fmigrate-java-ee-app-to-azure/lists"}