asc-lab / dotnetcore-microservices-poc

Very simplified insurance sales system made in a microservices architecture using .NET Core
https://www.altkomsoftware.com/blog/building-microservices-net-core-part-1-plan/
Apache License 2.0
1.9k stars 681 forks source link

Docker compose network mode #27

Closed maciejgos closed 5 years ago

maciejgos commented 5 years ago

Change network mode to bridge to allow host containers on macOS and Windows machines. Currently host network mode is only available on Linux hosts.

I add also CORS policy to allow communication on localhost with VUEJS website.

wojteksuwala commented 5 years ago

Why do you need to communicate directly with product-service? You should go via existing api-gateway which already handles CORS or create a new one dedicated for you client app.

maciejgos commented 5 years ago

When I open web app and go to Products page the web app throws CORS exception on http://localhost. This is the reason why I add CORS policy.

VUEJS app calls below URL's so it looks as it calls them directly not thru the gateway VUE_APP_BACKEND_URL=http://localhost:8081/api/ VUE_APP_AUTH_URL=http://localhost:6060/api VUE_APP_CHAT_URL=http://localhost:4099

wojteksuwala commented 5 years ago

No it is not. You need to properly setup things in your .env file.

VUE_APP_BACKEND_URL=http://localhost:8099/ VUE_APP_AUTH_URL=http://localhost:6060/ VUE_APP_CHAT_URL=http://localhost:4099

maciejgos commented 5 years ago

I check agent gateway on master branch and it looks that on docker-compose branch .UseUrls("http://localhost:8099") is missing in Program.cs. I will merge master into docker-compose and go further with my changes.

wojteksuwala commented 5 years ago

Dockerization work is indeed performed on docker-compose branch, we will proceed with dockerization on master once we upgrade tp .netcore3, as we are not 100% happy with the way things look like on docker-compose branch. As said previously - CORS is not needed for ProductService as it should not be accessed directly, so please remove it from pull request. Change of network mode is ok, but we need to expose ports properly so eureka registration will work

maciejgos commented 5 years ago

Yes I already remove CORS changes and start to play around with gateway & eureka

maciejgos commented 5 years ago

Closed to remove CORS from ProductService