eShopOnContainers | NET sample microservices and container based application | Continuous Deployment library
kandi X-RAY | eShopOnContainers Summary
kandi X-RAY | eShopOnContainers Summary
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of eShopOnContainers
eShopOnContainers Key Features
eShopOnContainers Examples and Code Snippets
Community Discussions
Trending Discussions on eShopOnContainers
QUESTION
I am trying to implement something similar to EventBus implemented in eshopOnContainers.
Is it Possible to define a method like this in java & read the meta data about T and TH at runtime ? There can be multiple classes extending IntegrationEvent(e.g. PriceChangedEvent) & we should be able to Identify the exact class name at runtime.
...ANSWER
Answered 2022-Mar-05 at 19:22You can pass type info into method:
QUESTION
I am building an Azure web service using ASP.NET Core (C#, .NET 6). I have an Azure storage account. The storage account has two (2) access keys. The idea is that if the first key expires or needs to be changed, the application can seemlessly switch to the second key while operators renew the first key.
My application has a health check, and I would like to include a health check of the storage account. I took inspiration from this article: https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/monitor-app-health#healthchecks-implementation-in-eshoponcontainers
I wrote code like this, using NuGet package AspNetCore.HealthChecks.AzureStorage:
...ANSWER
Answered 2022-Jan-28 at 08:23I looked at the implementation of AspNetCore.HealthChecks.AzureStorage.
It is actually really simple. It just checks whether a blob container exists.
So I just did my own implementation using the same idea but retrying if the first key does not work. (I already had a generic way to retry an operation if the first key fails.)
QUESTION
I am currently following the tutorial for eShopOnContainers, and I decided to try to test out the GRPC functionality, similar to the project.
What I am trying to build is GRPC Client and GRPC Service, which are both hosted on docker and can talk to each other. Now, I managed to make it work, and if you look a the Startup.cs
in GRPC Client, this Uri http://host.docker.internal:5104
manages to make the call and get the response.
However, the original eshopOnContainers project uses the http://basket-api:81
path, which is much nicer and in my opinion more maintainable. It also uses few more components and some configuration:
- The GRPC Service uses the following in Startup.cs:
app.UsePathBase("/basket-api")
Original project
and some configuration in Program.cs to listen to ports:
ANSWER
Answered 2021-Aug-27 at 12:35You should be able to use docker generated DNS name from your docker-compose file. Your GRPC client should be able to reach the server on http://grpcserver:5103
With docker-compose you can talk between containers simply by using the name of the service and the port that you are exposing in the container.
[Edit] Removed the extension from the path because UsePathBase()
Adds a middleware that extracts the specified path base from request path and postpend it to the request path base.
QUESTION
I am currently learning how microservices work for an application i am building for my portfolio and for a small community of people that want this specific application. I have followed a tutorial online and successfully got IdentityServer4 to authenticate an MVC Client, however, I am trying to get swagger to work alongside the API's especially if they require authentication. Each time I try to authorize swagger with IdentityServer4, I am getting invalid_scope error each time I try authenticate. I have been debugging this problem for many hours an am unable to figure out the issue. I have also used the Microsoft eShopOnContainers as an example but still no luck. Any help would be greatly appreciated. Ill try keep the code examples short, please request any code not shown and ill do my best to respond asap. Thank you.
Identiy.API project startup.cs:
...ANSWER
Answered 2021-Mar-19 at 04:44The swagger client needs to access the api and to do so it requires api scopes. What you have for swagger scopes are not doing this. Change the scopes for swagger client ‘weatherswaggerui’ to include the api scopes like this:
AllowedScopes = {"weatherapi.read"}
QUESTION
tl;dnr
I can not get my docker-compose Envoy API gateway to properly forward to referenced services.
"Forwarded routes" always end up with the error:
...ANSWER
Answered 2021-Feb-28 at 14:32I'm going to give it a few more days, but I think I discovered the issues ... which appear to be fat-fingers, copy & paste.
- I removed the offending empty http2 options as mentioned in the above comment. This resolved in the clusters being a bit cleaner:
QUESTION
I am trying to work with .NET 5 to update my information. So I started to review the eShopOnContainers-ServicesAndWebApps project here.
I have read its older versions (2.2 and 3.1) that is a rich sample with a lot of fantastic points. But here in .NET 5, at first glance, in Program.cs
, I see a lot of methods and properties without any classes which I can't understand and make me confused. How can we have methods without class in a cs file?
ANSWER
Answered 2021-Feb-25 at 12:08It's a feature of C# 9: top-level statements
Top-level statements remove unnecessary ceremony from many applications.
Only one file in your application may use top-level statements. If the compiler finds top-level statements in multiple source files, it’s an error. It’s also an error if you combine top-level statements with a declared program entry point method, typically a Main method. In a sense, you can think that one file contains the statements that would normally be in the Main method of a Program class.
So you can now write a program that contains only this line of code:
QUESTION
First of all as for "simplified DDD/CQS pattern" I am referencing https://github.com/dotnet-architecture/eShopOnContainers example dotnet application (which is not "strict" DDD/CQRS). However I am not dotnet developer and my question is related to general design patterns / code organization.
My own case is as follows: I have "conference" domain with "conference" root aggregate and "conference_edition" aggregate. In RDBMS language conference has many editions. In this domain all "communication" with outside world is done through root aggregate "conference". So there are use cases like Conference.create(), Conference.addDraftEdition(), Conference.publishEdition() etc.
I have also "booking" domain which manages bookings for specific conference editions (people book tickets for a conference edition).
My question is related to the read model / aggregate of "conference" service (domain?). CMS of this application needs following read model for a conference (example in json for simplicity):
...ANSWER
Answered 2021-Feb-14 at 19:43Either of the first or second is reasonable. The choice between them will be heavily influenced by how much you want to spread business logic into infrastructure.
Since the conference and booking domains appear to be different bounded contexts, the third option is really only justifiable if there's some change to a conference edition that's only allowable if bookings are in a certain state.
QUESTION
It's a little bit difficult to explain, I apologies for that. But I need help. I'm working on generic approach for events. All my code base on eShopOnContainers example but my handlers should return a value.
In eShopOnContainers there is just Task
as a return type, so they can easy
ANSWER
Answered 2021-Jan-24 at 18:46To solve your problem a simple solution is to use dynamic
(see here).
QUESTION
I can see comment in each dockfile
Keep the project list and command dotnet restore identical in all Dockfiles to maximize image cache utilization
But I have confusion with,
- it would build the fast(due to caching) but does it not take extra space in container FS.
- And in future if I add new project in solution should I make to change every dockerfile.
Here https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/src/Services/Basket/Basket.API/Dockerfile basket-api docfile have copy command on projects.
...ANSWER
Answered 2021-Jan-05 at 18:27The reason for doing this is to take advantage of Docker's layer caching. Yes, there is maintenance overhead to ensure that the list here reflects the actual set of project files that are defined in the repo.
The caching optimization comes into play for iterative development scenarios (inner loop). In those scenarios, you're typically making changes to source code files, not the project files. If you haven't changed any project files since you last built the Dockerfile, you get to take advantage of Docker's layer caching and skip the restoration of NuGet packages for those projects, which can be quite time consuming.
Yes, there is a small amount of extra space being included in the container image because the project files end up getting copied twice which results in duplicate data amongst the two layers. But that's fairly small because project files aren't that big.
There are always tradeoffs. In this case, the desire is to have a fast inner loop build time at the expense of maintenance and a small amount of extra space in the container image.
QUESTION
After a lot of reading and wading through finnicky solutions to this problem, it's bizarre that projects are structured in this way and yet there doesn't seem to be a straight forward way of creating it.
A brilliant example is Microsoft's eShopOnContainers project - https://github.com/dotnet-architecture/eShopOnContainers
The repository has a physical src folder, when you open the eShopOnContainers-ServicesAndWebApps.sln - the solution explorer displays the src as if it were a logical folder.
I find that the .sln also lives in a peculiar place - directly within the src folder, it's almost like this .sln has been created manually and projects added to it as necessary.
The same is the case with the Services folder and its contents, each project lives as Services/Identity/Identity.API - this full structure displays in both file explorer and solution explorer, but when I attempt to recreate this I can 1 of 2 scenarios -
- I create the folder structure as physical folders and they do not display in the solution explorer.
- I create the folder structure as logical/solution folders and they do not display in the file explorer.
This doesn't seem possible via the projection create GUI, I imagine this has been done by creating the projects and structure via the dotnet CLI, but I can't seem to figure it out, how is this done?
...ANSWER
Answered 2020-Nov-18 at 20:11The solution to this via the Visual Studio GUI -
Create your logical folder structure as you see fit within Visual Studio, and then to have your physical folders match that structure - or even differ from it - create the path along with the project which you are creating, the file system will create the physical folders from the specified path and you will have achieved the desired effect.
Example:
Create C:\myproject\src\
Visual Studio -> File -> New -> Project -> Blank Solution (name: myprojectsolution)
Right click myprojectsolution -> Add -> New Solution Folder (name: src)
My the myprojectsolution.sln into C:\myproject\src\ then delete the myprojectsolution folder which was created with the .sln file.
Logical and Physical folders are now matching, the .sln lives directly in src, and src will display in the solution explorer.
At this point, let's say you want to create an Identity.IDP project at Microservices\Identity\Identity.IDP, with a matching logical and physical structure.
Visual Studio -> right click src -> Add -> New Solution Folder (name: Microservices)
Visual Studio -> right click Microservices -> Add -> New Solution Folder (named: Identity)
Visual Studio -> right click Identity -> Add -> New Project (name: Identity.IDP, location: C:\myproject\src\Microservices\Identity)
The above will result in a matching folder structure existing in both the solution explorer and the file explorer.
In summary - create your solution structure via the Visual Studio GUI, create your physical structure via specifying the path when creating the project.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install eShopOnContainers
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page