Skip to content

Commit b02928c

Browse files
Adding Workshop documentation to .NET RWA 1.1 Sample (#382)
Co-authored-by: Taylor Southwick <tasou@microsoft.com>
1 parent e6b5229 commit b02928c

File tree

99 files changed

+3596
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+3596
-9
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@
4444
},
4545
// resolves error: dubious ownership of the workspace folder
4646
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}"
47-
}
47+
}

.vscode/launch.json

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,36 @@
88
"name": ".NET Core Launch (web)",
99
"type": "coreclr",
1010
"request": "launch",
11-
"preLaunchTask": "build",
11+
"preLaunchTask": "buildweb",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/src/Relecloud.Web/bin/Debug/net6.0/Relecloud.Web.dll",
13+
"program": "${workspaceFolder}/src/Relecloud.Web.CallCenter/bin/Debug/net6.0/Relecloud.Web.CallCenter.dll",
1414
"args": [],
15-
"cwd": "${workspaceFolder}/src/Relecloud.Web",
15+
"cwd": "${workspaceFolder}/src/Relecloud.Web.CallCenter",
16+
"stopAtEntry": false,
17+
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
18+
"serverReadyAction": {
19+
"action": "openExternally",
20+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
21+
},
22+
"env": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"sourceFileMap": {
26+
"/Views": "${workspaceFolder}/Views"
27+
}
28+
},
29+
{
30+
// Use IntelliSense to find out which attributes exist for C# debugging
31+
// Use hover for the description of the existing attributes
32+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
33+
"name": ".NET Core Launch (Api)",
34+
"type": "coreclr",
35+
"request": "launch",
36+
"preLaunchTask": "buildapi",
37+
// If you have changed target frameworks, make sure to update the program path.
38+
"program": "${workspaceFolder}/src/Relecloud.Web.CallCenter.Api/bin/Debug/net6.0/Relecloud.Web.CallCenter.Api.dll",
39+
"args": [],
40+
"cwd": "${workspaceFolder}/src/Relecloud.Web.CallCenter.Api",
1641
"stopAtEntry": false,
1742
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
1843
"serverReadyAction": {
@@ -31,5 +56,15 @@
3156
"type": "coreclr",
3257
"request": "attach"
3358
}
34-
]
59+
],
60+
"compounds": [
61+
{
62+
"name": "Web + Api",
63+
"configurations": [
64+
".NET Core Launch (web)",
65+
".NET Core Launch (Api)"
66+
],
67+
"stopAll": true
68+
}
69+
]
3570
}

