Skip to content

Commit f1ffb95

Browse files
committed
Merge branch 'dev' into integration-events-rmq
# Conflicts: # docker-compose.override.yml # eShopOnContainers-ServicesAndWebApps.sln
2 parents 254d479 + b07677a commit f1ffb95

165 files changed

Lines changed: 927 additions & 30002 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Compose supports declaring default environment variables in an environment file named .env placed in the folder docker-compose command is executed from (current working directory).
2+
# Compose expects each line in an env file to be in VAR=VAL format. Lines beginning with # (i.e. comments) are ignored, as are blank lines.
3+
# Note: Values present in the environment at runtime will always override those defined inside the .env file. Similarly, values passed via command-line arguments take precedence as well.
4+
5+
# The IP below should be swapped to your real IP or DNS name, like 192.168.88.248, etc. if testing from remote browsers or mobile devices
6+
7+
ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost
8+
ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ Sample .NET Core reference application, powered by Microsoft, based on a simplif
55
> **IMPORTANT:** The current state of this sample application is **ALPHA**, consider it version a 0.1 foundational version, therefore, many areas could be improved and change significantly while refactoring current code and implementing new features. **Feedback with improvements and pull requests from the community will be highly appreciated and accepted.**
66
>
77
> This reference application proposes a simplified microservice oriented architecture implementation to introduce technologies like .NET Core with Docker containers through a comprehensive application. However, this reference application it is not trying to solve all the problems in a large and mission-critical distributed system, it is just a bootstrap for developers to easily get started in the world of Docker containers and microservices with .NET Core.
8-
> <p>For example, the next step (still not covered here) after understanding Docker containers and microservices is to select a microservice cluster/orchestrator like Docker Swarm, Kubernetes or DC/OS (in Azure Container Service) or Azure Service Fabric which in most of the cases will require additional partial changes to your application's configuration (although the present architecture should work on most orchestrators with small changes). In the future we might fork this project and make multiple versions targeting specific microservice cluster/orchestrators. <p>
8+
> <p>For example, the next step (still not covered in eShopOnContainers) after understanding Docker containers and microservices development with .NET Core, is to select a microservice cluster/orchestrator like Docker Swarm, Kubernetes or DC/OS (in Azure Container Service) or Azure Service Fabric which in most of the cases will require additional partial changes to your application's configuration (although the present architecture should work on most orchestrators with small changes).
9+
> Or moving your databases to HA cloud services, or implementing your EventBus with Azure Service Bus or any other production ready Service Bus in the market.
10+
> <p> In the future we might fork this project and make multiple versions targeting specific microservice cluster/orchestrators plus using additional cloud infrastructure. <p>
11+
> <img src="img/exploring-to-production-ready.png">
912
> Read the planned <a href='https://github.com/dotnet/eShopOnContainers/wiki/01.-Roadmap-and-Milestones-for-future-releases'>Roadmap and Milestones for future releases of eShopOnContainers</a> within the Wiki for further info about possible new implementations and provide feedback at the <a href='https://github.com/dotnet/eShopOnContainers/issues'>ISSUES section</a> if you'd like to see any specific scenario implemented or improved. Also, feel free to discuss on any current issue.
1013
1114
**Architecture overview**: This reference application is cross-platform either at the server and client side, thanks to .NET Core services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps.
@@ -17,7 +20,7 @@ The plan is to add asynchronous communication for data updates propagation acros
1720
<img src="img/eShopOnContainers_Architecture_Diagram.png">
1821
<p>
1922
<p>
20-
Additional miroservice styles with other frameworks and No-SQL databases will be added, eventually. This is a great opportunity for pull requests from the community, like a new microservice using Nancy, or even other languages like Node, Go, Python or data containers with MongoDB with Azure DocDB compatibility, Postgress, RavenDB, Event Store, MySql, etc. You name it! :)
23+
Additional miroservice styles with other frameworks and No-SQL databases will be added, eventually. This is a great opportunity for pull requests from the community, like a new microservice using Nancy, or even other languages like Node, Go, Python or data containers with MongoDB with Azure DocDB compatibility, PostgreSQL, RavenDB, Event Store, MySql, etc. You name it! :)
2124

2225
> ### Important Note on Database Servers/Containers
2326
> In this solution's current configuration for a development environment, the SQL databases are automatically deployed with sample data into a single SQL Server for Linux container (a single shared Docker container for SQL databases) so the whole solution can be up and running without any dependency to any cloud or specific server. Each database could also be deployed as a single Docker container, but then you'd need more then 8GB or memory RAM assigned to Docker in your development machine in order to be able to run 3 SQL Server Docker containers in your Docker Linux host in "Docker for Windows" or "Docker for Mac" development environments.
@@ -55,13 +58,13 @@ The screenshot below shows the VS Solution structure for those microservices/con
5558

