Skip to content

Spike: Marain Deployment vNext#374

Draft
JamesDawson wants to merge 48 commits intomainfrom
feature/dapr-erp-poc
Draft

Spike: Marain Deployment vNext#374
JamesDawson wants to merge 48 commits intomainfrom
feature/dapr-erp-poc

Conversation

@JamesDawson
Copy link
Copy Markdown
Contributor

@JamesDawson JamesDawson commented Jan 5, 2022

(not intended to be merged in the current form)

Marain Deployment vNext Spike

This branch contains PoC deployment work that builds on some earlier work, including:

Overview

  • Targets hosting in Azure Container Apps rather than Azure Functions
  • ARM deployment migrated to Bicep:
    • Marain.Instance orchestrated in deploy-instance.ps1
      • Includes: Container App Environment, optional ACR, shared key vault & app config store, published config/secrets
    • Marain.Tenancy orchestrated in deploy-tenancy.ps1
      • Includes: Storage, container app, published config/secrets
    • Initial set of reusable Bicep modules
    • Intended to easily support use of existing Azure services (cross-subscription) or provisioning dedicated instances:
      • Container App Environment
      • Azure Container Registry
      • App Configuration Store
    • Support for using a single Marain key vault or the current vault per service approach
    • Aims to minimise the need to pass secrets in or out of the ARM deployment
  • Uses Corvus.Deployment and InvokeBuild as basis for the deployment process
  • Opinonated config management approach as per Corvus.Deployment:
    • common.ps1 - shared settings across all environments
    • sample.ps1 - a sample environment using a MPN subscription
    • ARM deployment publishes required config to Key Vault and App Configuration

Build

An initial build (using Endjin.RecommendedPractices.Build) has been setup and extended to produce a suitable container image.

Endjin.RecommendedPractices

The erp folder is a placeholder for elements that, if retained, could be extracted into separate Endjin.RecommendedPractices.* repositories:

Testing the spike

The deployment of the Marain Instance and Marain Tenancy infrastructure & services can be run as follows:

az login
az account set -s <subscription-id>
Connect-AzAccount
Set-AzContext -SubscriptionId <subscription-id>
./Solutions/deploy-runner.ps1 -Environment sample -StackName <your-initials> -ServiceInstance i1

You can also experiment with different configurations by modifying a copy of the sample.ps1 configuration script.

Comment thread deploy-spike.md Outdated
JamesDawson and others added 6 commits January 5, 2022 17:20
Add docker compose support
Had wrong property names, and a spurious comma.

Also added in swagger endpoint.
Conflicts:
        .gitignore
	GitVersion.yml
	Solutions/Marain.Tenancy.Cli/Marain.Tenancy.Cli.csproj
	Solutions/Marain.Tenancy.Cli/packages.lock.json
	Solutions/Marain.Tenancy.Client/Marain.Tenancy.Client.csproj
	Solutions/Marain.Tenancy.ClientTenantProvider/Marain.Tenancy.ClientTenantProvider.csproj
	Solutions/Marain.Tenancy.Host.AspNetCore/Dockerfile
	Solutions/Marain.Tenancy.Host.AspNetCore/Marain.Tenancy.Host.AspNetCore.csproj
	Solutions/Marain.Tenancy.Host.AspNetCore/Program.cs
	Solutions/Marain.Tenancy.Host.AspNetCore/Startup.cs
	Solutions/Marain.Tenancy.Host.AspNetCore/appsettings.Development.json
	Solutions/Marain.Tenancy.Host.Functions/Marain.Tenancy.Host.Functions.csproj
	Solutions/Marain.Tenancy.Host.Functions/packages.lock.json
	Solutions/Marain.Tenancy.Hosting.AspNetCore/Marain.Tenancy.Hosting.AspNetCore.csproj
	Solutions/Marain.Tenancy.Hosting.AspNetCore/Microsoft/Extensions/DependencyInjection/TenancyServiceCollectionExtensions.cs
	Solutions/Marain.Tenancy.Hosting.AspNetCore/Microsoft/Extensions/DependencyInjection/TenancyStorageServiceCollectionExtensions.cs
	Solutions/Marain.Tenancy.OpenApi.Service/Marain.Tenancy.OpenApi.Service.csproj
	Solutions/Marain.Tenancy.Specs/Marain.Tenancy.Specs.csproj
	Solutions/Marain.Tenancy.Specs/packages.lock.json
	Solutions/Marain.Tenancy.sln
	build.ps1

B
B
B
B
B
B
B
Comment thread Dockerfile Outdated
Comment thread Dockerfile Outdated
Comment thread GitVersion.yml Outdated
Comment thread README.md

### Local Development

You need a `local.settings.json` file - use `local.settings.template.json` which you can copy or rename.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for functions. Howard was adding an ASP.NET Core host, which uses the more straightforward appsettings.json stuff instead of the slightly idiosyncratic functions-specific local.settings.json.

In any case, this should say where this file goes.

Comment thread README.md
Comment on lines +19 to +30
"RootTenantBlobStorageConfigurationOptions__AccountName": "",
"RootTenantBlobStorageConfigurationOptions__RootTenantBlobStorageConfiguration__KeyVaultName": "",
"RootTenantBlobStorageConfigurationOptions__RootTenantBlobStorageConfiguration__AccountKeySecretName": ""
```

The quickest way to get started is to put a full storage account connection string in `RootTenantBlobStorageConfigurationOptions__AccountName`

You can use development storage emulator:

```
"RootTenantBlobStorageConfigurationOptions__AccountName": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of date with how things are now on main. For dev storage, this works:

    "TenantCacheConfiguration__GetTenantResponseCacheControlHeaderValue": "max-age=300",

    "RootBlobStorageConfiguration__ConnectionStringPlainText": "UseDevelopmentStorage=true"

So there are a couple of important changes:

  1. it's now all under RootBlobStorageConfiguration, not RootTenantBlobStorageConfigurationOptions
  2. we're now using the current corvus tenancy bits, which have removed the old weirdness in which AccountName was sometimes interpretted as a connection string (and it means that if you are using KeyVault it looks a bit different now)

Comment on lines +69 to +70
// SP
objectId: '8ec5ab5b-89e6-4afb-90de-7a502574e9fa'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which service principal is this? Is it the managed identity of the function app? If so, we want this to be determined dynamically don't we?

Comment thread Solutions/Marain.Tenancy.Host.AspNetCore/Dockerfile Outdated
@@ -0,0 +1,23 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this just for VS's benefit? Or is this also used to build deployable artifacts?

Comment thread Solutions/Marain.Tenancy.Host.AspNetCore/Startup.cs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marain.Tenancy.OpenApi.Service", "Marain.Tenancy.OpenApi.Service\Marain.Tenancy.OpenApi.Service.csproj", "{CFD86B72-E715-4C79-A5B5-A86648617581}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marain.Tenancy.Host.Functions", "Marain.Tenancy.Host.Functions\Marain.Tenancy.Host.Functions.csproj", "{5029BF20-64FE-438A-B8BC-DC6E1E1EAFAB}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are we dropping functions entirely as an option? (If so, the readme definitely shouldn't be discussing local.settings.json)

Conflicts:
	.gitignore
	Solutions/Marain.Tenancy.Host.AspNetCore/Marain.Tenancy.Host.AspNetCore.csproj
	Solutions/Marain.Tenancy.Host.AspNetCore/Program.cs
	Solutions/Marain.Tenancy.Host.AspNetCore/Startup.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants