Updated 08. Setting up and Deploying eShopOnContainers to Windows Containers (markdown)

Eduard Tomàs 2017-09-05 12:30:40 +02:00
parent 111baa0c7a
commit 84d2749912

@ -24,4 +24,60 @@ In Windows 10 you need to set Docker to use "Windows container" instead of Linux
[[/img/win-containers/enable-windows-containers.png|Enabling windows containers]]
s
Then right click in the Docker icon on the notification bar and select the option "Switch to Windows Containers". If you don't see this option and see the option "Switch to Linux Containers" you're already using windows containers.
## Start Windows Containers
The easiest way to start the windows containers is using Powershell and use call the `cli-windows/start-windows-containers.ps1` script. This script will do three things:
1. Compile all projects (calling `cli-windows/build-bits.ps1`)
2. Create windows images
3. Start application
If don't want to compile all projects (because you have already published them) you can pass the parameter `-buildBits $false`:
```
.\cli-windows\start-windows-containers.ps1 -buildBits $false
```
You can use `docker-compose` directly to start the containers if you want:
```
docker-compose -f docker-compose-windows.yml -f docker-compose.override.yml -f docker-compose.override.windows.yml up
```
**Note**: You need to use these three files in docker-compose!
## RabbitMQ user and password
For RabbitMQ we are using the [https://hub.docker.com/r/spring2/rabbitmq/](spring2/rabbitmq) image, which provides a ready RabbitMQ to use. This RabbitMQ is configured to accept AMQP connections from the user `admin:password`(this is different from the RabbitMQ Linux image which do not require any user/password when creating AMQP connections)
If you use `start-windows-containers.ps1` script to launch the containers, then the containers are configured to use this login/password, so everything will work.
## Using custom login/password for RabbitMQ (if needed)
**Note**: Read this only if you use any other RabbitMQ image (or server) that have its own user/password needed.
We support any user/password needed using the environment variables `ESHOP_SERVICE_BUS_USERNAME` and `ESHOP_SERVICE_BUS_PASSWORD. These variables are used to set a username and password when connecting to RabbitMQ. So:
* In Linux these variables can be unset (or empty)
* In Windows these variables should be set
To set this variables you have two options
1. Just set them on your shell
2. Edit the `.env` file and add these variables
If you have set this images and you want to launch the containers you can use:
```
.\cli-windows\start-windows-containers.ps1 -customEventBusLoginPassword $true
```
When passing the parameter `-customEventBusLoginPassword $true` to the script you are forcing to use the login/password set in the environment variables instead the default one (the one needed for spring2/rabbitmq).
If you prefer to use `docker-compose` you can do it. Just call it without the `docker-compose.override.windows.yml` file:
```
docker-compose -f docker-compose-windows.yml -f docker-compose.override.yml up
```