steeltoeoss / initializrconfig Goto Github PK
View Code? Open in Web Editor NEWConfiguration store for Steeltoe.Initializr.ConfigServer
License: Apache License 2.0
Configuration store for Steeltoe.Initializr.ConfigServer
License: Apache License 2.0
@macsux commented on Thu Nov 19 2020
The template is disabling DI scope validation by default which is not something most people want
.UseDefaultServiceProvider(configure => configure.ValidateScopes = false)
When you create a new webapi the default logging levels and packages to monitor are pretty basic. Initializr can go a bit deeper because it knows more about what the project is doing. I suggest adding in some additional logging packages as a default to all projects Initializr creates in appsettings.json.
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information",
"Steeltoe": "Information",
"example_app": "Debug"
}
}
}
PS - It would be nice to include different appsettings for different environments (appSettings.Development.json). Then you could adjust the logging levels of each package for the given context.
@macsux commented on Thu Nov 19 2020
Adding MySQL EFCore does not configure Startup file to register it into DI container
Need a hostname to resolve to staging cluster public IP, currently http://52.252.76.164/.
@macsux commented on Thu Nov 19 2020
There are multiple libraries that add circuit breaker pattern to code, and TBH Polly is significantly more popular and easier to use then Steeltoe Hystrix version. This will help differentiate the two and offer both.
Only top level files are shown in initializer preview when clicking Explore
button. Should show subfolders and files in them.
Visual studio extension to create project from templates.
Currently there is no support from dotnet core templates for vs wizard for new projects.
However yeoman for net has a way to do this . we can imitate this by running dotnet cli behind the scenes.
As example, following is generated for net5.0
project with a mysql-efcore
dependency:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup >
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Steeltoe.Connector.EFCore" Version="3.0.2" />
<PackageReference Include="Steeltoe.Extensions.Logging.DynamicLogger" Version="3.0.2" />
<PackageReference Include="Steeltoe.Management.CloudFoundryCore" Version="3.0.2" />
</ItemGroup>
</Project>
The InitializrApi server is failing with Steeltoe 3.0.2 project requests due to a syntax error when loading the mustache templates. The syntax error looks related to circuit-breaker
blocks.
Sample for InitializrApi logs:
fail: Microsoft.AspNetCore.Server.Kestrel[13] │
│ Connection id "0HM7BLRAMOFQ2", Request id "0HM7BLRAMOFQ2:0000003E": An unhandled exception was thrown by the application. │
│ Stubble.Core.Exceptions.StubbleException: Unopened Block 'circuit-breaker' at 4362 │
│ at Stubble.Core.Parser.Processor.ProcessTemplate(StringSlice content) │
│ at Stubble.Core.Parser.MustacheParser.Parse(String text, Tags startingTags, Int32 lineIndent, ParserPipeline pipeline) │
│ at Stubble.Core.Parser.CachedMustacheParser.Parse(String text, Tags startingTags, Int32 lineIndent, ParserPipeline pipeline) │
│ at Stubble.Core.StubbleVisitorRenderer.Render(String template, Object view, IDictionary`2 partials, RenderSettings settings) │
│ at Steeltoe.InitializrApi.Generators.StubbleProjectGenerator.GenerateProject(ProjectSpec spec) in /source/src/InitializrApi/Generators/StubbleProjectGenerator.cs:line 135 │
│ at Steeltoe.InitializrApi.Controllers.ProjectController.GetProjectArchive(ProjectSpec spec) in /source/src/InitializrApi/Controllers/ProjectController.cs:line 132 │
│ at lambda_method(Closure , Object , Object[] ) │
│ at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) │
│ at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() │
│ at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) │
│ at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
@macsux commented on Thu Nov 19 2020
Adding circuit breaker seems to assume you want metrics streaming over RabbitMQ, which is a big dependency and would not be needed for just using hystrix.
<ItemGroup Condition="'$(BUILD)' == ''">
<PackageReference Include="Steeltoe.CircuitBreaker.Hystrix.MetricsStreamCore" Version="3.0.1" />
<PackageReference Include="RabbitMQ.Client" Version="5.1.0" />
</ItemGroup>
<ItemGroup Condition="'$(BUILD)' == 'LOCAL'">
<PackageReference Include="Steeltoe.CircuitBreaker.Hystrix.MetricsEventsCore" Version="3.0.1" />
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />
</ItemGroup>
Adding EFCore adds a startup method to initialize/seed database on startup. This seems to be more of sample code rather than something that should be used as starting point for any real application. It encourages bad practices like migrating on startup. Migrating on startup can be very lengthy and can cause container orchestrator to kill the app because it things it fails to startup in reasonable limits. Migrations should be explicit tasks that are invoked via actuator or task.
Recommend moving towards EF Migrations with Steeltoe Task based invocation to call migrations.
Regardless of Steeltoe/framework versions, selecting all dependencies results in a compile error related to Npgsql version.
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
/tmp/Steeltoe.Initializr.ApiTests/2.5.2--netcoreapp3.1--ALL/Sample/Sample.csproj : error NU1605: Detected package downgrade: Npgsql from 4.1.8 to 4.0.11. Reference the package directly from the project to select a different version.
/tmp/Steeltoe.Initializr.ApiTests/2.5.2--netcoreapp3.1--ALL/Sample/Sample.csproj : error NU1605: Sample -> Npgsql.EntityFrameworkCore.PostgreSQL 3.1.11 -> Npgsql (>= 4.1.8)
/tmp/Steeltoe.Initializr.ApiTests/2.5.2--netcoreapp3.1--ALL/Sample/Sample.csproj : error NU1605: Sample -> Npgsql (>= 4.0.0)
Failed to restore /tmp/Steeltoe.Initializr.ApiTests/2.5.2--netcoreapp3.1--ALL/Sample/Sample.csproj (in 5.66 sec).
Build FAILED
Misspelled logging parameter in appsettings is causing scaffolded controller not to produce proper log level value
Steeltoe3ForASC.csproj Line 8
Add our package reference to 2.0.0-preview.1
Program.cs Line 2
Add using Microsoft.Azure.SpringCloud.Client;
Program.cs Line 16
Add .UseAzureSpringCloudService()
(must be added before any other steeltoe configurations to inject our certificates)
Sample is attached:
Steeltoe3ForASCHelloWorld.zip
@macsux commented on Thu Nov 19 2020
Adding actuators makes them CloudFoundry dependent. This should be a generic version, and a separate CF specific actuator dependency introduced.
When SteeltoeInitializr.yaml changes are pushed to a branch, a system test against the InitializrApi associated with the branch should be triggered/run.
Provide service registrations in Startup.cs - ConfigureServices method that will allow users to quickly retrieve Cloud Foundry application configurations.
public void ConfigureServices(IServiceCollection services)
{
...
services.ConfigureCloudFoundryOptions(Configuration);
}
Steeltoe References
Getting Started Guides- App Configuration with Cloud Foundry
Samples - SimpleCloudFoundry - Startup.cs
When I created a project targeting net5.0 with the docker dependency I got
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY ["example_app.csproj", "."]
RUN dotnet restore "example_app.csproj"
COPY . .
RUN dotnet build "example_app.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "example_app.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "example_app.dll"]
Here is what I was hoping for
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["example_app.csproj", "."]
RUN dotnet restore "example_app.csproj"
COPY . .
RUN dotnet build "example_app.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "example_app.csproj" -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "example_app.dll"]
@macsux commented on Thu Nov 19 2020
Adding PostgreSQL EFCore DI causes registration to be commented out in startup file. It also add comment that is very Cloud Foundry specific
Staging area needs a public DNS entry
Each component needs a minimum of 2 instances.
@macsux commented on Thu Nov 19 2020
Adding Spring Cloud Config Server
adds <PackageReference Include="Steeltoe.Extensions.Configuration.config-serverCore" Version="3.0.1" />
which is invalid package
Azure Spring Cloud version should be like this
Currently, they are all using Azure SDK 2.x, which will not work.
When I add Eureka Discovery Client as a dependency in my project, there is a package reference missing and Steeltoe defaults to NoOp. The project should have <PackageReference Include="Steeltoe.Discovery.Eureka" Version="3.0.2" />
which will tell Steeltoe to look for Eureka.
Steps to reproduce the behavior:
1.https://start.steeltoe.io/#!name=Eureka_Register_Example&namespace=Eureka_Register_Example&applicationName=Eureka_Register_ExampleApplication&description=Eureka_Register_Example%20application%20project&steeltoeVersion=3.0.2&dotNetFramework=netcoreapp3.1&dotNetTemplate=webapi&language=csharp&packaging=zip&dependencies=eureka-client
2. docker run --publish 8761:8761 steeltoeoss/eureka-server
3. dotnet run Eureka_Register_Example.csproj
I expected to see my app registered in Eureka (http://localhost:8761).
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
@kimbell commented on Sat Nov 07 2020
I created an app using the beta web generator at https://start.steeltoe.io
When I looked at the generated code, I noticed a line in program.cs
.UseDefaultServiceProvider(configure => configure.ValidateScopes = false)
What is the reasoning for disabling scope validation? It was added in .NET Core 2.0 to avoid DI mistakes.
@hananiel commented on Tue Nov 17 2020
This was a temporary workaround for a bug we had. This will be removed in the new initializr.
As I get started with creating a new solution and project with Steeltoe Initializr, today I have to create my solution and import the project into the solution.
I would like to have an option (checkbox) near "Generate Project" to enable to create a solution as well when I click Generate Project.
Alternatives would be to
Add any other context, code snippets, or examples of the feature here.
Library versions in templates are currently fully qualified. E.g., RabbitMQ.Client
is pinned to version 5.1.0. At some point, pinned versions become outdated.
The version specs should instead use floating notation; e.g. the above RabbitMQ version should be 5.1.*. Generated projects will then be able to pull in the latest released versions of the dependent libraries.
When creating a project for "Microsoft SQL Server", the startup class is missing the statement services.AddSqlServerConnection(Configuration);
in the ConfigureServices class.
Currently the project has
<ItemGroup >
<PackageReference Include="Steeltoe.Connector.ConnectorCore" Version="3.0.2"/>
<PackageReference Include="Steeltoe.Connector.CloudFoundry" Version="3.0.2"/>
<PackageReference Include="Steeltoe.Connector.EFCore" Version="3.0.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.*" />
</ItemGroup>
It should be
<ItemGroup >
<PackageReference Include="Steeltoe.Connector.ConnectorCore" Version="3.0.2"/>
<PackageReference Include="System.Data.SqlClient" Version="4.8.*" />
</ItemGroup>
using Steeltoe.Connector.SqlServer.EFCore;
using Steeltoe.Connector.SqlServer;
The following should produce an error and not a starter project.
curl -o starter.zip https://start.steeltoe.io/starter.zip -d dependencies=nosuchdep
The Spring starter returns a 404 for such a request
Specifying sqlserver
dependency ultimately results in a compilation error. Sample from Linux:
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Controllers/ValuesController.cs(15,26): error CS1069: The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly. [/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Sample.csproj]
/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Controllers/ValuesController.cs(16,48): error CS1069: The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly. [/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Sample.csproj]
Build FAILED.
/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Controllers/ValuesController.cs(15,26): error CS1069: The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly. [/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Sample.csproj]
/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Controllers/ValuesController.cs(16,48): error CS1069: The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly. [/tmp/Steeltoe.Initializr.ApiTests/3.0.2--netcoreapp3.1--sqlserver/Sample/Sample.csproj]
0 Warning(s)
2 Error(s)
To reproduce:
$ http https://start.steeltoe.io/api/project dependencies==sqlserver -d
$ unzip Sample.zip
$ dotnet build Sample
The repos:
mcr.microsoft.com/dotnet/core/aspnet
and mcr.microsoft.com/dotnet/core/sdk
are now
mcr.microsoft.com/dotnet/aspnet
and mcr.microsoft.com/dotnet/sdk
Initializr should no longer generate projects for Steeltoe 2.4.x
Reorder Steeltoe versions and .NET framework versions to be most-recent first.
Ie., go from:
netcoreapp2.1, netcoreapp3.1, net5.0
to net5.0, netcoreapp3.1, netcoreapp2.1
The description for Steeltoe 2.5.2 references Steeltoe 2.5.1
@macsux commented on Thu Nov 19 2020
Actuators should not bring serilog dynamic logger, only core dynamic logger.
@macsux commented on Thu Nov 19 2020
There's no reason to have Newtonsoft.Json as part of default template when ASP.NET Core brings it's own, lighter engine. This should be an optional dependency.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.