Updated 04. Setting eShopOnContainer solution up in a Mac, VS for Mac or with CLI environment (dotnet CLI, Docker CLI and VS Code) (markdown)

Cesar De la Torre 2017-10-25 13:53:06 -07:00
parent 2f134d900e
commit 47741422ba

@ -100,12 +100,15 @@ And by typing `docker ps` you can see the containers running in Docker. The infr
1. [Docker for Mac](https://docs.docker.com/docker-for-mac/install/). You should already have this. 1. [Docker for Mac](https://docs.docker.com/docker-for-mac/install/). You should already have this.
1. A Git client. The [git-scm site](https://git-scm.com/download/gui/mac) maintains a great list of clients. 1. A Git client. The [git-scm site](https://git-scm.com/download/gui/mac) maintains a great list of clients.
1. [Node.js](http://nodejs.org). The stable channel is fine as well. 1. [Node.js](http://nodejs.org). The stable channel is fine as well.
1. Bower ($ npm install -g bower) needed by the MVC web app.
1. [.NET Core and SDK](http://dot.net). Install the SDK and runtime. 1. [.NET Core and SDK](http://dot.net). Install the SDK and runtime.
1. Bower and other dependencies needed by the MVC and SPA web apps
## Building the application
Then, open a bash shell and run the following four commands: ## B.1 - Building the application from a Docker Linux "build container"
This is the simples way to do it from the CLI, but until a [bug is solved in .NET CLI]() please, follow the OPTION B.2 explained below (building .NET bits in the local Mac)
Open a bash shell and run the following four commands:
``` ```
$ git clone https://github.com/dotnet-architecture/eShopOnContainers.git $ git clone https://github.com/dotnet-architecture/eShopOnContainers.git
@ -136,6 +139,9 @@ services can be reached:
- *Ordering Microservice API*: `http://localhost:5102` - *Ordering Microservice API*: `http://localhost:5102`
- *Basket Microservice API*: `http://localhost:5103` - *Basket Microservice API*: `http://localhost:5103`
- *Identity Microservice API*: `http://localhost:5105` - *Identity Microservice API*: `http://localhost:5105`
- *Payment API*: `http://localhost:5108`
- *Marketing API*: `http://localhost:5110`
- *Locations API*: `http://localhost:5109`
To add items to the shopping cart or check out, you'll need to login to the site. To add items to the shopping cart or check out, you'll need to login to the site.
The credentials for a demo user are: The credentials for a demo user are:
@ -146,23 +152,18 @@ The credentials for a demo user are:
-------------------------------------------------------------------- --------------------------------------------------------------------
-------------------------------------------------------------------- --------------------------------------------------------------------
## Detailed procedure - Setting eShopOnContainers up using bash and a Mac development machine ## B.1.1 - Detailed procedure - Setting eShopOnContainers up using the Docker Linux build-container
The quick instructions above build all the projects that make up eShopOnContainers in a Docker The quick instructions above build all the projects that make up eShopOnContainers in a Docker Linux
container. That's the preferred way to build the application. It's easier to make sure all the "build-container". That's the preferred way to build the application. It's easier to make sure all the
prerequisites are installed, every developer uses the same version of all the tools, and prerequisites are installed, every developer uses the same version of all the tools, and
you have a consistent experience from any build. you have a consistent experience from any build.
### GitHub branch to use/pull This section (B.1.1) is just a further explanation of that method.
Use the `master` branch from the eShopOnContainers project. It is the most up to date stable ### The Docker Linux build container
branch.
However, if you want to look at the very latest features, use the `dev` branch. If you As mentioned, the recommended approach is to build the .NET bits and Docker images by using an special build
want to submit pull requests for eShopOnContainers, start from the `dev` branch and target
your PR to that branch.
The recommended approach is to build the .NET bits and Docker images by using an special build
container from the CLI or your CI/CD pipeline. What you run and test locally is built using the container from the CLI or your CI/CD pipeline. What you run and test locally is built using the
same process as your CI/CD pipleine. The verions of all tools are the same, the same version of same process as your CI/CD pipleine. The verions of all tools are the same, the same version of
all SDKs are used, and so on. This ensures consistency across all builds. all SDKs are used, and so on. This ensures consistency across all builds.
@ -176,37 +177,10 @@ build image which includes the .NET SDK, NPM and many other Web and ASP.NET depe
Contrast the four commands you ran above, along with the minimal prerequisites, with the Contrast the four commands you ran above, along with the minimal prerequisites, with the
list of prerequisites and tools needed to build locally on your machine. list of prerequisites and tools needed to build locally on your machine.
## Setting up docker-compose file
The Mac has a changing IP address (or none if you have no network access). From 17.06 onwards our recommendation is to connect to the special Mac-only DNS name docker.for.mac.localhost which will resolve to the internal IP address used by the host. ## B.2 - Building the application binaries on the local Mac (local .NET Core in Mac)
Therefore, the following change must be done in docker-compose.override.yml. You can build the application using your machine, if you prefer. You'll need the following
In the WebMVC service section, replace the IdentityUrl environment variable with:
```bash
IdentityUrl=http://docker.for.mac.localhost:5105
```
The WebMVC service definition should finally be configured as shown bellow:
```bash
webmvc:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- CatalogUrl=http://catalog.api
- OrderingUrl=http://ordering.api
- BasketUrl=http://basket.api
- IdentityUrl=http://docker.for.mac.localhost:5105
- MarketingUrl=http://marketing.api #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser.
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
- UseCustomizationData=True
ports:
- "5100:80"
```
## Building the application locally
You can build the application using your machien, if you prefer. You'll need the following
prerequisites installed, in addition to those listed above for building using the CI container. prerequisites installed, in addition to those listed above for building using the CI container.
- *[.NET Core and SDK](http://dot.net)* - *[.NET Core and SDK](http://dot.net)*
@ -250,6 +224,38 @@ from Docker hub. That will take some time. Once the images have been pulled,
the application will start and you can test it out using the browser and the the application will start and you can test it out using the browser and the
addresses shown [above](#running-the-application). addresses shown [above](#running-the-application).
# Configuring the app for Authentication and access from remote client apps
## Setting up the docker-compose file environment variables and settings
The Mac has a changing IP address (or none if you have no network access). From 17.06 onwards our recommendation is to connect to the special Mac-only DNS name docker.for.mac.localhost which will resolve to the internal IP address used by the host.
Therefore, the following change must be done in docker-compose.override.yml.
In the WebMVC service section, replace the IdentityUrl environment variable with:
```bash
IdentityUrl=http://docker.for.mac.localhost:5105
```
The WebMVC service definition should finally be configured as shown bellow:
```bash
webmvc:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- CatalogUrl=http://catalog.api
- OrderingUrl=http://ordering.api
- BasketUrl=http://basket.api
- IdentityUrl=http://docker.for.mac.localhost:5105
- MarketingUrl=http://marketing.api #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser.
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
- UseCustomizationData=True
ports:
- "5100:80"
```
## Sending feedback and pull requests ## Sending feedback and pull requests
We'd appreciate to your feedback, improvements and ideas. We'd appreciate to your feedback, improvements and ideas.