Support for Azure deployment.

This commit is contained in:
Andrey Shabarshov 2022-03-22 17:06:54 +00:00
parent 63103fd176
commit 1ab2706a53
8 changed files with 191 additions and 7 deletions

View File

@ -14,7 +14,7 @@ namespace QRBee.Droid
{ {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.1.0.11")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.2.0.155")]
public partial class Resource public partial class Resource
{ {

View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.3",
"commands": [
"dotnet-ef"
]
}
}
}

View File

@ -37,7 +37,7 @@ builder.Services
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) //if (app.Environment.IsDevelopment())
{ {
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(); app.UseSwaggerUI();

View File

@ -0,0 +1,117 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_dependencyType": "compute.appService.linux"
},
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "QRBeeGroup",
"metadata": {
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "uksouth",
"metadata": {
"description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
}
},
"resourceName": {
"type": "string",
"defaultValue": "QRBee-API",
"metadata": {
"description": "Name of the main resource to be created by this template."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"variables": {
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"location": "[parameters('resourceLocation')]",
"name": "[parameters('resourceName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2015-08-01",
"tags": {
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
},
"dependsOn": [
"[variables('appServicePlan_ResourceId')]"
],
"kind": "app",
"properties": {
"name": "[parameters('resourceName')]",
"kind": "app",
"httpsOnly": true,
"reserved": false,
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
"siteConfig": {
"linuxFxVersion": "DOTNETCORE|2.1"
}
},
"identity": {
"type": "SystemAssigned"
},
"resources": [
{
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/Sites/', parameters('resourceName'))]"
],
"properties": {}
}
]
},
{
"location": "[parameters('resourceLocation')]",
"name": "[variables('appServicePlan_name')]",
"type": "Microsoft.Web/serverFarms",
"apiVersion": "2015-02-01",
"kind": "linux",
"properties": {
"name": "[variables('appServicePlan_name')]",
"sku": "Standard",
"workerSizeId": "0",
"reserved": true
}
}
]
}
}
}
]
}

View File

@ -18,7 +18,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.0" />
<PackageReference Include="MongoDB.Driver" Version="2.15.0" /> <PackageReference Include="MongoDB.Driver" Version="2.15.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />
</ItemGroup> </ItemGroup>
@ -27,4 +27,10 @@
<ProjectReference Include="..\QRBee.Core\QRBee.Core.csproj" /> <ProjectReference Include="..\QRBee.Core\QRBee.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="private_key.p12">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -9,3 +9,7 @@
4. Save text file as StartMongo.bat file 4. Save text file as StartMongo.bat file
5. Run StartMongo.bat 5. Run StartMongo.bat
Initialize the database using Databasae/MOngoDB-init.js using Robo3T or Mongo CLI tools.
This step can be avoided and collections will be created automatically, but you still have to
cerate the database named "QRBee" and later the indexes required.

View File

@ -0,0 +1,43 @@
//sh.createDatabase("QRBee");
//db["Users"].drop();
//db["Certificates"].drop();
//db["Transactions"].drop();
db.createCollection("Users");
db.createCollection("Certificates");
db.createCollection("Transactions");
db["Users"].createIndex(
{
"_id": 1
}
);
db["Users"].createIndex(
{
"Email": 1
},
{
unique: false,
sparse: true
}
);
db["Certificates"].createIndex(
{
"_id": 1
}
);
db["Certificates"].createIndex(
{
"ClientId": 1
},
{
unique: true,
sparse: true
}
);
db["Transactions"].createIndex(
{
"_id": 1
}
);

View File

@ -27,6 +27,7 @@
</layout> </layout>
</appender> </appender>
<!--
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="${LOGS_ROOT}\QRBeeAPI.log" /> <file value="${LOGS_ROOT}\QRBeeAPI.log" />
<appendToFile value="false" /> <appendToFile value="false" />
@ -38,12 +39,13 @@
<conversionPattern value="%date %-5level[%logger]: %message%newline" /> <conversionPattern value="%date %-5level[%logger]: %message%newline" />
</layout> </layout>
</appender> </appender>
-->
<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" > <appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" >
<bufferSize value="1"/> <bufferSize value="1"/>
<appender-ref ref="DebugAppender" /> <appender-ref ref="DebugAppender" />
<appender-ref ref="Console" /> <appender-ref ref="Console" />
<appender-ref ref="RollingFile" /> <!-- <appender-ref ref="RollingFile" /> -->
</appender> </appender>
<root> <root>