gabrewer.com

Life is too important to be take seriously.

Tuesday, January 2, 2024 at 6:43 PM UTC

.Net Aspire Preview 2 with Dapr and the secretstore

In my recent SaaS personal projects, I’ve been exploring the capabilities of Dapr, based off of the eShopOnDapr sample. Dapr, with its integrated APIs and best practices for building distributed applications, has significantly streamlined my development process. Learn more about Dapr.

I’ve also been incorporating architectural insights and best practices from YouTube channels like Milan Jovanovic, Nick Chapsas, and Codewrinkles. Their guidance has refinined my approach to these solutions especially around using MediatR, Vertical Slice architecture and performance. Check out their insights:

The release of .NET 8 introduced the .NET Aspire 8.0 Preview 1 - an opinionated, cloud-ready stack ideal for building observable, production-ready, distributed applications compatible with Dapr. View .NET Aspire on GitHub.

Integrating .NET Aspire into my projects was pretty straightforward. However, I encountered a few challenges, especially with Dapr configuration management across projects. I ended up copying the dapr config files into each projects. Aslo .NET Aspire Preview 1 lacked support for deploying Dapr components to Azure.

With the advent of Preview 2, which impoves supports Dapr, I successfully updated my projects. However, I faced a challenge with the secret store configuration:

var secretStore = builder.AddDaprComponent("gab-secretstore", "secretstores", new
DaprComponentOptions { LocalPath = "../dapr/components/" });

var apiService = builder.AddProject<Projects.gabMileage_Mileage_Api>("mileage-api")
.WithDaprSidecar()
.WithReference(secretStore);

This code snippet illustrates how Preview 2 allows specifying Dapr file locations, which was a game-changer in maintaining a centralized configuration. An initial oversight of omitting the trailing slash in the path led to a frustrating error “secret store is not configured”. In reviewing the logs of the Dapr sidecare revealed that the secretstore was not being loaded. Doing some debugging with the Aspire source provided the much-needed insight. Looking at the command line in the Aspire Dashboard showed that the resources path ommited the /component part of the path.

...
foreach (var componentReferenceAnnotation in componentReferenceAnnotations)
{
if (componentReferenceAnnotation.Component.Options?.LocalPath is not null)
{
var localPathDirectory = Path.GetDirectoryName(NormalizePath(componentReferenceAnnotation.Component.Options.LocalPath));

if (localPathDirectory is not null)
{
aggregateResourcesPaths.Add(localPathDirectory);
}
}
else if (onDemandResourcesPaths.TryGetValue(componentReferenceAnnotation.Component.Name, out var onDemandResourcesPath))
{
string onDemandResourcesPathDirectory = Path.GetDirectoryName(onDemandResourcesPath)!;

if (onDemandResourcesPathDirectory is not null)
{
aggregateResourcesPaths.Add(onDemandResourcesPathDirectory);
}
}

}
...

I’m currently developing a simplified version of these projects to experiment with new ideas before integrating them into production projects. You’re welcome to check out the progress and contribute your insights on my personal GitHub repository.

My journey with Dapr and .NET Aspire continues to be a learning curve. I’m excited to see how these tools evolve and how they can further enhance SaaS project development.

Saturday, August 4, 2018 at 3:39 AM UTC

Learning Current Angular Tool Best Practices

Over the last couple of weeks I have been diving back into Angular development using Angular 6 and ngrx.  One of the things that quickly became apparent is that now the best practices of installing JavaScript tools is to install them locally instead of globally to prevent version collisions.

When I first started I installed the angular cli globally and encountered this type of error when running many of the sample apps that I downloaded.

Your global Angular CLI version (6.0.8) is greater than your local version (1.7.3). The local Angular CLI version is used.

This didn’t seem to cause me an issues but still the error bugged me and when I was reading the book Angular 6 for Enterprise-Ready Web Applications by Doguhan Uluca he really drives home that you should keep the number of globally installed packages to a minimum.

I was able to find out what commands I had installed globally using this command

npm list -g --depth=0

Which showed I only had the angular cli and npm install globally.

So I was able to uninstall the global angular cli and get rid to the ugly warnings.

Doguhan also points our that you should use npm-windows-upgrade instead of using npm i -g npm to upgrade npm on Windows or you are going to run into npm corruption issues.

https://github.com/felixrieseberg/npm-windows-upgrade

Wednesday, May 25, 2016 at 3:39 AM UTC

Random Stuff I want to remember

Windows 10 Home password expiration.

Today I had a couple of Windows 10 Home machines had their passwords expire.

To turn off the Windows 10 password expiration

net accounts /maxpwage:0

From http://www.thewindowsclub.com/customizing-the-password-policy-in-windows-7

Upgrading npm on Windows

I was installing jspm on a new machine and after I installed node 4.3.1 it was running npm I was trying to upgrade npm.  I tried a bunch of different commands I found on stack overflow but this command from the npm site (I feel like Colonel Sanders looking for the Nashville Hot Chicken Recipe) did the trick on both Windows and the Mac.

npm install npm@latest –g

From*:* https://docs.npmjs.com/getting-started/installing-node

http-server

In my recent javascript library/framework exploration I found myself needing a quick way to server html without having to have gulp or more permanent web server.  I found http-server fits the bill nicely.