5659
Finally, those microservices are consumed by multiple client web and mobile apps, as described below.
5760
<br>
58-
<b>*MVC Application (ASP.NET Core)*</b>: Its an MVC 6 application where you can find interesting scenarios on how to consume HTTP-based microservices from C# running in the server side, as it is a typical ASP.NET Core MVC application. Since it is a server-side application, access to other containers/microservices is done within the internal Docker Host network with its internal name resolution.
61+
<b>*MVC Application (ASP.NET Core)*</b>: Its an MVC application where you can find interesting scenarios on how to consume HTTP-based microservices from C# running in the server side, as it is a typical ASP.NET Core MVC application. Since it is a server-side application, access to other containers/microservices is done within the internal Docker Host network with its internal name resolution.
5962
<img src="img/eshop-webmvc-app-screenshot.png">
6063
<br>
61-
<b>*SPA (Single Page Application)*</b>: Providing similar "eShop business functionality" but developed with Angular 2, Typescript and slightly using ASP.NET Core MVC 6. This is another approach for client web applications to be used when you want to have a more modern client behavior which is not behaving with the typical browser round-trip on every action but behaving like a Single-Page-Application which is more similar to a desktop app usage experience. The consumption of the HTTP-based microservices is done from TypeScript/JavaScript in the client browser, so the client calls to the microservices come from out of the Docker Host internal network (Like from your network or even from the Internet).
64+
<b>*SPA (Single Page Application)*</b>: Providing similar "eShop business functionality" but developed with Angular 2, Typescript and slightly using ASP.NET Core MVC. This is another approach for client web applications to be used when you want to have a more modern client behavior which is not behaving with the typical browser round-trip on every action but behaving like a Single-Page-Application which is more similar to a desktop app usage experience. The consumption of the HTTP-based microservices is done from TypeScript/JavaScript in the client browser, so the client calls to the microservices come from out of the Docker Host internal network (Like from your network or even from the Internet).
6265
<img src="img/eshop-webspa-app-screenshot.png">
6366
<br>
64-
<b>*Xamarin Mobile App (For iOS, Android and Windows/UWP)*</b>: It is a client mobile app supporting the most common mobilee OS platforms (iOS, Android and Windows/UWP). In this case, the consumption of the microservices is done from C# but running on the client devices, so out of the Docker Host internal network (Like from your network or even the Internet).
67+
<b>*Xamarin Mobile App (For iOS, Android and Windows/UWP)*</b>: It is a client mobile app supporting the most common mobile OS platforms (iOS, Android and Windows/UWP). In this case, the consumption of the microservices is done from C# but running on the client devices, so out of the Docker Host internal network (Like from your network or even the Internet).
6568

6669
<img src="img/xamarin-mobile-App.png">
6770

@@ -85,5 +88,9 @@ The <b>Windows Containers scenario is currently being implemented/tested yet</b>
8588
The app was also partially tested on "Docker for Mac" using a development MacOS machine with .NET Core and VS Code installed, which is still a scenario using Linux containers running on the VM setup in the Mac by the "Docker for Windows" setup. But further testing and feedback on Mac environments and Windows Containers, from the community, will be appreciated.
8689

8790
## Sending feedback and pull requests
88-
As mentioned, ew'd love to get your feedback, improvements and ideas.
89-
Create new issues at the issues section and/or send emails to cesardl@microsoft.com
91+
As mentioned, we'd appreciate to your feedback, improvements and ideas.
92+
You can create new issues at the issues section, do pull requests and/or send emails to eshop_feedback@service.microsoft.com
93+
94+
## Questions
95+
[QUESTION] Answer +1 if the solution is working for you (Through VS2017 or CLI environment):
96+
https://github.com/dotnet/eShopOnContainers/issues/107

cli-linux/prepare-spa-app.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
# Build SPA app
3+
pushd $(pwd)/src/Web/WebSPA
4+
npm rebuild node-sass
5+
#npm run build:prod
6+
7+

docker-compose.ci.build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ services:
66
volumes:
77
- .:/src
88
working_dir: /src
9-
command: /bin/bash -c "dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
9+
command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && pushd ./../../.. && dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
10+

docker-compose.dcproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<None Include="docker-compose.override.yml">
1212
<DependentUpon>docker-compose.yml</DependentUpon>
1313
</None>
14+
<None Include="docker-compose.prod.yml">
15+
<DependentUpon>docker-compose.yml</DependentUpon>
16+
</None>
1417
<None Include="docker-compose.vs.debug.yml">
1518
<DependentUpon>docker-compose.yml</DependentUpon>
1619
</None>

docker-compose.override.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
version: '2'
22

