Skip to content

Commit c5fdc00

Browse files
committed
Adding ARM template, README and GH Action
1 parent fd5b398 commit c5fdc00

File tree

5 files changed

+187
-3
lines changed

5 files changed

+187
-3
lines changed

.github/workflows/workflow.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build-Deploy-WebApp
2+
on: [push]
3+
env:
4+
AZURE_WEBAPP_NAME: loadtestingweb
5+
AZURE_WEBAPP_PACKAGE_PATH: 'LoadTestingWebApp'
6+
DOTNET_VERSION: '7.0.x'
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@main
12+
- name: Setup .NET
13+
uses: actions/setup-dotnet@v3
14+
with:
15+
dotnet-version: ${{ env.DOTNET_VERSION }}
16+
- name: Build .NET
17+
run: |
18+
dotnet restore
19+
dotnet build --configuration Release
20+
dotnet publish -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/LoadTestingWebApp'
21+
# Deploy to Azure Web apps
22+
- name: 'Deploy to Azure'
23+
uses: azure/webapps-deploy@v2
24+
with:
25+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
26+
publish-profile: ${{ secrets.AZURE_WEBAPP_SECRET }}
27+
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/LoadTestingWebApp'

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ mono_crash.*
2323
[Rr]eleases/
2424
x64/
2525
x86/
26-
[Aa][Rr][Mm]/
27-
[Aa][Rr][Mm]64/
2826
bld/
2927
[Bb]in/
3028
[Oo]bj/

ARM/template.json

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"location": {
6+
"type": "String",
7+
"defaultValue": "eastus"
8+
},
9+
"locationName": {
10+
"type": "String",
11+
"defaultValue": "East US"
12+
},
13+
"sku": {
14+
"type": "String",
15+
"defaultValue": "Basic"
16+
},
17+
"skucode": {
18+
"type": "String",
19+
"defaultValue": "B1"
20+
},
21+
"linuxFxVersion": {
22+
"type": "String",
23+
"defaultValue": "DOTNETCORE|7.0"
24+
}
25+
},
26+
"variables": {
27+
"cosmos_name": "[concat('loadtestingcosmos',uniqueString(resourceGroup().id))]",
28+
"logs_name": "[concat('loadtestinglogs',uniqueString(resourceGroup().id))]",
29+
"plan_name": "[concat('loadtestingplan',uniqueString(resourceGroup().id))]",
30+
"insights_name": "[concat('loadtestinginsights',uniqueString(resourceGroup().id))]",
31+
"app_name": "[concat('loadtestingweb',uniqueString(resourceGroup().id))]"
32+
},
33+
"resources": [
34+
{
35+
"type": "Microsoft.DocumentDb/databaseAccounts",
36+
"apiVersion": "2022-08-15-preview",
37+
"name": "[variables('cosmos_name')]",
38+
"location": "[parameters('location')]",
39+
"tags": {
40+
"defaultExperience": "Core (SQL)",
41+
"hidden-cosmos-mmspecial": ""
42+
},
43+
"kind": "GlobalDocumentDB",
44+
"properties": {
45+
"databaseAccountOfferType": "Standard",
46+
"locations": [
47+
{
48+
"id": "[concat(variables('cosmos_name'), '-', parameters('location'))]",
49+
"failoverPriority": 0,
50+
"locationName": "[parameters('locationName')]"
51+
}
52+
],
53+
"backupPolicy": {
54+
"type": "Periodic",
55+
"periodicModeProperties": {
56+
"backupIntervalInMinutes": 240,
57+
"backupRetentionIntervalInHours": 8,
58+
"backupStorageRedundancy": "Geo"
59+
}
60+
},
61+
"isVirtualNetworkFilterEnabled": false,
62+
"virtualNetworkRules": [],
63+
"ipRules": [],
64+
"dependsOn": [],
65+
"enableMultipleWriteLocations": false,
66+
"capabilities": [],
67+
"enableFreeTier": true,
68+
"capacity": {
69+
"totalThroughputLimit": 1000
70+
}
71+
}
72+
},
73+
{
74+
"type": "Microsoft.OperationalInsights/workspaces",
75+
"apiVersion": "2017-03-15-preview",
76+
"name": "[variables('logs_name')]",
77+
"location": "[parameters('location')]",
78+
"tags": {},
79+
"properties": {
80+
"sku": {
81+
"name": "pergb2018"
82+
}
83+
}
84+
},
85+
{
86+
"type": "Microsoft.Web/serverfarms",
87+
"apiVersion": "2018-11-01",
88+
"name": "[variables('plan_name')]",
89+
"location": "[parameters('location')]",
90+
"sku": {
91+
"Tier": "[parameters('sku')]",
92+
"Name": "[parameters('skuCode')]"
93+
},
94+
"kind": "linux",
95+
"properties": {
96+
"name": "[variables('plan_name')]",
97+
"workerSize": 0,
98+
"workerSizeId": 0,
99+
"numberOfWorkers": 1,
100+
"reserved": true,
101+
"zoneRedundant": false
102+
}
103+
},
104+
{
105+
"type": "microsoft.insights/components",
106+
"apiVersion": "2020-02-02-preview",
107+
"name": "[variables('insights_name')]",
108+
"location": "[parameters('location')]",
109+
"dependsOn": [ "[resourceId('Microsoft.OperationalInsights/workspaces/', variables('logs_name'))]" ],
110+
"tags": {},
111+
"properties": {
112+
"ApplicationId": "[variables('insights_name')]",
113+
"Application_Type": "web",
114+
"Flow_Type": "Redfield",
115+
"Request_Source": "IbizaAIExtension",
116+
"WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces/', variables('logs_name'))]"
117+
}
118+
},
119+
{
120+
"type": "Microsoft.Web/sites",
121+
"apiVersion": "2018-11-01",
122+
"name": "[variables('app_name')]",
123+
"location": "[parameters('location')]",
124+
"dependsOn": [ "[resourceId('Microsoft.Web/serverfarms/', variables('plan_name'))]" ],
125+
"tags": {},
126+
"properties": {
127+
"name": "[variables('app_name')]",
128+
"siteConfig": {
129+
"appSettings": [],
130+
"linuxFxVersion": "[parameters('linuxFxVersion')]",
131+
"alwaysOn": false,
132+
"ftpsState": "FtpsOnly"
133+
},
134+
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', variables('plan_name'))]",
135+
"clientAffinityEnabled": false,
136+
"virtualNetworkSubnetId": null,
137+
"httpsOnly": true
138+
}
139+
}
140+
],
141+
"outputs": {}
142+
}

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
# LoadTestingDemo
1+
# Load Testing Demo
2+
3+
This is a demo repository about Azure Load Testing in CI/CD with Azure DevOps and GitHub.
4+
5+
Check out the [blog post about this repository](https://xpirit.com/adding-load-testing-to-your-workflows).
6+
7+
## Want to try it out?
8+
9+
If you would like to try this demo/project. You will need to deploy the following Azure resources:
10+
11+
- Azure Cosmos DB (free tier)
12+
- Azure App Service Plan (Basic B1)
13+
- Azure Web App (Linux - .NET 7)
14+
- Azure Application Insights (With Log Analytics)
15+
16+
You can use the following ARM template to deploy the resources needed:
17+
18+
[![Deploy to Azure](img/deploy.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fdsanchezcr%2FLoadTestingDemo%2Fmain%2FARM%2Ftemplate.json)

img/deploy.png

2.86 KB
Loading

0 commit comments

Comments
 (0)