Coder Social home page Coder Social logo

initializrconfig's People

Contributors

ccheetham avatar kenswan avatar shawkyz avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

initializrconfig's Issues

Suggested logging levels

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"
    }
  }
}
  • Call out Steeltoe
  • Call out the project's namespace

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.

Create a visual studio experience to install Steeltoe projects

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.

.NET 5.0 projects should use 5.x Microsoft libraries

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>

Steeltoe 3.0.x templates failing with syntax error related to circuit-breaker

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()

Adding Circuit Breaker adds too many dependencies

@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>

InitializeDbContexts is poor for template

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.

specifying all dependencies results in compile error related to Npgsql version

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

.NET docker incorrect and out of date

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"]
  • This should have targeted the net5 base image, not 3.1
  • Microsoft moved most of the .net repos (dotnet/dotnet-docker#2375) and soon these images won't work

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"]

Azure Spring Cloud versioning is incorrect in staging area

Azure Spring Cloud version should be like this

  • All require .NETCore 3.x+
  • Azure SDK 1.0.x should be used with Steeltoe 2.x only
  • Azure SDK 2.x should be used with Steeltoe 3.x+

Currently, they are all using Azure SDK 2.x, which will not work.

Missing dependency for Eureka Discovery Client

Describe the bug

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

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

Expected behavior

I expected to see my app registered in Eureka (http://localhost:8761).

Environment (please complete the following information, if applicable):

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context or links

Add any other context about the problem here.

ValidateScopes in generated template

@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.

Checkbox for creating a solution automatically upon Generate Project

Is your feature request related to a problem? Please describe.

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.

Describe the solution you'd like

I would like to have an option (checkbox) near "Generate Project" to enable to create a solution as well when I click Generate Project.

Describe alternatives you've considered

Alternatives would be to

  1. Create a solution
  2. Generate project
  3. Import project into the solution

Additional context

Add any other context, code snippets, or examples of the feature here.

use floating versions for library dependencies

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.

Missing "add" statement for MsSQL dependency and packages need to be corrected

Describe the bug

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>
  • Why is the CloudFoundry package included?
  • Swap the using statement in startup.cs
    Remove: using Steeltoe.Connector.SqlServer.EFCore;
    Add: using Steeltoe.Connector.SqlServer;

sqlserver dependency fails to build for netcoreapp3.1 and net5.0

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

Update Microsoft Docker repo location

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.