Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microservices eBook & Samples updated to .NET Core 2.2 #26

Open
nishanil opened this issue Jan 9, 2019 · 17 comments
Open

Microservices eBook & Samples updated to .NET Core 2.2 #26

nishanil opened this issue Jan 9, 2019 · 17 comments

Comments

@nishanil
Copy link

nishanil commented Jan 9, 2019

🎉We just published the v2.2 of the Microservices eBook.🎉

The new version covers the built-in health checks feature that was released in ASP .NET Core 2.2 and other updates from .NET Core 2.2.

Download: https://aka.ms/microservicesebook

The Reference Sample https://github.com/dotnet-architecture/eshopOnContainers is also updated.

cover-med

Do check them out and let us know your feedback!

Thank You!

@wdhastings
Copy link

wdhastings commented Jan 9, 2019

Working fine for me on docker compose, but failing on a local kubernetes deployment. The containers for both the webmvc and webspa will not run. I don't think they have to run on docker-compose but kubernetes will not keep the pods alive if the program exits.

Here's the error being thrown in the kubernetes log from webspa:

Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: url at Guard.ArgumentNotNullOrEmpty(String argumentName, String value) in /src/src/BuildingBlocks/HealthChecks/src/common/Guard.cs:line 21 at Microsoft.Extensions.HealthChecks.HealthCheckBuilderExtensions.AddUrlCheck(HealthCheckBuilder builder, String url, Func2 checkFunc, TimeSpan cacheDuration) in /src/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Checks/UrlChecks.cs:line 76
at Microsoft.Extensions.HealthChecks.HealthCheckBuilderExtensions.AddUrlCheck(HealthCheckBuilder builder, String url, TimeSpan cacheDuration) in /src/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Checks/UrlChecks.cs:line 23
at eShopConContainers.WebSPA.Startup.b__6_0(HealthCheckBuilder checks) in /src/src/Web/WebSPA/Startup.cs:line 49
at Microsoft.Extensions.DependencyInjection.HealthCheckServiceCollectionExtensions.AddHealthChecks(IServiceCollection services, Action1 checks) in /src/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/HealthCheckServiceCollectionExtensions.cs:line 27 at eShopConContainers.WebSPA.Startup.ConfigureServices(IServiceCollection services) in /src/src/Web/WebSPA/Startup.cs:line 42 --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at eShopConContainers.WebSPA.Program.Main(String[] args) in /src/src/Web/WebSPA/Program.cs:line 13

All other pods are running. Webstatus is reachable but is reporting all services as unhealthy.

Update: If you'd like to fix this, the problem is that you have incorrect URL strings in your Startup.cs. You're referencing strings with "HC" at the end, e.g. "PurchaseUrlHC" when those aren't defined in your config file.

@nishanil
Copy link
Author

nishanil commented Jan 9, 2019

@wdhastings We're looking into this right now. I will keep you posted.

@wdhastings
Copy link

@nishanil Thank you. I noticed that the basket service is also not working on kubernetes even though the service is up and reports healthy. It does work on docker-compose. I haven't had a chance to troubleshoot it, but I'll look later if you don't get to it.

@nishanil
Copy link
Author

@wdhastings It looks like our CI systems did not push newer images to Docker Hub. Can you check now?

@fabricioveronez
Copy link

Where is the ePub version ?

@wdhastings
Copy link

@nishanil All seems good now, at least on Edge. Chrome is giving me a security violation trying to load jquery:

Refused to load the script 'http://localhost/identity/lib/jquery/jquery.js' because it violates the following Content Security Policy directive: "script-src 'unsafe-inline'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

@wdhastings
Copy link

@nishanil I spoke too soon. I'm still getting a 500 error trying to add to the cart, even on Edge. The error returned is:

HTTP500: SERVER ERROR - The server encountered an unexpected condition that prevented it from fulfilling the request. (XHR)POST - http://localhost/webshoppingapigw/api/v1/basket/

The webstatus service is reporting all services as healthy. I'm sorry I don't have more time to investigate right now.

@nishanil
Copy link
Author

@fabricioveronez eReader formats will be available soon.

@nishanil
Copy link
Author

@fabricioveronez eReader formats are now available

https://aka.ms/microservicesebookmobi
https://aka.ms/microservicesebookepub

@neoAnkit
Copy link

@nishanil All seems good now, at least on Edge. Chrome is giving me a security violation trying to load jquery:

Refused to load the script 'http://localhost/identity/lib/jquery/jquery.js' because it violates the following Content Security Policy directive: "script-src 'unsafe-inline'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

did you get a fix on this?

@Roland1975
Copy link

@nishanil replace localhost by docker.for.win.localhost. This value is set in /src/.env

@neoAnkit
Copy link

@nishanil replace localhost by docker.for.win.localhost. This value is set in /src/.env

I am using linux container. Will this solution work there too?

right now my .env settings are:-
ESHOP_EXTERNAL_DNS_NAME_OR_IP=host.docker.internal
ESHOP_STORAGE_CATALOG_URL=http://host.docker.internal:5202/c/api/v1/catalog/items/[0]/pic/
ESHOP_STORAGE_MARKETING_URL=http://host.docker.internal:5110/api/v1/campaigns/[0]/pic/

@Roland1975
Copy link

Roland1975 commented Mar 24, 2020

@nishanil In my .env file, here is an excerpt applying for linux:
// Use this values to run the app locally in Linux
// ESHOP_EXTERNAL_DNS_NAME_OR_IP=docker.for.linux.localhost

So, docker.for.linux.localhost seems appropriate.

@neoAnkit
Copy link

@nishanil In my .env file, here is an excerpt applying for linux:
// Use this values to run the app locally in Linux
// ESHOP_EXTERNAL_DNS_NAME_OR_IP=docker.for.linux.localhost

So, docker.for.linux.localhost seems appropriate.

I am sorry i should have been more clear. I am running solution on windows machine but using linux container instead of windows. Your inputs pleaase

@Roland1975
Copy link

It was my case,too: running linux container on a window host. In your browser, change http://localhost to http://docker.for.win.localhost. It did the trick for me.

@neoAnkit
Copy link

It was my case,too: running linux container on a window host. In your browser, change http://localhost to http://docker.for.win.localhost. It did the trick for me.

so i did changes in .env file as your suggested. Also in identityDB i changed the urls to dowcker.for.win.localhost. Running the solution now. Will keep you posted.

In the meantime, could you please guide me how to ensure that any code changes are reflected quickly in each deployed service? Right now if i even make text changes in website, i have to rerun the entire source code to verify my changes.

@neoAnkit
Copy link

If you're using Docker for Windows/Mac host.docker.internal can be used to point to the host machine.

Say you're running an app on a host machine (either outside docker, or within docker but on the host network) at port 8080, you can reach it from within the docker network at host.docker.internal:8080.

If you're trying to reach a container within the network from another container within the same network you can do it directly through service discovery.

I tried the changes. I made the changes in .env and database and open login page(on chrome) from url http://host.docker.internal:5100/ but after clicking submit shows the following error and hence not able to login:-

Refused to load the script 'http://localhost/identity/lib/jquery/jquery.js' because it violates the following Content Security Policy directive: "script-src 'unsafe-inline'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

On Ie the website is not opening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants