From 0c1413c985264d6b29b4c8fd18e969e910de9cab Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Mon, 20 Feb 2017 16:40:02 -0800 Subject: [PATCH] Updates in setup pages in Wiki --- .vs/slnx.sqlite | Bin 69632 -> 69632 bytes ...-up-in-a-Visual-Studio-2017-environment.md | 3 +- ...nt-(dotnet-CLI,-Docker-CLI-and-VS-Code).md | 80 +++++++++++------- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 1b04a6abdd1737c5d664ef5818e6561ca48e9e6b..af1e19385cc603e28b8765e95b05db89ff5d216d 100644 GIT binary patch delta 1059 zcmbu7O-vI(7=~xqUkWl?0}%luKWV7ZEhK7*TqIb)1n7#0v?b}EU8U8w8w$h(iQOKc z8W7AFg9n0MI1m#ho1iB{Ja8c4(1SNqX~1m-!gQ#s7F`75mSXL=d|wvowFIZB~&w1u{4 zX5nWMrIvVc&N+2#cd}v!vbl347B5y9cQFNYM6NI zzAbJR`1C$4|Mn3_hh@GLpC<$9MWH=6Wwzvux?KTm&rY(h5L!Fwx z)6TQ#9*C&t@vP%=jV%!vmqWH-;3m17O@H0!QQ5)5c=*$l6N*@ptfhJ5-qi&FfM1)H z#%e2<0gt=@Jwhq;0lh|9w28b(L0-*V>p(q%zyeqdSr?VR8SknT%!cAIlvIl<6dOvf zu6*YQy4D3~C`I|2qmh*W>30~f+^z1<&b+lw3CK8i8y=CFHo;^lPF?x(?fwqQ$4~~1 znoCbsOuQY~*)^(cgG+O#xi_euUE`Pe+qgX0j$O%m67eer*UY8Ly?1DJ0v;??)^mkc zPeMHJknr^M3)&=;SX`4eS=@LC0B% zckmUse4a3w*O^ERs}?aS2H?86$qMfzLstHPY@kQmddx!FR7IGaOIw{);0X91i;eb? pPW#Y)cG-OPXfBzmIM(1-?d$#0L{s2P{QeOZ7 delta 706 zcmZozz|ydQWr8&0wuv&%jN3LQWa=~WPClit!5Fsrvp&B7>q7=p7S+k@4hf=bST$Il zv$V6Q@^|w6=I`Y1WKm^N-7F}ul9@XpfSsXHpMjIjz-015Kb^@I{tA;Xc(Ad){E*Gg zvbo(wm665Ri;ZFO23Hg2`o_%3^&Uo(*E*{y%7?NsfV6q!=celArsx$XmZhfXB_(Ea zT#0hlFIA9u$H2~Cz`#F+zkt7q{|^5t{vG_w_~ZEFHVZ1a@cRgG zvN14nGP3zH1I>N;p~_QRfCD1p1r}jV+<6d1&6^81wU-JoLewyU)Vz_*T9qik3-sTr zdTIZcAC?_W5a5Q$2S7|+6wxQZ1rhOsh;+SC2D)DeWHZN6sOniCjw0U<1n+KiJYxcE0d{4!v+Pl9rTlXzOH6QLV!u2&YJw6I z=P95gf3k9fvjS5Dk}Fw2uH1Zf8XF_47E3q-*m>+;Tv80BKz5yTgt!Docker for Windows with the concrete configuration specified below. - Visual Studio 2017 (Latest version) with the workloads specified below. +- NPM and related dependencies for running the SPA Web app. Setup process described here ### Installing and configuring Docker in your development machine diff --git a/03.-Setting-the-eShopOnContainers-solution-up-in-a-Windows-CLI-environment-(dotnet-CLI,-Docker-CLI-and-VS-Code).md b/03.-Setting-the-eShopOnContainers-solution-up-in-a-Windows-CLI-environment-(dotnet-CLI,-Docker-CLI-and-VS-Code).md index 5464e57..cebe034 100644 --- a/03.-Setting-the-eShopOnContainers-solution-up-in-a-Windows-CLI-environment-(dotnet-CLI,-Docker-CLI-and-VS-Code).md +++ b/03.-Setting-the-eShopOnContainers-solution-up-in-a-Windows-CLI-environment-(dotnet-CLI,-Docker-CLI-and-VS-Code).md @@ -1,27 +1,35 @@ -This environment means that you want to build/run by using the CLI (Command line interface plus PowerShell scripts and "docker-compose up/build" CLI). +## Setting eShopOnContainers up in a CLI and Windows based development machine -Because in this environment you need to build the .NET projects from the dotnet CLI plus being able to build the docker images with docker-compose build, there are some SDKs that need to be available from the command line and you need to install them or configute them so commands are available from the cmd context. - -## Development Environment Setup -### Requirements for January 2016 version of eShopOnContainers +Software installation requirements for a Windows dev machine with CLI SDKs, Docker for Windows and Visual Studio Code or any other editor. WINDOWS DEV MACHINE -- Visual Studio 2015 with latest Update -- .NET Core 1.1 setup (Including ASP.NET Core and VS Tooling) -- Bower and Gulp as global installs (See steps below) -- Docker for Windows +- Docker for Windows. Important, follow the concrete configuration specified in the steps below. +- .NET Core SDK - (Latest version. As of February 2017, using .NET 1.1 SDK) +- Visual Studio Code or any other code editor. +- NPM and related dependencies for running the SPA Web app. SPA app setup process described here -MAC DEV MACHINE -- Visual Studio Code -- .NET Core 1.1 for Mac - setup -- Bower and Gulp as global installs (See steps below) -- Docker for Mac +This environment means that you want to build/run by using the CLI (Command line interface plus PowerShell scripts and "docker-compose up/build" CLI). + +Because in this environment you need to build the .NET projects from the dotnet CLI plus being able to build the docker images with docker-compose build, there are some SDKs that need to be available from the command line and you need to install and configure so commands are available from the cmd context. + +## Setting up the development environment ### Installing and configuring Docker in your development machine +#### Install Docker for Windows +Install Docker for Windows (The Stable channel should suffice) from this page: https://docs.docker.com/docker-for-windows/install/ +About further info on Docker for windows, check this additional page +https://docs.docker.com/docker-for-windows/ + +Docker for Windows uses Hyper-V to run a Linux VM which is the by default Docker host. If you don't have Hyper-V installed/enabled, it'll be installed and you will probably need to reboot your machine. Docker's setup should warn you about it, though. + +**IMPORTANT**: Check that you don't have any other hypervisor installed that might be not compatible with Hyper-V. For instance, Intel HAXM can be installed by VS 2017 if you chose to install Google's Android emulator which works on top of Intel HAXM. In that case, you'd need to uninstall Google's Android emulator and Intel HAXM. +VS 2017 recommends to install the Google Android emulator because it is the only Android emulator with support for Google Play Store, Google Maps, etc. However, take into account that it currently is not compatible with Hyper-V, so you might have incompatibilities with this scenario. + #### Set needed assigned Memory and CPU to Docker -In this application (January 2017 version) we run 1 instance of SQL Server running as a container with multiple databases (one DB per microservice), plus 6 ASP.NET Core apps/services and 1 Redis server, all of them running as Docker containers. So, especially because of SQL Server requirements on memory, it is important to set Docker up properly with enough memory RAM and CPU assigned to it or you will get difficult errors when starting the containers with "docker-compose up". -Once Docker for Windows/Mac is installed in your machine, enter into its Settings and the Advanced menu option so you are able to adjust it to the minimum amount of memory and CPU (Memory: Around 4096MB and CPU:3) as shown in the image. Usually you might need a 16GB memory machine for this configuration if you also want to run the Android emulator for the Xamarin app at the same time. If you have a less powerful machine, you can try with a lower configuration and/or by not starting certain containers like the basket and Redis. But if you don't start all the containers, the application will not fully function properly, of course. +For the development environment of eShopOnContainers, by default, it runs 1 instance of SQL Server running as a container with multiple databases (one DB per microservice), other 6 additional ASP.NET Core apps/services each one running as a container, plus 1 Redis server running as a container. Therefore, especially because of the SQL Server requirements on memory, it is important to set Docker up properly with enough memory RAM and CPU assigned to it or you will get errors when starting the containers with VS 2017 or "docker-compose up". + +Once Docker for Windows is installed in your machine, enter into its Settings and the Advanced menu option so you are able to adjust it to the minimum amount of memory and CPU (Memory: Around 4096MB and CPU:3) as shown in the image. Usually you might need a 16GB memory machine for this configuration if you also want to run the Android emulator for the Xamarin app or multiple instances of applications demanding significant memory at the same time. If you have a less powerful machine, you can try with a lower configuration and/or by not starting certain containers like the basket and Redis. But if you don't start all the containers, the application will not fully function properly, of course. @@ -29,16 +37,24 @@ Once Docker for Windows/Mac is installed in your machine, enter into its Setting (Note, this is not required if running from Docker CLI with docker-compose up and using VS 2015 or any other IDE or Editor)

In order to deploy/debug from Visual Studio 2017, you'll need to share the drives from Settings-> Shared Drives in the "Docker for Windows" configuration. If you don't do this, you will get an error when trying to deploy/debug from VS 2017, like "Cannot create container for service yourApplication: C: drive is not shared".

+The drive you'll need to share depends on where you place your source code. -#### Node, Bower and Gulp installation -(These steps about installing bower and gulp might not be needed anymore as these are being triggered from the project.json in the MVC project at the section 'prepublish":'). However, this will need to be migrated to .csproj when migrating to VS 2017.

-Before generating the Docker images, and specifically when generating the web apps binaries with "dotnet publish" from the custom scripts (like when running the build-images.ps1 script from PowerShell or the build-images.sh from bash in a Mac), it needs to have access to the paths where you have installed Bower and Gulp. For that, the recommendation is to install Bower and Gulp with a global installation by running the following commands from command-line or bash: + +### IMPORTANT: Open ports in Firewall so Authentication to the STS (Security Token Service container) can be done through the 10.0.75.1 IP which should be available and already setup by Docker +- You can manually create a rule in your local firewall in your development machine or you can also create that rule by just executing the add-firewall-docker.ps1 script in the solution's root folder. +- Basically, you need to open the ports 5100 to 5105 that are used by the solution by creating an IN-BOUND RULE in your firewall, as shown in the screenshot below (for Windows). + + + +### Node, Bower and Gulp installation +(These steps about installing bower and gulp might not be needed anymore as these are being triggered from the .csproj file in the MVC project at the "PrepublishScript" section).

