Skip to content

Commit 0331852

Browse files
wchigitallxiaomajguoXiaoyun DingyiliuTo
authored
Code2Cloud deployment workshop (#61)
* Update README * add execution permisson to shell scripts Signed-off-by: Jianguo Ma <[email protected]> * worker doesn't listen to port 8081 Signed-off-by: Jianguo Ma <[email protected]> * clean before starting web/worker apps Signed-off-by: Jianguo Ma <[email protected]> * update readme Signed-off-by: Jianguo Ma <[email protected]> * add dev container config Signed-off-by: Jianguo Ma <[email protected]> * fix typo in readme Signed-off-by: Jianguo Ma <[email protected]> * Use jdk8 and springboot 2 for asset manager * fix compile * remove ut in asset manager jdk8 branch (#25) * simply rabbitmq config * add spring boot 2 api * add handler interceptor * remove asb-unsupported properties * refine code * remove unnecessary code * update readme * set rabbitmq config * remove rabbitmq features * add custom tasks * update readme * containerization * deployment init * comment a graph * comment another graph * revert deploy for pr * Wc/c2c workshop (#59) * containerization * deployment init * comment a graph * comment another graph * revert deploy for pr * deployment using c2c * rebase 2 * minor * paraphrase and format * remove old script * add expected result * recover clean-up and refine expected * refine sentence * add state to top --------- Signed-off-by: Jianguo Ma <[email protected]> Co-authored-by: Menghua Xiao <[email protected]> Co-authored-by: Jianguo Ma <[email protected]> Co-authored-by: Xiaoyun Ding <[email protected]> Co-authored-by: Yi Liu <[email protected]>
1 parent 001d92a commit 0331852

File tree

10 files changed

+14
-42
lines changed

10 files changed

+14
-42
lines changed

asset-manager/README.md

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ In this workshop, you will use the **GitHub Copilot app modernization** extensio
3232
* [main](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/main/asset-manager): The original state of the asset-manager application.
3333
* [workshop/java-upgrade](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/java-upgrade/asset-manager): The project state after assessment and Java upgrading steps.
3434
* [workshop/expected](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/expected/asset-manager): The project state after assessment, Java upgrading, and migration steps.
35+
* [workshop/deployment-expected](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/deployment-expected/asset-manager): The project state after containerization and deployment steps.
3536

3637
## Current Architecture
3738
```mermaid
@@ -233,7 +234,7 @@ In this section, you will use custom tasks to expose health endpoints for your a
233234
### Containerize Applications
234235

235236
Now that you have successfully migrated your Java application to use Azure services, the next step is to prepare it for cloud deployment by containerizing both the web and worker modules. In this section, you will use **Containerization Tasks** to containerize your migrated applications.
236-
> Note: If you have any problems with the previous migration step, you can start from the [workshop/expected](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/expected/asset-manager) branch for the deployment operation.
237+
> Note: If you encounter any issues with the previous migration step, you can directly proceed with the containerization step using the [workshop/expected](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/expected/asset-manager) branch.
237238
238239
1. Open the sidebar of `GITHUB COPILOT APP MODERNIZATION`. In **Tasks** view, click the **Run Task** button of **Java** -> **Containerization Tasks** -> **Containerize Application**.
239240

@@ -249,54 +250,25 @@ Now that you have successfully migrated your Java application to use Azure servi
249250

250251
### Deploy to Azure
251252

252-
At this point, you have successfully migrated the sample Java application `asset-manager` to Azure Database for PostgreSQL (Spring), Azure Blob Storage, and Azure Service Bus, and exposed health endpoints via Spring Boot Actuator.
253-
> Note: If you encounter any issues with the previous migration step, you can directly proceed with the deployment step using the [workshop/expected](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/expected/asset-manager) branch.
253+
At this point, you have successfully migrated the sample Java application `asset-manager` to Azure Database for PostgreSQL (Spring), Azure Blob Storage, and Azure Service Bus, and exposed health endpoints via Spring Boot Actuator. Now, you can start the deployment to Azure.
254+
> Note: If you encounter any issues with the previous migration step, you can directly proceed with the deployment step using the [workshop/expected](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/expected/asset-manager) branch.
254255
255-
Now, you can deploy the migrated application to Azure using the Azure CLI after you identify a working location for your Azure resources. For example, an Azure Database for PostgreSQL Flexible Server requires a location that supports the service. Follow the instructions below to find a suitable location.
256+
1. Open the sidebar of `GITHUB COPILOT APP MODERNIZATION`. In **Tasks** view, click the **Run Task** button of **Java** -> **Deployment Tasks** -> **Provision Infrastructure and Deploy to Azure**.
256257

257-
1. Run the following command to list all available locations for the current subscription.
258+
![Run Deployment task](doc-media/deployment-run-task.png)
259+
1. A predefined prompt will be populated in the Copilot Chat panel with Agent Mode. The default hosting Azure service is Azure Container Apps.To change the hosting service to **Azure Kubernetes Service** (AKS), click on the prompt in the Copilot Chat panel and edit the last sentence of the prompt to **Hosting service: AKS**.
258260

259-
```bash
260-
az account list-locations -o table
261-
```
261+
![Deployment prompt](doc-media/deployment-prompt.png)
262+
1. Click ****Continue**/**Allow** if pop-up notifications to let Copilot Agent analyze the project and create a deployment plan in **plan.copilotmd** with Azure resources architecture, recommended Azure resources for project and security configurations, and execution steps for deployment.
262263

263-
1. Select a location from column **Name** in the output.
264+
1. View the architecture diagram, resource configurations, and execution steps in the plan. Click **Keep** to save the plan and type in **Execute the plan** to start the deployment.
264265

265-
1. Run the following command to list all available SKUs in the selected location for Azure Database for PostgreSQL Flexible Server:
266+
![Deployment execute](doc-media/deployment-execute.png)
267+
1. When prompted, click **Continue**/**Allow** in chat notifications or type **y**/**yes** in terminal as Copilot Agent follows the plan and leverages agent tools to create and run provisioning and deployment scripts, fix potential errors, and finish the deployment. You can also check the deployment status in **progress.copilotmd**. **DO NOT interrupt** when provisioning or deployment scripts are running.
266268

267-
```bash
268-
az postgres flexible-server list-skus --location <your location> -o table
269-
```
269+
![Deployment progress](doc-media/deployment-progress.png)
270270

271-
1. If you see the output contains the SKU `Standard_B1ms` and the **Tier** is `Burstable`, you can use the location for the deployment. Otherwise, try another location.
272-
273-
```text
274-
SKU Tier VCore Memory Max Disk IOPS
275-
----------------- --------------- ------- -------- ---------------
276-
Standard_B1ms Burstable 1 2 GiB 640e
277-
```
278-
279-
You can either run the deployment script locally or use GitHub Codespaces. The recommended approach is to run the deployment script in GitHub Codespaces, as it provides a ready-to-use environment with all the necessary dependencies.
280-
281-
Deploy using GitHub Codespaces:
282-
1. Commit and push the changes to your forked repository.
283-
1. Follow the instructions in [Use GitHub Codespaces for Deployment](README.md#use-github-codespaces-for-deployment) to deploy the app to Azure.
284-
285-
Deploy using the local environment by running the deployment script in the terminal:
286-
1. Run `az login` to sign in to Azure.
287-
1. Run the following commands to deploy the app to Azure:
288-
289-
Windows:
290-
```batch
291-
scripts\deploy-to-azure.cmd -ResourceGroupName <your resource group name> -Location <your resource group location, e.g., eastus2> -Prefix <your unique resource prefix>
292-
```
293-
294-
Linux:
295-
```bash
296-
scripts/deploy-to-azure.sh -ResourceGroupName <your resource group name> -Location <your resource group location, e.g., eastus2> -Prefix <your unique resource prefix>
297-
```
298-
299-
Once the deployment script completes successfully, it will output the URL of the web application. Open the URL in a browser to verify that the application is running as expected.
271+
> Note: If you encounter any issues with the deployment step, you can refer to the expected Copilot-generated deployment scripts in `/.azure` folder of the [workshop/deployment-expected](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/deployment-expected/asset-manager) branch to compare your deployment scripts and troubleshoot the problems.
300272
301273
#### Clean up
302274

41.9 KB
Loading
-157 KB
Loading
26.2 KB
Loading
21.4 KB
Loading
-24.9 KB
Loading
443 KB
Loading
14.5 KB
Loading

asset-manager/scripts/startapp.sh

100644100755
File mode changed.

asset-manager/scripts/stopapp.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)