Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit e8e65c5

Browse files
committed
Merge branch 'dev'
# Conflicts: # docs/Microservicios-NET-Arquitectura-para-aplicaciones-NET-Contenerizadas-(Microsoft-eBook)-es-ES.pdf # docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook).pdf # docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-for-Kindle).mobi # docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-for-eReader).epub # readme/readme-docker-compose.md
2 parents 672d718 + 9486760 commit e8e65c5

File tree

396 files changed

+20556
-12830
lines changed

Some content is hidden

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

396 files changed

+20556
-12830
lines changed

.dockerignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.dockerignore
2+
.env
3+
.git
4+
.gitignore
5+
.vs
6+
.vscode
7+
docker-compose*.yml
8+
docker-compose.dcproj
9+
*.sln
10+
!eShopOnContainers-ServicesAndWebApps.sln
11+
*.md
12+
hosts
13+
LICENSE
14+
*.testsettings
15+
vsts-docs
16+
ServiceFabric
17+
readme
18+
k8s
19+
img
20+
docs
21+
deploy
22+
Components
23+
cli-windows
24+
cli-mac
25+
cli-linux
26+
**/bin/
27+
**/obj/
28+
**/node_modules/
29+
**/bower_components/
30+
**/wwwroot/lib/
31+
global.json
32+
src/Web/WebSPA/wwwroot/

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# 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
66

77
ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost
8-
ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92
8+
ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.162
99

1010
#ESHOP_AZURE_REDIS_BASKET_DB=<YourAzureRedisBasketInfo>
1111
#ESHOP_AZURE_STORAGE_CATALOG_URL=<YourAzureStorage_Catalog_BLOB_URL>

NuGet.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3+
<config>
4+
<add key="repositoryPath" value="packages" />
5+
</config>
36
<packageSources>
47
<add key="AspNetCore" value="https://dotnet.myget.org/F/aspnet-feb2017-patch/api/v3/index.json" />
58
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
# eShopOnContainers - Microservices Architecture and Containers based Reference Application (**BETA state** - Visual Studio 2017 and CLI environments compatible)
22
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers. <p>
3-
**Note Visual Studio 2017 version required**: This is important as of Oct. 11th 2017. For working with Docker and docker-compose files (needed with eShopOnContainers), do not migrate to VS 2017 15.4 as it has a bug when using TAGs in the docker-compose files.
4-
Please, either use VS 2017 15.35 or VS 2017 15.5 Preview 1 (bug is fixed here) or later.
5-
VS Preview installs next to your stable Visual Studio IDE, allowing you to use either independently.
6-
Download of Preview here: https://www.visualstudio.com/vs/preview/
3+
4+
**NEWS / ANNOUNCEMENTS**
5+
Do you want to be up-to-date on .NET Architecture guidance and reference apps like eShopOnContainers? --> Subscribe by "WATCHING" this new GitHub repo: https://github.com/dotnet-architecture/News
76

87
**Note for Pull Requests**: We accept pull request from the community. When doing it, please do it onto the DEV branch which is the consolidated work-in-progress branch. Do not request it onto Master, if possible.
98