.vscode/tasks.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "build",
5+
"label": "buildweb",
66
"command": "dotnet",
77
"type": "process",
88
"args": [
99
"build",
10-
"${workspaceFolder}/src/Relecloud.Web/Relecloud.Web.csproj",
10+
"${workspaceFolder}/src/Relecloud.Web.CallCenter/Relecloud.Web.CallCenter.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "buildapi",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"build",
22+
"${workspaceFolder}/src/Relecloud.Web.CallCenter.Api/Relecloud.Web.CallCenter.Api.csproj",
1123
"/property:GenerateFullPaths=true",
1224
"/consoleloggerparameters:NoSummary"
1325
],
@@ -19,7 +31,7 @@
1931
"type": "process",
2032
"args": [
2133
"publish",
22-
"${workspaceFolder}/src/Relecloud.Web/Relecloud.Web.csproj",
34+
"${workspaceFolder}/src/Relecloud.Web.CallCenter/Relecloud.Web.CallCenter.csproj",
2335
"/property:GenerateFullPaths=true",
2436
"/consoleloggerparameters:NoSummary"
2537
],
@@ -33,7 +45,7 @@
3345
"watch",
3446
"run",
3547
"--project",
36-
"${workspaceFolder}/src/Relecloud.Web/Relecloud.Web.csproj"
48+
"${workspaceFolder}/src/Relecloud.Web.CallCenter/Relecloud.Web.CallCenter.csproj"
3749
],
3850
"problemMatcher": "$msCompile"
3951
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
## 1 - Tooling and Deployment
2+
3+
Welcome to the RWA .NET Workshop, we are going to learn how build reliable web applications using .NET and enterprise Cloud Apps. We are going to deploy a Ticket Store Application, Relecloud Concerts!
4+
5+
For this guide, we use Dev Containers to provide a complete development environment for the project.
6+
7+
> For your convenience, we use Dev Containers with a fully-featured development environment. If you prefer to use Visual Studio, we recommend installing the necessary [dependencies](../../prerequisites.md) and skip to the deployment instructions starting in [Step 3](#3-log-in-to-azure).
8+
9+
### 1. Clone the repo
10+
11+
> For Windows users, we recommend using Windows Subsystem for Linux (WSL) to [improve Dev Container performance](https://code.visualstudio.com/remote/advancedcontainers/improve-performance).
12+
13+
Open a PowerShell terminal window, then run the following command.
14+
15+
```pwsh
16+
wsl
17+
```
18+
19+
Clone the repository from GitHub into the WSL 2 filesystem using the following command:
20+
21+
```shell
22+
git clone https://github.com/Azure/reliable-web-app-pattern-dotnet.git
23+
cd reliable-web-app-pattern-dotnet
24+
```
25+
26+
> You still can run this guide outside of WSL in Windows, but performance may be affected. Clone the repo with the instructions above.
27+
28+
### 2. Open Dev Container in Visual Studio Code
29+
30+
If required, ensure Docker Desktop is installed, configured to use WSL, and started [more details](https://learn.microsoft.com/windows/wsl/tutorials/wsl-containers#install-docker-desktop). Open the repository folder in Visual Studio Code. You can do this from the command prompt in WSL:
31+
32+
```shell
33+
code .
34+
```
35+
36+
> If you are not running WSL, ensure Docker Desktop is started, then open Visual Studio Code and start the Dev Container.
37+
38+
Once Visual Studio Code is launched, you should see a popup allowing you to click on the button **Reopen in Container**.
39+
40+
![Reopen in Container](../images/1-Tooling%20and%20Deployment/vscode-reopen-in-container.png)
41+
42+
If you don't see the popup, open the Visual Studio Code Command Palette to execute the command. There are three ways to open the command palette:
43+
44+
- For Mac users, use the keyboard shortcut ⇧⌘P
45+
- For Windows and Linux users, use Ctrl+Shift+P
46+
- From the Visual Studio Code top menu, navigate to View -> Command Palette.
47+
48+
Once the command palette is open, search for `Dev Containers: Rebuild and Reopen in Container`.
49+
50+
![WSL Ubuntu](../images/1-Tooling%20and%20Deployment//vscode-reopen-in-container-command.png)
51+
52+
### 3. Log in to Azure
53+
54+
Before deploying, you must be authenticated to Azure and have the appropriate subscription selected.
55+
56+
Run the following commands to authenticate:
57+
58+
59+
60+
> If you are not using PowerShell 7+, run the following command (you can use [$PSVersionTable.PSVersion](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_powershell_editions) to check your version).
61+
62+
Open PowerShell on VSCode, or use:
63+
64+
```shell
65+
pwsh
66+
```
67+
68+
Import Az.Resources use Azure command in our Shell.
69+
70+
```pwsh
71+
Import-Module Az.Resources
72+
```
73+
74+
Login into Azure:
75+
76+
```pwsh
77+
Connect-AzAccount -UseDeviceAuthentication
78+
```
79+
80+
Set the subscription to the one you want to use selecting from the list available subscriptions on the terminal. Enter the number corresponding to the subscription you do wish to use.
81+
82+
Use the next command to login with the Azure Dev CLI (AZD) tool:
83+
84+
```pwsh
85+
azd auth login --use-device-code
86+
```
87+
88+
89+
### 4. Create a new environment
90+
91+
Next we provide the AZD tool with variables that it uses to create the deployment. The first thing we initialize is the AZD environment with a name.
92+
93+
The environment name should be less than 18 characters and must be comprised of lower-case, numeric, and dash characters (for example, `dotnetwebapp`). The environment name is used for resource group naming and specific resource naming.
94+
95+
By default, Azure resources are sized for a development deployment. If doing a production deployment, see the [production deployment](../../prod-deployment.md) instructions for more detail.
96+
97+
```pwsh
98+
azd env new <pick_a_name>
99+
```
100+
101+
Use the Azure Subscription ID from the current Subscription, add this as variable.
102+
103+
```pwsh
104+
$AZURE_SUBSCRIPTION_ID=(Get-AzContext).Subscription.Id
105+
```
106+
107+
Select the subscription that will be used for the deployment:
108+
109+
```pwsh
110+
azd env set AZURE_SUBSCRIPTION_ID $AZURE_SUBSCRIPTION_ID
111+
```
112+
113+
Set the `AZURE_LOCATION` (Run `(Get-AzLocation).Location` to see a list of locations):
114+
115+
```pwsh
116+
azd env set AZURE_LOCATION <pick_a_region>
117+
```
118+
119+
### 5. Create the Azure resources and deploy the code
120+
121+
Run the following command to create the Azure resources and deploy the code (about 15-minutes to complete):
122+
123+
```pwsh
124+
azd up
125+
```
126+
127+
### 6. Open and use the application
128+
129+
Use the URL displayed in the console output to launch the web application that you have deployed:
130+
131+
![screenshot of web app home page](../images/1-Tooling%20and%20Deployment//WebAppHomePage.png)
132+
133+
The application is for the fictional company Relecloud, embodying the reliable web app pattern with a focus on .NET technologies. Relecloud Tickets is a production-grade web application that uses best practices from our guidance and gives developers concrete examples to build their own Reliable Web Application in Azure. Guiding developers through a simulated migration from an on-premises ASP.NET application to Azure, detailing the architectural changes and enhancements that capitalize on the cloud's strengths during the initial adoption phase.
134+
135+
![architecture diagram](../../assets/icons/reliable-web-app-dotnet.svg)
136+
137+
The infrastructure-as-code implementation implements the production deployment (shown above) and a development deployment, which is geared towards developer productivity and is more cost effective to run. Key aspects include:
138+
139+
- Cost Efficiency: Utilizes a hub for shared resources, such as Azure Bastion, to enable secure, cost-effective remote access without individual deployments.
140+
- Traffic Control & Security: Employs Network Security Groups and Route tables for secure traffic management within subnets, complemented by Private endpoints and a jump box for secure local IP access.
141+
- Network Integration: Facilitates data transfer and hybrid scenarios, with recommendations to consider ExpressRoute or Azure VPN Gateway for hybrid network connections.
142+
143+
For more details on the architecture and workflow for the Relecloud application, read the [main instructions](../../README.md) to learn more about the application in detail.
144+
145+
### 7. Next Steps
146+
147+
Fantastic! We've successfully deployed a production-like Relecloud concerts monolithic web application to Azure. Relecloud Concerts leverages the Reliable Web App Pattern with minimal code changes, seamlessly deployed to Azure using simple steps via azd. Now, let's dive deeper and explore the patterns and best-practices used in this application. As we advance, we'll simplify things by deploying a more basic application to help illustrate these concepts clearly before reviewing them in our main app. Ready to start? Click [next](../2%20-%20RWA%20Overview/README.MD).
148+
149+
### Appendix A (To be run only after completing the workshop)
150+
151+
See how to clean up the app in [Chapter 8](../8%20-%20Clean%20Up/README.md).
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 2 - Reliable Web App Pattern - .NET Overview
2+
3+
The reliable web app pattern (or RWA) is a set of principles that helps developers successfully migrate web applications to the cloud. It provides implementation guidance built on the Azure Well-Architected Framework. The pattern focuses on the minimal changes you need to make to ensure the success of your web app in the cloud.
4+
5+
In this workshop series, we're going to run through the principles and show how to apply them to your web applications.
6+
7+
## Enterprise web app cloud journey
8+
9+
Imagine a web application's evolution in the cloud as a journey. Each step in the journey has different goals. The reliable web app pattern is designed to help you take the first step in the journey. You may only need to "lift and shift" or replatform your application to the cloud, and do so with a minimal amount of changes. The reliable web app pattern helps you do that.
10+
11+
![Enterprise web app cloud journey](../images/2-RWA%20Overview/enterprise-web-app-cloud-journey.png)
12+
13+
Further along in the journey, you may want to refactor your application to take advantage of cloud-native features and then optimize it for scale and performance.
14+
15+
But first, let's explore what it means to converge in the cloud and and replatform an application to the Azure cloud with minimal changes but also enhances reliability and security.
16+
17+
## Pattern of patterns
18+
19+
That's not to say that the reliable web app pattern is simpilistic. _It is not_.
20+
21+
It's a pattern of patterns. Each pattern provides prescriptive guidance on how to build a specific aspect of a reliable web application. You can use them together or separately.
22+
23+
The image below shows just some of the considerations that you'll need to take into account when converging to the cloud and the reliable web app pattern provides guidance on those. In fact, the reliable web app pattern builds on real-world tested technologies and techniques, like the Azure Well-Architected Framework to produce the set of patterns that you'll learn about in the image below.
24+
25+
![Pattern of patterns](../images/2-RWA%20Overview/pattern-of-patterns.png)
26+
27+
## Objectives
28+
29+
The objectives of the reliable web app pattern are straightforward. It's designed to help you migrate to the cloud with good cloud practices:
30+
31+
![Objectives](../images/2-RWA%20Overview/objectives.png)
32+
33+
## The Five Pillars
34+
35+
The reliable web app pattern is built off of 5 pillars. Each pillar is a set of patterns that are derived from both the Azure Well-Architected Framework and 12-factor app methodology.
36+
37+
![The Five Pillars](../images/2-RWA%20Overview/the-five-pillars.png)
38+
39+
## Next Steps
40+
41+
Now that your application is up and running, it’s time to shift our attention towards optimizing the cost of our Azure deployment.
42+
43+
[Part 3 - Cost Optimization](../3%20-%20Cost%20Optimization/README.md)
44+
45+
In case your application is not yet deployed, please revisit the development and Azure tooling sections of this workshop. Ensure all the necessary tools are properly set up and your application is running smoothly before proceeding.
46+
47+
[Part 1 - Tooling Setup](../Part%201%20-%20Tooling/README.md)
48+
49+

0 commit comments

Comments
 (0)