Skip to content

Commit 9f7a7cd

Browse files
committed
Merge remote-tracking branch 'eShopOnContainers/dev' into dev
# Conflicts: # k8s/deploy.ps1
2 parents bffd87e + 427b1d5 commit 9f7a7cd

57 files changed

Lines changed: 991 additions & 374 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.

README.CICD.k8s.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Kubernetes CI/CD VSTS
2+
For k8s CI/CD pipeline delivery a series of tasks must be created in VSTS to deploy k8s in Azure
3+
4+
## Prerequisites
5+
* A Kubernetes cluster. Follow Azure Container Service's [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough) to create one.
6+
* A private Docker registry. Follow Azure Container Registry's [guide](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal) to create one.
7+
* Optionally, previous steps can be skipped if you run gen-k8s-env.ps1 script to automatically create the azure environment needed for kubernetes deployment. Azure cli 2.0 must be previously installed [installation guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). For example:
8+
>```
9+
>./gen-k8s-env -resourceGroupName k8sGroup -location westeurope -registryName k8sregistry -orchestratorName k8s-cluster -dnsName k8s-dns
10+
>```
11+
* An `Azure Blob storage`. It is needed for storing the kubernetes config file used by the hosted agent to access to Kubernetes cluster. Example:
12+
13+
<img src="img/k8s/blob_creation.png">
14+
15+
* Upload the `kubernetes config file` to the blob storage previously created. Execute the following command which will download the config file into the directory `c:\Users\<User>\.kube\` and then, upload it to your blob storage:
16+
>```
17+
>https://eshopk8s.blob.core.windows.net/k8s-config/config
18+
>```
19+
## Create the VSTS tasks
20+
1. Create a `Download File` task to download the kubernetes binary `kubectl` to the hosted agent. For example:
21+
>```
22+
>https://storage.googleapis.com/kubernetes-release/release/v0.0.1.7.0-alpha.0/bin/windows/386/kubectl.exe
23+
>```
24+
<img src="img/k8s/get_kubectlbin_task.png">
25+
26+
2. Create a Download File task to download the kubernetes config file to the hosted agent. For example:
27+
>```
28+
>https://eshopk8s.blob.core.windows.net/k8s-config/config
29+
>```
30+
<img src="img/k8s/get_kubectlconfig_task.png">
31+
32+
3. Create a powershell task to execute the k8s deployment script. For example:
33+
34+
* Deployment script path
35+
>```
36+
>$(System.DefaultWorkingDirectory)/All Microservices/docker-compose/deploy.ps1
37+
>```
38+
39+
* Deployment script path arguments. Where:
40+
- userDockerHub: indicates if Docker Hub is used instead of ACR
41+
- deployCI: indicates that it is a CI/CD deployment
42+
- execPath: path where the k8s binary is stored
43+
- kubeconfigPath: path where the k8s config file is stored
44+
>```
45+
>-deployCI $true -useDockerHub $true -execPath '$(System.DefaultWorkingDirectory)/' -kubeconfigPath '$(System.DefaultWorkingDirectory)/'
46+
>```
47+
48+
<img src="img/k8s/deploy_script_task.png">

_docker/rabbitmq/Dockerfile.nanowin

Lines changed: 0 additions & 29 deletions
This file was deleted.

_docker/rabbitmq/enabled_plugins

Lines changed: 0 additions & 1 deletion
This file was deleted.

_docker/rabbitmq/rabbitmq.config

Lines changed: 0 additions & 1 deletion
This file was deleted.

_docker/redis/Dockerfile.nanowin

Lines changed: 0 additions & 30 deletions
This file was deleted.

cli-mac/build-bits.sh

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ projectList=(
1010
"../src/Web/WebStatus"
1111
)
1212

13+
14+
pushd $(pwd)/../src/Web/WebSPA
15+
npm install
16+
npm rebuild node-sass
17+
popd
18+
1319
for project in "${projectList[@]}"
1420
do
1521
echo -e "\e[33mWorking on $(pwd)/$project"

docker-compose-windows.override.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,69 @@ services:
1111
basket.api:
1212
environment:
1313
- ASPNETCORE_ENVIRONMENT=Development
14-
- ASPNETCORE_URLS=http://0.0.0.0:5103
14+
- ASPNETCORE_URLS=http://0.0.0.0:80
1515
- ConnectionString=basket.data
16-
- identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
16+
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
1717
- EventBusConnection=rabbitmq
1818
ports:
19-
- "5103:5103"
19+
- "5103:80"
2020

2121
catalog.api:
2222
environment:
2323
- ASPNETCORE_ENVIRONMENT=Development
24-
- ASPNETCORE_URLS=http://0.0.0.0:5101
24+
- ASPNETCORE_URLS=http://0.0.0.0:80
2525
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
2626
- 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.
2727
- EventBusConnection=rabbitmq
2828
ports:
29-
- "5101:5101"
29+
- "5101:80"
3030

3131
identity.api:
3232
environment:
3333
- ASPNETCORE_ENVIRONMENT=Development
34-
- ASPNETCORE_URLS=http://0.0.0.0:5105
34+
- ASPNETCORE_URLS=http://0.0.0.0:80
3535
- SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104
3636
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
3737
- MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
3838
ports:
39-
- "5105:5105"
39+
- "5105:80"
4040

4141
ordering.api:
4242
environment:
4343
- ASPNETCORE_ENVIRONMENT=Development
44-
- ASPNETCORE_URLS=http://0.0.0.0:5102
44+
- ASPNETCORE_URLS=http://0.0.0.0:80
4545
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
46-
- identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
46+
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
4747
- EventBusConnection=rabbitmq
4848
ports:
49-
- "5102:5102"
49+
- "5102:80"
5050

5151
webspa:
5252
environment:
5353
- ASPNETCORE_ENVIRONMENT=Development
54-
- ASPNETCORE_URLS=http://0.0.0.0:5104
54+
- ASPNETCORE_URLS=http://0.0.0.0:80
5555
- CatalogUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101
5656
- OrderingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102
5757
- 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.
5858
- BasketUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
59+
- CatalogUrlHC=http://catalog.api/hc
60+
- OrderingUrlHC=http://ordering.api/hc
61+
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
62+
- BasketUrlHC=http://basket.api/hc
5963
ports:
60-
- "5104:5104"
64+
- "5104:80"
6165

6266
webmvc:
6367
environment:
6468
- ASPNETCORE_ENVIRONMENT=Development
65-
- ASPNETCORE_URLS=http://0.0.0.0:5100
66-
- CatalogUrl=http://catalog.api:5101
67-
- OrderingUrl=http://ordering.api:5102
68-
- BasketUrl=http://basket.api:5103
69+
- ASPNETCORE_URLS=http://0.0.0.0:80
70+
- CatalogUrl=http://catalog.api
71+
- OrderingUrl=http://ordering.api
72+
- BasketUrl=http://basket.api
6973
- IdentityUrl=http://10.0.75.1:5105 #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser.
7074
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
7175
ports:
72-
- "5100:5100"
76+
- "5100:80"
7377

7478
sql.data:
7579
environment:

docker-compose-windows.prod.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,61 +16,65 @@ services:
1616
basket.api:
1717
environment:
1818
- ASPNETCORE_ENVIRONMENT=Production
19-
- ASPNETCORE_URLS=http://0.0.0.0:5103
19+
- ASPNETCORE_URLS=http://0.0.0.0:80
2020
- 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.
21+
- identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
2222
ports:
2323
- "5103:5103"
2424

2525
catalog.api:
2626
environment:
2727
- ASPNETCORE_ENVIRONMENT=Production
28-
- ASPNETCORE_URLS=http://0.0.0.0:5101
28+
- ASPNETCORE_URLS=http://0.0.0.0:80
2929
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
3030
- 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.
3131
ports:
32-
- "5101:5101"
32+
- "5101:80"
3333

3434
identity.api:
3535
environment:
3636
- ASPNETCORE_ENVIRONMENT=Production
37-
- ASPNETCORE_URLS=http://0.0.0.0:5105
37+
- ASPNETCORE_URLS=http://0.0.0.0:80
3838
- SpaClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5104
3939
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
4040
- MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your host's firewall at range 5100-5105.
4141
ports:
42-
- "5105:5105"
42+
- "5105:80"
4343

4444
ordering.api:
4545
environment:
4646
- ASPNETCORE_ENVIRONMENT=Production
47-
- ASPNETCORE_URLS=http://0.0.0.0:5102
47+
- ASPNETCORE_URLS=http://0.0.0.0:80
4848
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
4949
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
5050
ports:
51-
- "5102:5102"
51+
- "5102:80"
5252

5353
webspa:
5454
environment:
5555
- ASPNETCORE_ENVIRONMENT=Production
56-
- ASPNETCORE_URLS=http://0.0.0.0:5104
56+
- ASPNETCORE_URLS=http://0.0.0.0
5757
- CatalogUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101
5858
- OrderingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
5959
- 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.
6060
- BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
61+
- CatalogUrlHC=http://catalog.api/hc
62+
- OrderingUrlHC=http://ordering.api/hc
63+
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
64+
- BasketUrlHC=http://basket.api/hc
6165
ports:
62-
- "5104:5104"
66+
- "5104:80"
6367

6468
webmvc:
6569
environment:
6670
- ASPNETCORE_ENVIRONMENT=Production
67-
- ASPNETCORE_URLS=http://0.0.0.0:5100
68-
- CatalogUrl=http://catalog.api:5101
69-
- OrderingUrl=http://ordering.api:5102
71+
- ASPNETCORE_URLS=http://0.0.0.0:80
72+
- CatalogUrl=http://catalog.api
73+
- OrderingUrl=http://ordering.api
7074
- 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
75+
- BasketUrl=http://basket.api
7276
ports:
73-
- "5100:5100"
77+
- "5100:80"
7478

7579
sql.data:
7680
environment:

docker-compose-windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ services:
5858
image: microsoft/mssql-server-windows
5959

6060
basket.data:
61-
image: eshop/redis-win
61+
image: redis:nanoserver
6262
# build:
6363
# context: ./_docker/redis
6464
# dockerfile: Dockerfile.nanowin
6565
ports:
6666
- "6379:6379"
6767

6868
rabbitmq:
69-
image: eshop/rabbitmq-win
69+
image: spring2/rabbitmq
7070
# build:
7171
# context: ./_docker/rabbitmq
7272
# dockerfile: Dockerfile.nanowin

docker-compose.ci.build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +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"
10-
9+
command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
10+

0 commit comments

Comments
 (0)