10-
## Moving to .NET Core 2.0 "wave"
11-
NOTE: During August/September 2017 we'll be moving the solution to .NET Core "wave". Not just compilation but also new recommended code in EF Core 2.0, ASP.NET Core 2.0, and other new related versions.
9+
## Updated for .NET Core 2.0 "wave" of technologies
10+
NOTE: We have migrated the whole server-side solution to .NET Core 2.0 "wave". Not just compilation but also new recommended code in EF Core 2.0, ASP.NET Core 2.0, and other new related versions.
11+
12+
The **dockerfiles** in the solution have also been updated and now support [**Docker Multi-Stage**](https://blogs.msdn.microsoft.com/stevelasker/2017/09/11/net-and-multistage-dockerfiles/) since mid-December 2017.
13+
14+
For a list on the new .NET Core 2.0 related implemented features, see this [blog post](https://blogs.msdn.microsoft.com/dotnet/2017/08/02/microservices-and-docker-containers-architecture-patterns-and-development-guidance/).
1215

1316
>**PLEASE** Read our [branch guide](./branch-guide.md) to know about our branching policy
1417
1518
> ### DISCLAIMER
16-
> **IMPORTANT:** The current state of this sample application is **BETA**, consider it version 0.1, a 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.
19+
> **IMPORTANT:** The current state of this sample application is **BETA**, because we are constantly evolving towards new released technologies. 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.
1720
>
1821
> This reference application proposes a simplified microservice oriented architecture implementation to introduce technologies like .NET Core with Docker containers through a comprehensive application. The chosen domain is an eShop/eCommerce but simply because it is a well-know domain by most people/developers.
1922
However, this sample application should not be considered as an "eCommerce reference model", at all. The implemented business domain might not be ideal from an eCommerce business point of view. It is neither trying to solve all the problems in a large, scalable 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.
20-
> <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).
21-
> Additional steps would be to move your databases to HA cloud services, or to implement your EventBus with Azure Service Bus or any other production ready Service Bus in the market.
22-
> <p> In the future we might fork this project and make multiple versions targeting specific microservice cluster/orchestrators plus using additional cloud infrastructure. <p>
23+
> <p>For example, the next step after running the solution in the local dev PC and understanding Docker containers and microservices development with .NET Core, is to select a microservice cluster/orchestrator like Kubernetes in Azure or Azure Service Fabric, both environments tested and supported by this solution.
24+
> Additional steps would be to move your databases to HA cloud services (like Azure SQL Database), or to implement your EventBus with Azure Service Bus or any other production ready Service Bus in the market.
25+
> <p>
2326
> <img src="img/exploring-to-production-ready.png">
2427
> 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.
2528
@@ -66,11 +69,13 @@ You can download them and start reviewing these Guides/eBooks here:
6669
| Architecting & Developing | Containers Lifecycle & CI/CD | App patterns with Xamarin.Forms |
6770
| ------------ | ------------| ------------|
6871
| <a href='https://aka.ms/microservicesebook'><img src="img/ebook_arch_dev_microservices_containers_cover.png"> </a> | <a href='https://aka.ms/dockerlifecycleebook'> <img src="img/ebook_containers_lifecycle.png"> </a> | <a href='https://aka.ms/xamarinpatternsebook'> <img src="img/xamarin-enterprise-patterns-ebook-cover-small.png"> </a> |
69-
| <sup> <a href='https://aka.ms/microservicesebook'>**Download** (First Edition)</a> </sup> | <sup> <a href='https://aka.ms/dockerlifecycleebook'>**Download** (First Edition) </a> </sup> | <sup> <a href='https://aka.ms/xamarinpatternsebook'>**Download** (First Edition) </a> </sup> |
72+
| <sup> <a href='https://aka.ms/microservicesebook'>**Download .PDF** (2nd Edition)</a> </sup> | <sup> <a href='https://aka.ms/dockerlifecycleebook'>**Download** </a> </sup> | <sup> <a href='https://aka.ms/xamarinpatternsebook'>**Download** </a> </sup> |
73+
74+
Download in other formats (**eReaders** like **MOBI**, **EPUB**) and other eBooks at the [.NET Architecture center](http://dot.net/architecture).
7075

7176
72-
<p>
73-
However, we encourage to download and review the "Architecting & Developing eBook" because the architectural styles and architectural patterns and technologies explained in the guidance are using this reference application when explaining many pattern implementations, so you'll understand much better the context, design and decisions taken in the current architecture and internal designs.
77+
78+
However, we encourage to download and review the [Architecting and Developing Microservices eBook](https://aka.ms/microservicesebook) because the architectural styles and architectural patterns and technologies explained in the guidance are using this reference application when explaining many pattern implementations, so you'll understand much better the context, design and decisions taken in the current architecture and internal designs.
7479

7580
## Overview of the application code
7681
In this repo you can find a sample reference application that will help you to understand how to implement a microservice architecture based application using <b>.NET Core</b> and <b>Docker</b>.
@@ -89,7 +94,7 @@ Finally, those microservices are consumed by multiple client web and mobile apps
8994
<b>*MVC Application (ASP.NET Core)*</b>: It's 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.
9095
<img src="img/eshop-webmvc-app-screenshot.png">
9196
<br>
92-
<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).
97+
<b>*SPA (Single Page Application)*</b>: Providing similar "eShop business functionality" but developed with Angular, 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).
9398
<img src="img/eshop-webspa-app-screenshot.png">
9499
<br>
95100
<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).
@@ -106,12 +111,11 @@ For those who prefer the CLI on Windows, using dotnet CLI, docker CLI and VS Cod
106111
https://github.com/dotnet/eShopOnContainers/wiki/03.-Setting-the-eShopOnContainers-solution-up-in-a-Windows-CLI-environment-(dotnet-CLI,-Docker-CLI-and-VS-Code)
107112

