Hulkstance
❔ Terraform Azure Modules Template
Hey guys,
I'm going to deploy an ASP.NET Core Web API in Azure using Terraform and I wonder if there are any
modules
templates for the following services:
- App Service (+ static public IP address, not sure if I need to setup virtual network for it yet)
- Key Vault
- App Configuration
- Application Insights
- Event Hub
- Service Bus
- SQL Database
My K8s setup:
- ACR
- AKS
- Application Gateway
Is there a GitHub template which includes pre-defined modules for the listed services above?
Best I could find was https://github.com/Azure/azure-data-labs-modules but it is missing App Configuration, App Service and a few more.2 replies
❔ Key Vault + AppConfiguration usage
In my past I've been using it as following:
- Secret configuration values, like passwords, connection strings, or API keys are added to Azure KeyVault. References to these values should be placed in the Azure AppConfiguration
- Configuration values specific to a single service should be placed in the appsettings.json or appsettings.{ENVIRONMENT}.json file for that service
- Shared configuration values among services should be added to Azure AppConfiguration
So I wonder what's opinion on that. How do you use it?
https://learn.microsoft.com/en-us/azure/azure-app-configuration/use-key-vault-references-dotnet-core?tabs=core6x
8 replies
❔ Application Insights Health Checks
I'm trying to find the docs for Application Insights Health Checks. https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core?tabs=netcorenew%2Cnetcore6#use-applicationinsightsserviceoptions
I already have it setup with User Secrets which I'm going to move to Key Vault in a bit. I also added
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
and builder.Services.AddApplicationInsightsTelemetry(builder.Configuration);
and it worked out of box.
However, I remember there used to be something like:
but I don't see it in the docs.14 replies
❔ Column names in each table must be unique. Column name x in table y
There is an Azure SQL db with 10 DTUs and migrations are broken with the following message:
Column names in each table must be unique. Column name 'OrphanedBalance' in table 'Transactions.MarketTransaction' is specified more than once.I renamed 'OrphanedBalance' to something else and I still keep getting the same error message which is really weird. I believe that might be due to some schema caching. Then I exported that database from Azure as a .bacpac file using Azure Data Studio (Data-Tier Application) and imported it locally and it worked fine locally. Any idea what's going on? (edited) June 22, 2023
2 replies
❔ EF Core "upsert" - insert if it doesn't exist, update if it does
I'm trying to "optimize" the command below.
The term upsert is a combination of the words “update” and “insert.” In the context of relational databases, an upsert is a database operation that will update an existing row if a specified value already exists in a table, and insert a new row if the specified value doesn't already exist.There are only two tables (the database structure can be find below), and there are different event types for which we have these three booleans. Administrators can change these global notification settings on demand. If the record for a specific event type id doesn't exist, it should load it at runtime. Since these settings can be updated concurrently by many administrators at the same time, I think I should handle DbUpdateConcurrencyException https://github.com/petercwq/EFCorePractice/blob/master/EFCorePractice/DbContextConcurrencyExtension.cs. What do you think? I'm not so good at EF Core, so I would like to know your opinion. I also had a look at https://stackoverflow.com/questions/5557829/update-row-if-it-exists-else-insert-logic-with-entity-framework and I feel like instead of using a stored procedure or an atomic transaction, I could use Update which cuts off the round trips to the database? I mean I wouldn't need to do .FindAsync and then insert/update.
4 replies
❔ FluentValidation on startup
What's not okay so that it fails with:
Unhandled exception. System.InvalidOperationException: No service for type 'FluentValidation.IValidator`1[Sts.MarketData.Api.Models.BinanceConfiguration]' has been registered.
5 replies
❔ Rx.NET issue
This is a minimal reproducible example of request/response model (like HTTP) but over websockets.
What it technically does is push values to
Details
until DetailsEnd
or Error
is received for that particular request ID.
It works as expected, excluding the part with the timeout and errorSignal
. How do I make it return Result<IEnumerable<Details>>.FromError(new Error(123, "asd", null));
in case of a timeout or an error?
https://dotnetfiddle.net/vCTQqw2 replies
❔ Sockets - TCP
I'm going to implement a TCP listener for RF-V48 (4G GPS Tracking Bracelet) for elders. The device is technically a TCP client with its own protocol.
An example for the positioning data:
Server sends:
[CS*YYYYYYYYYY*LEN*CR]
e.g.: [SG*5678901234*0002*CR]
Tracker returns:
[CS*YYYYYYYYYY*LEN*CR]
e.g.: [SG*5678901234*0002*CR]
Which library would you rather choose?
1) https://github.com/davidfowl/BedrockFramework/tree/main
2) https://github.com/Azure/DotNetty
David Fowler pretty much explained why a library is better to use rather than implementing it all yourself https://speakerdeck.com/davidfowl/project-bedrock2 replies
❔ ProtoBuf cannot find imports
I've been struggling for a few hours with ProtoBuf.net imports.
protobuf-net.BuildTools
should technically generate the c# code, but it's unable to find the imports for some reason. What might be wrong?
https://github.com/Hulkstance/aquarius/blob/main/src/Sts.Aquarius.Connector/Sts.Aquarius.Connector.csproj#L182 replies
❔ DynamoDB records are not being added
Do you see anything wrong because
CreateAsync
returns status code 200, but nothing really is being added.
DI
Code is a bit long and unable to paste it here:
https://hastebin.com/huwixopaja.csharp4 replies
❔ Lazy initialization question
Lazy initialization is usually used whereby you only load or initialize an object when you first need it.
The question is how do I know if I need it here:
_jetStreamFactory = new Lazy<IJetStream>(() => _connection.CreateJetStreamContext());
?
2 replies