+Before generating the Docker images, and specifically when generating the web apps binaries with "dotnet publish" from the custom scripts (like when running the build-bits.ps1 script from PowerShell), it needs to have access to the paths where you have installed Bower and Gulp. For that, the recommendation is to install Bower and Gulp with a global installation by running the following commands from command-line or bash: - Install Node if you don't have it installed, from here: https://nodejs.org/en/ -- After you install Node, you need to align that installed version with the version used by Visual Studio, so you need to make sure that VS2017 is using the same nodejs that you are using from command line.
+- NOTE: After installing Node, if you are also using Visual Studio 2017, you need to align that installed version with the version used by Visual Studio, so you need to make sure that VS2017 is using the same nodejs that you are using from command line.
**Go to "Tools -> Options -> Project and Solutions -> Web Package Management -> External Web Tools"** and ensure that the nodejs you use from command line is listed before the entry "$(VSINSTALLDIR)\Web\External" - Install Bower and Gulp with the following npm commands (npm is installed as part of Node) @@ -53,8 +69,17 @@ Below you can see how those commands are run in Windows: ## Build, Ship, Run In the global directory you will find the scripts needed to build, deploy and run the application into your local Docker development machine. The steps are the following: -### Compile the .NET apps and Build the Docker images -- Open a PowerShell window in Windows, move to the root folder of your solution and run the build-images.ps1 script file like in the following screenshot. +### Compile the .NET apps and publish the bits in the publish folders + +These steps are easily performed by running a script. +- Open a PowerShell window in Windows, move to the root folder of your solution and run the build-bits.ps1 script file like in the following screenshot. + + + + + + +TBD IMPORTANT: This script deletes all the Docker images registered in your local dev machine repository before creating the new images, so it is starting from a 100% clean state. If you don't want your local images in your PC to be deleted, edit and change the build-images.ps1 script file before you run it. @@ -81,10 +106,7 @@ The next time you run docker-compose up, since it'll have those base images alre You can see the 6 custom containers running the microservices plus the 2 web applications. In adition you have the containers with the SQL databases and the Redis cache for the basket microservice data. -#### IMPORTANT: Open ports in Firewall so Authentication to the STS (Security Token Service container) can be done through the 10.0.75.1 IP which should be available and already setup by Docker -- You can manually create a rule in your local firewall in your development machine or you can also create that rule by just executing the add-firewall-docker.ps1 script in the solution's root. -- Basically, you need to open the ports 5100 to 5105 that are used by the solution by creating an IN-BOUND RULE in your firewall, as shown in the screenshot below (for Windows). - + ### Test the applications and microservices @@ -121,9 +143,3 @@ By default, this app shows fake data from mock-services. In order to really acce ### Deploying individiual services into Docker Under each project root you will find a readme.md file which describes how to run and deploy the service individually into a docker host. -> ### Note on Windows Containers -> As mentioned, the development and testing of this project (January 2017 version) was done on Docker Linux containers running in development machines with "Docker for Windows" and the default Hyper-V Linux VM (MobiLinuxVM) installed by "Docker for Windows". -In order to run the application on Windows Containers you'd need to change the base images used by each container: -> - Official .NET Core base-image for Windows Containers, at Docker Hub: https://hub.docker.com/r/microsoft/dotnet/ (Using the Windows Nanoserver tag) -> - Official base-image for SQL Server on Windows Containers, at Docker Hub: https://hub.docker.com/r/microsoft/mssql-server-windows -