Skip to content

Commit

Permalink
Merge pull request #32 from enigmatry/hosting-experiment
Browse files Browse the repository at this point in the history
ETL-240: Investigate in process hosting model in combination with 2 apps
  • Loading branch information
edekoning authored Jul 30, 2024
2 parents ddbd094 + a646a83 commit e125406
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 310 deletions.
41 changes: 0 additions & 41 deletions Deployment/publish-web-profile-test-api.proj

This file was deleted.

41 changes: 33 additions & 8 deletions Deployment/publish-web-profile-test-app.proj
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageFile>$(MSBuildProjectDirectory)\Artifacts\Enigmatry.Entry.Blueprint.App.zip</PackageFile>
<IisApplicationName>enigmatry-entry-blueprint-test</IisApplicationName>
<EnableRobotsTxtDeploy>true</EnableRobotsTxtDeploy>
<AllowSearchEngines>false</AllowSearchEngines>
</PropertyGroup>
<ItemGroup>
<ParameterValue Include="SQLDB Connection String">
<Value>Server=tcp:enigmatry-test.database.windows.net,1433;Database=enigmatry-entry-blueprint-test-001;Authentication=Active Directory Default;Connection Timeout=30</Value>
</ParameterValue>
<ParameterValue Include="ApplicationInsights ConnectionString">
<Value>InstrumentationKey=477b870b-733d-4a69-a780-9bc363f075c7;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/</Value>
</ParameterValue>
<ParameterValue Include="HealthChecks Token">
<Value>d5d97ea1-5709-45e1-a414-0bac78e8aecb</Value>
</ParameterValue>
<ParameterValue Include="Default Log Level">
<Value>Information</Value>
</ParameterValue>
<ParameterValue Include="Rolling Log File Path">
<Value>D:/home/LogFiles/api/enigmatry-entry-blueprint-api-.log</Value>
</ParameterValue>
<ParameterValue Include="Key Vault Name">
<Value>enigmatry-entry-blueprint-test</Value>
</ParameterValue>
<ParameterValue Include="Azure AD Instance">
<Value>https://enigmatryb2ctest.b2clogin.com</Value>
</ParameterValue>
<ParameterValue Include="Azure AD ClientId">
<Value>462923fc-3dcd-4b81-943d-590b9cb45ec4</Value>
</ParameterValue>
<ParameterValue Include="Azure AD Domain">
<Value>enigmatryb2ctest.onmicrosoft.com</Value>
</ParameterValue>
<ParameterValue Include="Azure AD SignUpSignInPolicyId">
<Value>B2C_1_entry_blueprint_sign_in</Value>
</ParameterValue>
<!-- Front-end params-->
<ParameterValue Include="App Version">
<Value>$(AppVersion)</Value>
</ParameterValue>
<ParameterValue Include="API Uri">
<Value>/api</Value>
<Value></Value>
</ParameterValue>
<ParameterValue Include="ApplicationInsights ConnectionString">
<Value>InstrumentationKey=477b870b-733d-4a69-a780-9bc363f075c7;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/</Value>
Expand All @@ -27,7 +52,7 @@
<Value>https://enigmatryb2ctest.onmicrosoft.com/462923fc-3dcd-4b81-943d-590b9cb45ec4/api</Value>
</ParameterValue>
<ParameterValue Include="Content Security Policy">
<Value>default-src 'none'; script-src 'self' 'unsafe-eval'; connect-src 'self' enigmatryb2ctest.b2clogin.com westeurope-5.in.applicationinsights.azure.com; img-src 'self' data:; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.gstatic.com; frame-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'</Value>
<Value>default-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; connect-src 'self' enigmatryb2ctest.b2clogin.com westeurope-5.in.applicationinsights.azure.com; img-src 'self' data:; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.gstatic.com; frame-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'</Value>
</ParameterValue>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions Enigmatry.Entry.Blueprint.Api.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2549,13 +2549,17 @@
"type": "Project",
"dependencies": {
"Enigmatry.Entry.AspNetCore.Authorization": "[3.3.1, )",
"Enigmatry.Entry.Blueprint.App": "[1.0.0, )",
"Enigmatry.Entry.Blueprint.Domain": "[1.0.0, )",
"Enigmatry.Entry.Blueprint.Infrastructure": "[1.0.0, )",
"Enigmatry.Entry.CodeGeneration.Validation": "[17.0.0, )",
"Enigmatry.Entry.HealthChecks": "[3.3.1, )",
"Microsoft.ApplicationInsights.AspNetCore": "[2.22.0, )"
}
},
"enigmatry.entry.blueprint.app": {
"type": "Project"
},
"enigmatry.entry.blueprint.applicationservices": {
"type": "Project",
"dependencies": {
Expand Down
25 changes: 11 additions & 14 deletions Enigmatry.Entry.Blueprint.Api/Enigmatry.Entry.Blueprint.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<Content Remove="appsettings.Development.json"/>
<Content Remove="appsettings.Development.json" />
</ItemGroup>

<ItemGroup>
<None Include="appsettings.Development.json"/>
<None Include="appsettings.Development.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Enigmatry.Entry.AspNetCore.Authorization"/>
<PackageReference Include="Enigmatry.Entry.HealthChecks"/>
<PackageReference Include="Enigmatry.Entry.CodeGeneration.Validation"/>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore"/>
<PackageReference Include="Enigmatry.Entry.AspNetCore.Authorization" />
<PackageReference Include="Enigmatry.Entry.HealthChecks" />
<PackageReference Include="Enigmatry.Entry.CodeGeneration.Validation" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Enigmatry.Entry.Blueprint.Infrastructure\Enigmatry.Entry.Blueprint.Infrastructure.csproj"/>
<ProjectReference Include="..\Enigmatry.Entry.Blueprint.Domain\Enigmatry.Entry.Blueprint.Domain.csproj"/>
<ProjectReference Include="..\enigmatry-entry-blueprint-app\Enigmatry.Entry.Blueprint.App.esproj" />
<ProjectReference Include="..\Enigmatry.Entry.Blueprint.Infrastructure\Enigmatry.Entry.Blueprint.Infrastructure.csproj" />
<ProjectReference Include="..\Enigmatry.Entry.Blueprint.Domain\Enigmatry.Entry.Blueprint.Domain.csproj" />
</ItemGroup>

<ItemGroup>
<WCFMetadata Include="Connected Services"/>
<WCFMetadata Include="Connected Services" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Enigmatry.Entry.Blueprint.Api.Tests"/>
<InternalsVisibleTo Include="Enigmatry.Entry.Blueprint.Api.Tests" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions Enigmatry.Entry.Blueprint.Api/ProgramExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public static void AppConfigureWebApplication(this WebApplication app)
var configuration = app.Configuration;
var env = app.Environment;

app.UseDefaultFiles();
app.UseStaticFiles();

app.MapFallbackToFile("index.html");

app.UseRouting();

if (configuration.AppUseDeveloperExceptionPage())
Expand Down
7 changes: 5 additions & 2 deletions Enigmatry.Entry.Blueprint.Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
"commandName": "IISExpress",
"launchBrowser": true,
"applicationUrl": "https://localhost:44394/",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
}
},
"Enigmatry.Entry.Blueprint.Api": {
"commandName": "Project",
"launchBrowser": false,
"applicationUrl": "http://localhost:5441/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Enigmatry.Entry.Blueprint.Api/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,9 @@
"resolved": "15.1.4",
"contentHash": "IjWucOgVbhm72da0Ck3KcyvMuKT/TfilHcvtwvhLLnkn2zr5st8BkH3lDoY5lkMH9Z3jsJeLDrnBS4GpAViUqg=="
},
"enigmatry.entry.blueprint.app": {
"type": "Project"
},
"enigmatry.entry.blueprint.applicationservices": {
"type": "Project",
"dependencies": {
Expand Down
23 changes: 23 additions & 0 deletions Enigmatry.Entry.Blueprint.Api/parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,27 @@
<parameter name="Azure AD SignUpSignInPolicyId" description="Azure AD SignUpSignInPolicyId" defaultValue="">
<parameterEntry kind="TextFile" scope="appsettings.json" match="__azureAdSignUpSignInPolicyId__" />
</parameter>
<!-- Front-end params-->
<parameter name="App Version" description="App Version" defaultValue="">
<parameterEntry kind="TextFile" scope="main.*.js" match="__appVersion__" />
</parameter>
<parameter name="API Uri" description="API Uri" defaultValue="">
<parameterValidation kind="AllowEmpty" />
<parameterEntry kind="TextFile" scope="main.*.js" match="__apiUrl__" />
</parameter>
<parameter name="ApplicationInsights ConnectionString" description="ApplicationInsights ConnectionString" defaultValue="">
<parameterEntry kind="TextFile" scope="main.*.js" match="__applicationInsightsConnectionString__" />
</parameter>
<parameter name="Azure AD ClientId" description="Azure AD ClientId" defaultValue="">
<parameterEntry kind="TextFile" scope="main.*.js" match="__azureAdClientId__" />
</parameter>
<parameter name="Azure AD Authority" description="Azure AD Authority" defaultValue="">
<parameterEntry kind="TextFile" scope="main.*.js" match="__azureAdAuthority__" />
</parameter>
<parameter name="Azure AD Scopes" description="Azure AD Scopes" defaultValue="">
<parameterEntry kind="TextFile" scope="main.*.js" match="__azureAdScopes__" />
</parameter>
<parameter name="Content Security Policy">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/system.webServer/httpProtocol/customHeaders/add[@name='Content-Security-Policy']/@value" />
</parameter>
</parameters>
12 changes: 0 additions & 12 deletions Enigmatry.Entry.Blueprint.Api/web.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,5 @@
<add name="Referrer-Policy" value="no-referrer" />
</customHeaders>
</httpProtocol>
<rewrite>
<outboundRules>
<rule name="Set CSP rules for index.html">
<match serverVariable="RESPONSE_Content_Security_Policy" pattern=".*" />
<conditions>
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</conditions>
<action type="Rewrite"
value="default-src 'none'; frame-ancestors 'none'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; connect-src 'self'" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -1417,13 +1417,17 @@
"type": "Project",
"dependencies": {
"Enigmatry.Entry.AspNetCore.Authorization": "[3.3.1, )",
"Enigmatry.Entry.Blueprint.App": "[1.0.0, )",
"Enigmatry.Entry.Blueprint.Domain": "[1.0.0, )",
"Enigmatry.Entry.Blueprint.Infrastructure": "[1.0.0, )",
"Enigmatry.Entry.CodeGeneration.Validation": "[17.0.0, )",
"Enigmatry.Entry.HealthChecks": "[3.3.1, )",
"Microsoft.ApplicationInsights.AspNetCore": "[2.22.0, )"
}
},
"enigmatry.entry.blueprint.app": {
"type": "Project"
},
"enigmatry.entry.blueprint.applicationservices": {
"type": "Project",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class SwaggerAuthenticationStartupExtensions
public static void AppUseSwaggerWithAzureAdAuth(this IApplicationBuilder app, IConfiguration configuration)
{
var aadOptions = configuration.GetSection(AuthenticationStartupExtensions.AzureAdSection).Get<MicrosoftIdentityOptions>()!;
app.UseEntrySwaggerWithOAuth2Client(aadOptions.ClientId!);
app.UseEntrySwaggerWithOAuth2Client(aadOptions.ClientId!, path: "/swagger");
}

public static void AppAddSwaggerWithAzureAdAuth(this IServiceCollection services, IConfiguration configuration, string appTitle)
Expand Down
2 changes: 1 addition & 1 deletion Enigmatry.Entry.Blueprint.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Enigmatry.Entry.Blueprint.A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Enigmatry.Entry.Blueprint.Domain.Tests", "Enigmatry.Entry.Blueprint.Domain.Tests\Enigmatry.Entry.Blueprint.Domain.Tests.csproj", "{1CC1BD9F-6D40-42AA-97F2-937AF2AD0B70}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Enigmatry.Entry.Blueprint.App", "enigmatry-entry-blueprint-app\Enigmatry.Entry.Blueprint.App.csproj", "{798EB599-36B3-4855-86D6-9ADD8EE266B5}"
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "Enigmatry.Entry.Blueprint.App", "enigmatry-entry-blueprint-app\Enigmatry.Entry.Blueprint.App.esproj", "{798EB599-36B3-4855-86D6-9ADD8EE266B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Enigmatry.Entry.Blueprint.ApplicationServices", "Enigmatry.Entry.Blueprint.ApplicationServices\Enigmatry.Entry.Blueprint.ApplicationServices.csproj", "{E81F6E69-85ED-4768-9DFF-10E0D94AE0F4}"
EndProject
Expand Down
32 changes: 5 additions & 27 deletions Pipelines/deploy-to-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@ jobs:
- template: take-web-app-offline.yml@templates
parameters:
jobName: 'take_web_app_offline'
displayName: 'Take Angular App offline'
displayName: 'Take Web App offline'
environment: ${{ parameters.environment }}
subscription: ${{ parameters.serviceConnection }}
webAppName: $(webAppName)

- template: take-web-app-offline.yml@templates
parameters:
jobName: 'take_api_offline'
displayName: 'Take API offline'
environment: ${{ parameters.environment }}
subscription: ${{ parameters.serviceConnection }}
webAppName: $(webAppName)
virtualApplication: 'api'

- template: take-web-app-offline.yml@templates
parameters:
jobName: 'take_scheduler_offline'
Expand All @@ -34,7 +25,6 @@ jobs:
displayName: 'Update the database'
dependsOn:
- take_web_app_offline
- take_api_offline
- take_scheduler_offline
environment: ${{ parameters.environment }}
migrationConnectionString: $(migrationConnectionString)
Expand All @@ -53,33 +43,21 @@ jobs:

- template: deploy-web-app.yml@templates
parameters:
jobName: 'deploy_angular_app'
jobName: 'deploy_web_app'
artifactName: $(artifactName)
displayName: Deploy the Angular web app
displayName: Deploy the Web app
dependsOn:
- deploy_scheduler #must be after scheduler since they are deployed into same webApp (this is Blueprint specific only)
environment: ${{ parameters.environment }}
packageName: $(projectNamePrefix).App
subscription: ${{ parameters.serviceConnection }}
webAppName: $(webAppName)
publishProfilePostfix: app

- template: deploy-web-app.yml@templates
parameters:
jobName: 'deploy_api'
artifactName: $(artifactName)
displayName: Deploy the BackEnd API
environment: ${{ parameters.environment }}
packageName: $(projectNamePrefix).Api
subscription: ${{ parameters.serviceConnection }}
webAppName: $(webAppName)
publishProfilePostfix: api
virtualApplication: api
publishProfilePostfix: app

- job: git_tag
displayName: Create Git tag
dependsOn:
- deploy_api
- deploy_web_app
- deploy_scheduler
steps:
- checkout: self
Expand Down
Loading

0 comments on commit e125406

Please sign in to comment.