3+
# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine.
4+
# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
5+
# ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost
6+
# but values present in the environment vars at runtime will always override those defined inside the .env file
7+
# An external IP or DNS name has to be used (instead localhost and the 10.0.75.1 IP) when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance.
8+
39
services:
410

511
basket.api:
@@ -17,7 +23,7 @@ services:
1723
- ASPNETCORE_ENVIRONMENT=Development
1824
- ASPNETCORE_URLS=http://0.0.0.0:5101
1925
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
20-
- ExternalCatalogBaseUrl=http://localhost:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
26+
- ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
2127
- EventBusConnection=rabbitmq
2228
ports:
2329
- "5101:5101"
@@ -26,9 +32,9 @@ services:
2632
environment:
2733
- ASPNETCORE_ENVIRONMENT=Development
2834
- ASPNETCORE_URLS=http://0.0.0.0:5105
29-
- SpaClient=http://localhost:5104
35+
- SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104
3036
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
31-
- MvcClient=http://localhost:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
37+
- MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
3238
ports:
3339
- "5105:5105"
3440

@@ -46,10 +52,10 @@ services:
4652
environment:
4753
- ASPNETCORE_ENVIRONMENT=Development
4854
- ASPNETCORE_URLS=http://0.0.0.0:5104
49-
- CatalogUrl=http://localhost:5101
50-
- OrderingUrl=http://localhost:5102
51-
- IdentityUrl=http://localhost:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
52-
- BasketUrl=http://localhost:5103
55+
- CatalogUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101
56+
- OrderingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102
57+
- IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
58+
- BasketUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
5359
ports:
5460
- "5104:5104"
5561

@@ -59,8 +65,9 @@ services:
5965
- ASPNETCORE_URLS=http://0.0.0.0:5100
6066
- CatalogUrl=http://catalog.api:5101
6167
- OrderingUrl=http://ordering.api:5102
62-
- IdentityUrl=http://10.0.75.1:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
6368
- BasketUrl=http://basket.api:5103
69+
- IdentityUrl=http://10.0.75.1:5105 #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser.
70+
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
6471
ports:
6572
- "5100:5100"
6673

docker-compose.prod.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
version: '2'
2+
3+
# The Production docker-compose file has to have the external/real IPs or DNS names for the services
4+
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
5+
# ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=192.168.88.248
6+
# but values present in the environment vars at runtime will always override those defined inside the .env file
7+
# An external IP or DNS name has to be used when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance.
8+
#
9+
# Set ASPNETCORE_ENVIRONMENT=Development to get errors while testing.
10+
#
11+
# You need to start it with the following CLI command:
12+
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
13+
14+
services:
15+
16+
basket.api:
17+
environment:
18+
- ASPNETCORE_ENVIRONMENT=Production
19+
- ASPNETCORE_URLS=http://0.0.0.0:5103
20+
- ConnectionString=basket.data
21+
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
22+
ports:
23+
- "5103:5103"
24+
25+
catalog.api:
26+
environment:
27+
- ASPNETCORE_ENVIRONMENT=Production
28+
- ASPNETCORE_URLS=http://0.0.0.0:5101
29+
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
30+
- ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
31+
ports:
32+
- "5101:5101"
33+
34+
identity.api:
35+
environment:
36+
- ASPNETCORE_ENVIRONMENT=Production
37+
- ASPNETCORE_URLS=http://0.0.0.0:5105
38+
- SpaClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5104
39+
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
40+
- MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your host's firewall at range 5100-5105.
41+
ports:
42+
- "5105:5105"
43+
44+
ordering.api:
45+
environment:
46+
- ASPNETCORE_ENVIRONMENT=Production
47+
- ASPNETCORE_URLS=http://0.0.0.0:5102
48+
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
49+
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
50+
ports:
51+
- "5102:5102"
52+
53+
webspa:
54+
environment:
55+
- ASPNETCORE_ENVIRONMENT=Production
56+
- ASPNETCORE_URLS=http://0.0.0.0:5104
57+
- CatalogUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101
58+
- OrderingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
59+
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
60+
- BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
61+
ports:
62+
- "5104:5104"
63+
64+
webmvc:
65+
environment:
66+
- ASPNETCORE_ENVIRONMENT=Production
67+
- ASPNETCORE_URLS=http://0.0.0.0:5100
68+
- CatalogUrl=http://catalog.api:5101
69+
- OrderingUrl=http://ordering.api:5102
70+
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
71+
- BasketUrl=http://basket.api:5103
72+
ports:
73+
- "5100:5100"
74+
75+
sql.data:
76+
environment:
77+
- SA_PASSWORD=Pass@word
78+
- ACCEPT_EULA=Y
79+
ports:
80+
- "5433:1433"

0 commit comments

Comments
 (0)