108113
### CLI and Mac based
109-
For those who prefer the CLI on a Mac, using dotnet CLI, docker CLI and VS Code for Mac
110-
(Instructions still TBD, but similar to Windows CLI):
111-
https://github.com/dotnet/eShopOnContainers/wiki/04.-Setting-eShopOnContainer-solution-up-in-a-Mac,-VS-Code-and-CLI-environment--(dotnet-CLI,-Docker-CLI-and-VS-Code)
114+
For those who prefer the CLI on a Mac, using dotnet CLI, docker CLI and VS Code for Mac:
115+
https://github.com/dotnet-architecture/eShopOnContainers/wiki/04.-Setting-eShopOnContainer-solution-up-in-a-Mac,-VS-for-Mac-or-with-CLI-environment--(dotnet-CLI,-Docker-CLI-and-VS-Code)
112116

113117
## Orchestrators: Kubernetes and Service Fabric
114-
See at the Wiki the posts on setup/instructions about how to deploy to Kubernetes or Service Fabric in Azure (although you could also deploy to any other cloud or on-premises).
118+
See at the [Wiki](https://github.com/dotnet-architecture/eShopOnContainers/wiki) the posts on setup/instructions about how to deploy to Kubernetes or Service Fabric in Azure (although you could also deploy to any other cloud or on-premises).
115119

116120
## Sending feedback and pull requests
117121
As mentioned, we'd appreciate your feedback, improvements and ideas.

ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
66
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
77
<Parameters>
8+
<Parameter Name="OrderingBackground_InstanceCount" DefaultValue="-1" />
89
<Parameter Name="MarketingApi_InstanceCount" DefaultValue="-1" />
910
<Parameter Name="LocationsApi_InstanceCount" DefaultValue="-1" />
1011
<Parameter Name="PaymentApi_InstanceCount" DefaultValue="-1" />
@@ -19,6 +20,18 @@
1920
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
2021
should match the Name and Version attributes of the ServiceManifest element defined in the
2122
ServiceManifest.xml file. -->
23+
<ServiceManifestImport>
24+
<ServiceManifestRef ServiceManifestName="OrderingBackgroundPkg" ServiceManifestVersion="1.0.0" />
25+
<ConfigOverrides />
26+
<EnvironmentOverrides CodePackageRef="Code">
27+
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
28+
</EnvironmentOverrides>
29+
<Policies>
30+
<ContainerHostPolicies CodePackageRef="Code">
31+
<PortBinding ContainerPort="80" EndpointRef="OrderingBackgroundTypeEndpoint"/>
32+
</ContainerHostPolicies>
33+
</Policies>
34+
</ServiceManifestImport>
2235

2336
<ServiceManifestImport>
2437
<ServiceManifestRef ServiceManifestName="MarketingApiPkg" ServiceManifestVersion="1.0.0" />
@@ -99,6 +112,11 @@
99112
ServiceFabric PowerShell module.
100113
101114
The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
115+
<Service Name="OrderingBackground" ServicePackageActivationMode="ExclusiveProcess">
116+
<StatelessService ServiceTypeName="OrderingBackgroundType" InstanceCount="[OrderingBackground_InstanceCount]">
117+
<SingletonPartition />
118+
</StatelessService>
119+
</Service>
102120

103121
<Service Name="MarketingApi" ServiceDnsName="marketingapi.eshoponservicefabric" ServicePackageActivationMode="ExclusiveProcess">
104122
<StatelessService ServiceTypeName="MarketingApiType" InstanceCount="[MarketingApi_InstanceCount]">

ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
2929
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
3030
<EnvironmentVariable Name="UseCustomizationData" Value="True"/>
31-
<EnvironmentVariable Name="GracePeriodTime" Value="1"/>
32-
<EnvironmentVariable Name="CheckUpdateTime" Value="30000"/>
3331
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
3432
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
3533
<EnvironmentVariable Name="UseLoadTest" Value="True"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
3+
<!-- Add your custom configuration sections and parameters here -->
4+
<!--
5+
<Section Name="MyConfigSection">
6+
<Parameter Name="MyParameter" Value="Value1" />
7+
</Section>
8+
-->
9+
</Settings>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ServiceManifest Name="OrderingBackgroundPkg"
3+
Version="1.0.0"
4+
xmlns="http://schemas.microsoft.com/2011/01/fabric"
5+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
6+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7+
<ServiceTypes>
8+
<!-- This is the name of your ServiceType.
9+
The UseImplicitHost attribute indicates this is a guest service. -->
10+
<StatelessServiceType ServiceTypeName="OrderingBackgroundType" UseImplicitHost="true" />
11+
</ServiceTypes>
12+
13+
<!-- Code package is your service executable. -->
14+
<CodePackage Name="Code" Version="1.0.0">
15+
<EntryPoint>
16+
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
17+
<ContainerHost>
18+
<ImageName>eshop/ordering.backgroundtasks</ImageName>
19+
</ContainerHost>
20+
</EntryPoint>
21+
<!-- Pass environment variables to your container: -->
22+
<EnvironmentVariables>
23+
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
24+
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
25+
<EnvironmentVariable Name="ConnectionString" Value="Data Source=sqlserver.eshoponservicefabricsql,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word"/>
26+
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
27+
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
28+
<EnvironmentVariable Name="GracePeriodTime" Value="1"/>
29+
<EnvironmentVariable Name="CheckUpdateTime" Value="30000"/>
30+
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
31+
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
32+
<EnvironmentVariable Name="UseLoadTest" Value="True"/>
33+
</EnvironmentVariables>
34+
</CodePackage>
35+
36+
<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
37+
independently-updateable and versioned set of custom configuration settings for your service. -->
38+
<ConfigPackage Name="Config" Version="1.0.0" />
39+
40+
<Resources>
41+
<Endpoints>
42+
<!-- This endpoint is used by the communication listener to obtain the port on which to
43+
listen. Please note that if your service is partitioned, this port is shared with
44+
replicas of different partitions that are placed in your code. -->
45+
<Endpoint Name="OrderingBackgroundTypeEndpoint" Port="5111" UriScheme="http"/>
46+
</Endpoints>
47+
</Resources>
48+
</ServiceManifest>

ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Application Name="fabric:/eShopOnServiceFabric" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
33
<Parameters>
4+
<Parameter Name="OrderingBackground_InstanceCount" Value="-1" />
45
<Parameter Name="MarketingApi_InstanceCount" Value="1" />
56
<Parameter Name="LocationsApi_InstanceCount" Value="1" />
67
<Parameter Name="PaymentApi_InstanceCount" Value="1" />

ServiceFabric/Linux/eShopOnServiceFabric/eShopOnServiceFabric.sfproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
<Content Include="ApplicationPackageRoot\MarketingApiPkg\ServiceManifest.xml" />
3939
<Content Include="ApplicationPackageRoot\OrderingApiPkg\Config\Settings.xml" />
4040
<Content Include="ApplicationPackageRoot\OrderingApiPkg\ServiceManifest.xml" />
41+
<Content Include="ApplicationPackageRoot\OrderingBackgroundPkg\Config\Settings.xml" />
42+
<Content Include="ApplicationPackageRoot\OrderingBackgroundPkg\ServiceManifest.xml" />
4143
<Content Include="ApplicationPackageRoot\PaymentApiPkg\Config\Settings.xml" />
4244
<Content Include="ApplicationPackageRoot\PaymentApiPkg\ServiceManifest.xml" />
4345
<Content Include="packages.config" />

0 commit comments

Comments
 (0)