|
1 | 1 | # Asset Manager |
2 | | -Sample project for migration tool code remediation that manages assets in cloud storage. |
3 | 2 |
|
4 | | -## Current Infrastructure |
5 | | -The project currently uses the following infrastructure, in [`main`](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/main/asset-manager) branch: |
6 | | -* AWS S3 for image storage, using password-based authentication (access key/secret key) |
7 | | -* RabbitMQ for message queuing, using password-based authentication |
8 | | -* PostgreSQL database for metadata storage, using password-based authentication |
9 | | - |
10 | | -## Current Architecture |
11 | | -```mermaid |
12 | | -flowchart TD |
13 | | -
|
14 | | -%% Applications |
15 | | -WebApp[Web Application] |
16 | | -Worker[Worker Service] |
17 | | -
|
18 | | -%% Storage Components |
19 | | -S3[(AWS S3)] |
20 | | -LocalFS[("Local File System<br/>dev only")] |
21 | | -
|
22 | | -%% Message Broker |
23 | | -RabbitMQ(RabbitMQ) |
24 | | -
|
25 | | -%% Database |
26 | | -PostgreSQL[(PostgreSQL)] |
27 | | -
|
28 | | -%% Queues |
29 | | -Queue[image-processing queue] |
30 | | -RetryQueue[image-processing.retry queue] |
31 | | -
|
32 | | -%% User |
33 | | -User([User]) |
34 | | -
|
35 | | -%% User Flow |
36 | | -User -->|Upload Image| WebApp |
37 | | -User -->|View Images| WebApp |
38 | | -
|
39 | | -%% Web App Flows |
40 | | -WebApp -->|Store Original Image| S3 |
41 | | -WebApp -->|Store Original Image| LocalFS |
42 | | -WebApp -->|Send Processing Message| RabbitMQ |
43 | | -WebApp -->|Store Metadata| PostgreSQL |
44 | | -WebApp -->|Retrieve Images| S3 |
45 | | -WebApp -->|Retrieve Images| LocalFS |
46 | | -WebApp -->|Retrieve Metadata| PostgreSQL |
47 | | -
|
48 | | -%% RabbitMQ Flow |
49 | | -RabbitMQ -->|Push Message| Queue |
50 | | -Queue -->|Processing Failed| RetryQueue |
51 | | -RetryQueue -->|After 1 min delay| Queue |
52 | | -Queue -->|Consume Message| Worker |
53 | | -
|
54 | | -%% Worker Flow |
55 | | -Worker -->|Download Original| S3 |
56 | | -Worker -->|Download Original| LocalFS |
57 | | -Worker -->|Upload Thumbnail| S3 |
58 | | -Worker -->|Upload Thumbnail| LocalFS |
59 | | -Worker -->|Store Metadata| PostgreSQL |
60 | | -Worker -->|Retrieve Metadata| PostgreSQL |
61 | | -
|
62 | | -%% Styling |
63 | | -classDef app fill:#90caf9,stroke:#0d47a1,color:#0d47a1 |
64 | | -classDef storage fill:#a5d6a7,stroke:#1b5e20,color:#1b5e20 |
65 | | -classDef broker fill:#ffcc80,stroke:#e65100,color:#e65100 |
66 | | -classDef db fill:#ce93d8,stroke:#4a148c,color:#4a148c |
67 | | -classDef queue fill:#fff59d,stroke:#f57f17,color:#f57f17 |
68 | | -classDef user fill:#ef9a9a,stroke:#b71c1c,color:#b71c1c |
69 | | -
|
70 | | -class WebApp,Worker app |
71 | | -class S3,LocalFS storage |
72 | | -class RabbitMQ broker |
73 | | -class PostgreSQL db |
74 | | -class Queue,RetryQueue queue |
75 | | -class User user |
76 | | -``` |
77 | | -Password-based authentication |
78 | | - |
79 | | -## Migrated Infrastructure |
80 | | -After migration, the project will use the following Azure services, in [`expected`](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/expected/asset-manager) branch: |
| 3 | +This [`expected`](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/expected/asset-manager) branch is the final migrated state of the asset-manager project, and both `web` and `worker` modules are migrated to Azure: |
81 | 4 | * Azure Blob Storage for image storage, using managed identity authentication |
82 | 5 | * Azure Service Bus for message queuing, using managed identity authentication |
83 | 6 | * Azure Database for PostgreSQL for metadata storage, using managed identity authentication |
@@ -151,35 +74,6 @@ class User user |
151 | 74 | ``` |
152 | 75 | Managed identity based authentication |
153 | 76 |
|
154 | | -## Run Locally |
155 | | - |
156 | | -Check out the [`main`](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/main/asset-manager) branch to run the current infrastructure locally: |
157 | | - |
158 | | -```bash |
159 | | -git clone https://github.com/Azure-Samples/java-migration-copilot-samples.git |
160 | | -cd java-migration-copilot-samples/asset-manager |
161 | | -git checkout main |
162 | | -``` |
163 | | - |
164 | | -**Prerequisites**: JDK, Docker |
165 | | - |
166 | | -Run the following commands to start the apps locally. This will: |
167 | | -* Use local file system instead of S3 to store the image |
168 | | -* Launch RabbitMQ and PostgreSQL using Docker |
169 | | - |
170 | | -Windows: |
171 | | - |
172 | | -```batch |
173 | | -scripts\start.cmd |
174 | | -``` |
175 | | - |
176 | | -Linux: |
177 | | - |
178 | | -```bash |
179 | | -scripts/start.sh |
180 | | -``` |
181 | | - |
182 | | -To stop, run `stop.cmd` or `stop.sh` in the `scripts` directory. |
183 | 77 |
|
184 | 78 | ## Run Migrated Code on Azure |
185 | 79 |
|
@@ -228,25 +122,3 @@ The deployment scripts can also be executed in GitHub Codespaces, which pre-inst |
228 | 122 | ``` |
229 | 123 |
|
230 | 124 | 1. To clean up, run `scripts\cleanup-azure-resources.cmd -ResourceGroupName <your resource group name>` or `scripts/cleanup-azure-resources.sh -ResourceGroupName <your resource group name>` for Windows and Linux, respectively. |
231 | | - |
232 | | -## Java Migration Copilot Workshop |
233 | | - |
234 | | -Check out the [`workshop`](https://github.com/Azure-Samples/java-migration-copilot-samples/tree/workshop/asset-manager) branch for Java Migration Copilot workshop: |
235 | | - |
236 | | -```bash |
237 | | -git clone https://github.com/Azure-Samples/java-migration-copilot-samples.git |
238 | | -cd java-migration-copilot-samples/asset-manager |
239 | | -git checkout workshop |
240 | | -``` |
241 | | - |
242 | | -Compared to the `main` branch, the `workshop` branch has additional commits that have already migrated the code for **Web Application** with custom code remediation, including: |
243 | | -* Azure Blob Storage for image storage, using managed identity authentication |
244 | | -* Azure Service Bus for message queuing, using managed identity authentication |
245 | | - |
246 | | -The remaining targets of the workshop are: |
247 | | -* For both **Web Application** and **Worker Service**, migrate to Azure Database for PostgreSQL Flexible server for metadata storage with managed identity authentication, using predefined prompt. |
248 | | -* For **Worker Service**, migrate to Azure Blob Storage and Azure Service Bus for image storage and message queuing, respectively, with managed identity authentication, using custom propmt created from existing commits that migrated the **Web Application**. |
249 | | - |
250 | | -Once the workshop is successfully completed, you should be able to run the migrated code on Azure, similar to [Run Migrated Code on Azure](#run-migrated-code-on-azure) but using the `workshop` branch with the migrated code. |
251 | | - |
252 | | -For more details, refer to the [workshop guide](https://github.com/Azure-Samples/java-migration-copilot-samples/blob/workshop/asset-manager/WORKSHOP.md). |
0 commit comments