npm install –g http-server

http-server –o –c-1

-o opens browser window after starting the server

-c-1 disables caching

From: https://github.com/indexzero/http-server

Sunday, May 17, 2015 at 3:39 AM UTC

VisualStudio Code fix for icons not appearing

When VisualStudio code was announced I went out and installed it right away on my Mac and Windows machines.  One my home development machine I was unable to see the icons.  I was thinking that it was due to my 4K display and an High DPI issue but it turns out not to be the case.

image

In reading the Reacting to feedback, common issues, and our first update post on the Visual Studio Code bug it was due to the svg file extension being associated to something other than image/svg+xml in my case due to Inkscape it was set to application/svg.

image

Changing the Content Type to image/svg+xml made the icons visible.

image

There is a FAQ with several fixes and workarounds for Visual Studio Code at https://code.visualstudio.com/Docs/FAQ

Monday, December 15, 2014 at 3:39 AM UTC

Chocolatey Kickstarter Funded! A list of my current packages

The third (second successful) Kickstarter campaign that I pledged to the Chocolatey Kickstarter campaign was successfully funded.  I always like reading what tools other developers are using so to celebrate, I thought I would publish the packages I currently have installed.

I may have an issue with being obsessed with editors.

Editors

Atom Cross platform editor from github. The official Windows installation is delivered via Chocolatey.
linqpad4.install LinqPad essential editor for working with Linq and C# snippits.  It will be interesting to see if scriptcs can be integrated
SublimeText3.app SublimeText3 my goto text editor.  This package includes Package Control
SublimeText3.PowershellAlias Installs a powershell subl alias for sublimtetext
vim Still trying to grok vim.  Probably still resent it from the late 80s.
brackets Adobe open source editor.  Designed for web design.
notepadplusplus.install Before I discovered SublimeText this was my text editor of choice.  Now I usually only use it when I have character encoding issues with files. 

Close behind my obsession with editors is my love to learn new programming languages.

Languages

erlang One of the three languages I am currently getting acquainted with.  Used in CouchDB and RabbitMQ.
golang One of the three languages I am currently getting acquainted with.
rust One of the three languages I am currently getting acquainted with.
ruby installs the current version of ruby.  Currently 2.1.3 mostly used for Sass
ruby1.9 Installs the latest 1.9 version of ruby
pik Helps manage multiple versions of Ruby on Windows
python2 Installs the latest version of python 2
python3 Installs the latest version of python 3
scriptcs Interesting REPL for C#.  Originally started by Glenn Block
pscx PowerShell Community Extensions (PSCX) is aimed at providing a widely useful set of additional cmdlets, providers, aliases, filters, functions and scripts for Windows PowerShell that members of the community have expressed interest in.
nodejs.install latest version of node

Databases

mysql Latest version of mySql
mysql.workbench Latest version of mySql Workbench
mongodb Latest version of mongodb

Programming Utilities

baretail great tool for viewing text log files on Windows
dependencywalker oldie but still necessary when trying to track down missing dependencies in c++ dlls
beyondcompare great cross platform file comparison tool
git.install Latest version of git
githubforwindows Latest github for Windows
smtp4dev Utility for capturing emails sent during development
SourceCodePro My new font of choice for code
fiddler4 Essential tool for debugging and testing web services and monitoring web traffic
InnoSetup Free tool to create setup programs
InstEd MSI editor, Better than trying to find orca

Utilities

ConEmu Great Windows console emulator.
EthanBrown.ConEmuConfig Great initial settings for ConEmuConfig
7zip.install Free file archiver with support for unpacking most compression formats
7zip.commandline command line utility for 7-zip
autohotkey.install Free open source macro creation and automation software
autoit.commandline comes with github
scite4autohotkey AutoHotkey script editor
cdburnerxp Free CD/DVD burner application.  Also lets you create Isos
crystaldiskinfo Show the health status of hard drives
winsplit Utility that is great for managing windows on a 4K display
pidgin multiple chat network client
ditto Advanced clipboard manager
dropbox I mostly use OneDrive but occasionally use dropbox
filezilla Simple and full featured ftp client.
flashplayerplugin Easy way to keep flash player updated
virtualbox latest VirtualBox install
virtualbox.extensionpack and extensions
windirstat a good way to find out where all your space went.
WindowsLiveWriter still my favorite blog editor
PreCode.WLW code formatting plugin for Windows Live Writer
sumatrapdf.install Free pdf, epub, mobi, and other ebook reader
teamviewer Great cross platform remote access program
truecrypt Free open-source disk encryption software for Windows – 7.1a
vcredist2010 Visual Studio runtime
yumi Universal multibook installer
puretext Paste text as pure text

Media Utilities

Ghostscript.app A package of apps to work with postscript files
audacity Free software for recording and editing sound files
handbrake.install A tool for converting video from nearly any format to a selection of modern, widely supported codecs.
ffmpeg Converts any media file to any other media type
paint.net Replaces most of what I use Adobe Photoshop for. 
gimp Still trying to get used to this program after all these years but since I decided to cut my Adobe Creative Cloud Subscription it works well enough for the occasions when I need more than paint.net
inkscape –pre Adobe Illustrator replacement
vlc Plays anything thrown at it