From 380663de650b0ed774c302faf3649d6fc3144505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20=C3=96zceviz?= Date: Thu, 7 Feb 2019 14:09:40 +0100 Subject: [PATCH 1/6] Added Dockerfiles --- .../applications/AuthServer.Host/Dockerfile | 18 ++++++++++++++++ .../BackendAdminApp.Host/Dockerfile | 18 ++++++++++++++++ .../applications/ConsoleClientDemo/Dockerfile | 18 ++++++++++++++++ .../PublicWebSite.Host/Dockerfile | 18 ++++++++++++++++ samples/MicroserviceDemo/databases/Dockerfile | 21 +++++++++++++++++++ .../BackendAdminAppGateway.Host/Dockerfile | 18 ++++++++++++++++ .../gateways/InternalGateway.Host/Dockerfile | 18 ++++++++++++++++ .../PublicWebSiteGateway.Host/Dockerfile | 18 ++++++++++++++++ .../BloggingService.Host/Dockerfile | 18 ++++++++++++++++ .../IdentityService.Host/Dockerfile | 18 ++++++++++++++++ .../ProductService.Host/Dockerfile | 18 ++++++++++++++++ 11 files changed, 201 insertions(+) create mode 100644 samples/MicroserviceDemo/applications/AuthServer.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/applications/BackendAdminApp.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/applications/ConsoleClientDemo/Dockerfile create mode 100644 samples/MicroserviceDemo/applications/PublicWebSite.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/databases/Dockerfile create mode 100644 samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/gateways/InternalGateway.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/microservices/BloggingService.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/microservices/IdentityService.Host/Dockerfile create mode 100644 samples/MicroserviceDemo/microservices/ProductService.Host/Dockerfile diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/Dockerfile b/samples/MicroserviceDemo/applications/AuthServer.Host/Dockerfile new file mode 100644 index 0000000000..4fe82ef81b --- /dev/null +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/applications/AuthServer.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "AuthServer.Host.dll"] diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/Dockerfile b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/Dockerfile new file mode 100644 index 0000000000..5444edb5a5 --- /dev/null +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/applications/BackendAdminApp.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "BackendAdminApp.Host.dll"] diff --git a/samples/MicroserviceDemo/applications/ConsoleClientDemo/Dockerfile b/samples/MicroserviceDemo/applications/ConsoleClientDemo/Dockerfile new file mode 100644 index 0000000000..5822384ef6 --- /dev/null +++ b/samples/MicroserviceDemo/applications/ConsoleClientDemo/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/applications/ConsoleClientDemo" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "ConsoleClientDemo.dll"] diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/Dockerfile b/samples/MicroserviceDemo/applications/PublicWebSite.Host/Dockerfile new file mode 100644 index 0000000000..82bb090408 --- /dev/null +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/applications/PublicWebSite.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "PublicWebSite.Host.dll"] diff --git a/samples/MicroserviceDemo/databases/Dockerfile b/samples/MicroserviceDemo/databases/Dockerfile new file mode 100644 index 0000000000..91879f9e7c --- /dev/null +++ b/samples/MicroserviceDemo/databases/Dockerfile @@ -0,0 +1,21 @@ +FROM microsoft/dotnet:2.2-sdk-alpine AS build +RUN apk add --no-cache bash +WORKDIR /src +COPY . . + +WORKDIR "/src/samples/MicroserviceDemo/microservices/ProductService.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release + +WORKDIR "/src/samples/MicroserviceDemo/applications/AuthServer.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release + +FROM build AS final +WORKDIR /src +COPY --from=build /src/samples/MicroserviceDemo/microservices/ProductService.Host ./ProductService.Host +COPY --from=build /src/samples/MicroserviceDemo/applications/AuthServer.Host ./AuthServer.Host +COPY --from=build /src/samples/MicroserviceDemo/databases/entrypoint.sh . +RUN chmod +x ./entrypoint.sh + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/Dockerfile b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/Dockerfile new file mode 100644 index 0000000000..8577b0d182 --- /dev/null +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "BackendAdminAppGateway.Host.dll"] diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/Dockerfile b/samples/MicroserviceDemo/gateways/InternalGateway.Host/Dockerfile new file mode 100644 index 0000000000..cb03220467 --- /dev/null +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/gateways/InternalGateway.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "InternalGateway.Host.dll"] diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/Dockerfile b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/Dockerfile new file mode 100644 index 0000000000..5f3eee8618 --- /dev/null +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "PublicWebSiteGateway.Host.dll"] diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/Dockerfile b/samples/MicroserviceDemo/microservices/BloggingService.Host/Dockerfile new file mode 100644 index 0000000000..05e601031c --- /dev/null +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/microservices/BloggingService.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "BloggingService.Host.dll"] diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/Dockerfile b/samples/MicroserviceDemo/microservices/IdentityService.Host/Dockerfile new file mode 100644 index 0000000000..14038ef487 --- /dev/null +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/microservices/IdentityService.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "IdentityService.Host.dll"] diff --git a/samples/MicroserviceDemo/microservices/ProductService.Host/Dockerfile b/samples/MicroserviceDemo/microservices/ProductService.Host/Dockerfile new file mode 100644 index 0000000000..e716f68113 --- /dev/null +++ b/samples/MicroserviceDemo/microservices/ProductService.Host/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base +WORKDIR /app +EXPOSE 80 + +FROM microsoft/dotnet:2.2-sdk-alpine AS build +WORKDIR /src +COPY . . +WORKDIR "/src/samples/MicroserviceDemo/microservices/ProductService.Host" +RUN dotnet restore -nowarn:msb3202,nu1503 +RUN dotnet build --no-restore -c Release -o /app + +FROM build AS publish +RUN dotnet publish --no-restore -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "ProductService.Host.dll"] From fa0c64bb8e0a324e1eee2b543ed42d743db563d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20=C3=96zceviz?= Date: Thu, 7 Feb 2019 14:10:15 +0100 Subject: [PATCH 2/6] Added docker-compose files --- .../docker-compose.migrations.yml | 17 +++ .../docker-compose.override.yml | 143 ++++++++++++++++++ samples/MicroserviceDemo/docker-compose.yml | 114 ++++++++++++++ 3 files changed, 274 insertions(+) create mode 100644 samples/MicroserviceDemo/docker-compose.migrations.yml create mode 100644 samples/MicroserviceDemo/docker-compose.override.yml create mode 100644 samples/MicroserviceDemo/docker-compose.yml diff --git a/samples/MicroserviceDemo/docker-compose.migrations.yml b/samples/MicroserviceDemo/docker-compose.migrations.yml new file mode 100644 index 0000000000..8753be77e4 --- /dev/null +++ b/samples/MicroserviceDemo/docker-compose.migrations.yml @@ -0,0 +1,17 @@ +version: '3.0' + +services: + sqlserver: + environment: + - SA_PASSWORD=yourStrong(!)Password + - ACCEPT_EULA=Y + ports: + - "1433:1433" + + migrations: + image: 'microservice-demo/migrations:${TAG:-latest}' + build: + context: ../.. + dockerfile: samples/MicroserviceDemo/databases/Dockerfile + depends_on: + - sqlserver diff --git a/samples/MicroserviceDemo/docker-compose.override.yml b/samples/MicroserviceDemo/docker-compose.override.yml new file mode 100644 index 0000000000..66be7a6861 --- /dev/null +++ b/samples/MicroserviceDemo/docker-compose.override.yml @@ -0,0 +1,143 @@ +version: '3.0' +services: + sqlserver: + environment: + - SA_PASSWORD=yourStrong(!)Password + - ACCEPT_EULA=Y + ports: + - 1433:1433 + + mongodb: + ports: + - 27017:27017 + + rabbitmq: + ports: + - 15672:15672 + - 5672:5672 + + redis: + ports: + - 6379:6379 + + internal-gateway: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - AuthServer__Authority=http://auth-server:64999 + - ConnectionStrings__Default=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - Redis__Configuration=redis + - ReRoutes__0__DownstreamHostAndPorts__Host=identity-service + - ReRoutes__0__DownstreamHostAndPorts__Port=80 + - ReRoutes__1__DownstreamHostAndPorts__Host=product-service + - ReRoutes__1__DownstreamHostAndPorts__Port=80 + - ReRoutes__2__DownstreamHostAndPorts__Host=blogging-service + - ReRoutes__2__DownstreamHostAndPorts__Port=80 + - GlobalConfiguration__BaseUrl=http://internal-gateway + ports: + - 65129:80 + + backend-admin-app-gateway: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - RemoteServices__Default__BaseUrl=http://backend-admin-app-gateway/ + - AuthServer__Authority=http://auth-server:64999 + - ConnectionStrings__Default=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - Redis__Configuration=redis + - ReRoutes__0__DownstreamHostAndPorts__Host=identity-service + - ReRoutes__0__DownstreamHostAndPorts__Port=80 + - ReRoutes__1__DownstreamHostAndPorts__Host=product-service + - ReRoutes__1__DownstreamHostAndPorts__Port=80 + - GlobalConfiguration__BaseUrl=http://backend-admin-app-gateway + ports: + - 65115:80 + + public-website-gateway: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - AuthServer__Authority=http://auth-server:64999 + - ConnectionStrings__Default=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - Redis__Configuration=redis + - ReRoutes__0__DownstreamHostAndPorts__Host=product-service + - ReRoutes__0__DownstreamHostAndPorts__Port=80 + - ReRoutes__1__DownstreamHostAndPorts__Host=blogging-service + - ReRoutes__1__DownstreamHostAndPorts__Port=80 + - GlobalConfiguration__BaseUrl=http://public-website-gateway + ports: + - 64897:80 + + blogging-service: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - AuthServer__Authority=http://auth-server:64999 + - ConnectionStrings__Default=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__Blogging=mongodb://mongodb|MsDemo_Blogging + - Redis__Configuration=redis + - RabbitMQ__Connections__Default__HostName=rabbitmq + ports: + - 62157:80 + + identity-service: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - AuthServer__Authority=http://auth-server:64999 + - ConnectionStrings__Default=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - Redis__Configuration=redis + - RabbitMQ__Connections__Default__HostName=rabbitmq + ports: + - 63568:80 + + product-service: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - AuthServer__Authority=http://auth-server:64999 + - ConnectionStrings__Default=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__ProductManagement=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - Redis__Configuration=redis + - RabbitMQ__Connections__Default__HostName=rabbitmq + ports: + - 60244:80 + + auth-server: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:64999 + - ConnectionStrings__Default=Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - Redis__Configuration=redis + - RabbitMQ__Connections__Default__HostName=rabbitmq + ports: + - 64999:64999 + + backend-admin-app: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - AuthServer__Authority=http://auth-server:64999 + - RemoteServices__Default__BaseUrl=http://backend-admin-app-gateway/ + - Redis__Configuration=redis + ports: + - 3000:80 + + console-client-demo: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - RemoteServices__Default__BaseUrl=http://internal-gateway/ + - IdentityClients__Default__Authority=http://auth-server:64999 + ports: + - 3001:80 + + public-website: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - AuthServer__Authority=http://auth-server:64999 + - RemoteServices__Default__BaseUrl=http://public-website-gateway/ + - Redis__Configuration=redis + ports: + - 3002:80 diff --git a/samples/MicroserviceDemo/docker-compose.yml b/samples/MicroserviceDemo/docker-compose.yml new file mode 100644 index 0000000000..7c2d6e0cd7 --- /dev/null +++ b/samples/MicroserviceDemo/docker-compose.yml @@ -0,0 +1,114 @@ +version: '3.0' + +services: + sqlserver: + image: mcr.microsoft.com/mssql/server + volumes: + - dbdata:/var/opt/mssql + + mongodb: + image: mongo + + rabbitmq: + image: 'rabbitmq:3-management-alpine' + + redis: + image: redis + + internal-gateway: + image: 'microservice-demo/internal-gateway:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/gateways/InternalGateway.Host/Dockerfile + depends_on: + - redis + - sqlserver + - identity-service + - product-service + - blogging-service + + backend-admin-app-gateway: + image: 'microservice-demo/backend-admin-app-gateway:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/Dockerfile + depends_on: + - redis + - sqlserver + - identity-service + - product-service + + public-website-gateway: + image: 'microservice-demo/public-website-gateway:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/Dockerfile + depends_on: + - redis + - blogging-service + - product-service + + blogging-service: + image: 'microservice-demo/blogging-service:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/microservices/BloggingService.Host/Dockerfile + depends_on: + - mongodb + - redis + + identity-service: + image: 'microservice-demo/identity-service:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/microservices/IdentityService.Host/Dockerfile + depends_on: + - rabbitmq + - redis + - sqlserver + + product-service: + image: 'microservice-demo/product-service:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/microservices/ProductService.Host/Dockerfile + depends_on: + - sqlserver + - redis + + auth-server: + image: 'microservice-demo/auth-server:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/applications/AuthServer.Host/Dockerfile + depends_on: + - redis + - rabbitmq + - identity-service + + backend-admin-app: + image: 'microservice-demo/backend-admin-app:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/applications/BackendAdminApp.Host/Dockerfile + depends_on: + - backend-admin-app-gateway + + console-client-demo: + image: 'microservice-demo/console-client-demo:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/applications/ConsoleClientDemo/Dockerfile + depends_on: + - internal-gateway + + public-website: + image: 'microservice-demo/public-website:${TAG:-latest}' + build: + context: ../../ + dockerfile: samples/MicroserviceDemo/applications/PublicWebSite.Host/Dockerfile + depends_on: + - public-website-gateway + +volumes: + dbdata: \ No newline at end of file From d1c08aa5697049e8d99a67152f8c96f368b324d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20=C3=96zceviz?= Date: Thu, 7 Feb 2019 14:10:57 +0100 Subject: [PATCH 3/6] Created entrypoint for migrations --- samples/MicroserviceDemo/databases/entrypoint.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 samples/MicroserviceDemo/databases/entrypoint.sh diff --git a/samples/MicroserviceDemo/databases/entrypoint.sh b/samples/MicroserviceDemo/databases/entrypoint.sh new file mode 100644 index 0000000000..31f4fa7920 --- /dev/null +++ b/samples/MicroserviceDemo/databases/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd /src/ProductService.Host + +until dotnet ef database update --no-build; do +>&2 echo "SQL Server is starting up" +sleep 1 +done + +cd /src/AuthServer.Host && dotnet ef database update --no-build \ No newline at end of file From 9ad9a25c2585c2f9e570ab19b626e96f00350f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20=C3=96zceviz?= Date: Thu, 7 Feb 2019 15:20:53 +0100 Subject: [PATCH 4/6] Created .dockerignore file --- samples/MicroserviceDemo/.dockerignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 samples/MicroserviceDemo/.dockerignore diff --git a/samples/MicroserviceDemo/.dockerignore b/samples/MicroserviceDemo/.dockerignore new file mode 100644 index 0000000000..3a78c9d4c3 --- /dev/null +++ b/samples/MicroserviceDemo/.dockerignore @@ -0,0 +1,13 @@ +node_modules +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +.env +*/bin +*/obj +README.md +LICENSE +.vscode \ No newline at end of file From e85c396715e73318735096da830e0c781a639e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20=C3=96zceviz?= Date: Thu, 7 Feb 2019 15:25:56 +0100 Subject: [PATCH 5/6] Created kubernetes yaml files --- .../k8s/auth-server-deployment.yaml | 35 +++++++++++++ .../k8s/auth-server-service.yaml | 15 ++++++ .../k8s/backend-admin-app-deployment.yaml | 34 +++++++++++++ .../backend-admin-app-gateway-deployment.yaml | 47 ++++++++++++++++++ .../backend-admin-app-gateway-service.yaml | 15 ++++++ .../k8s/backend-admin-app-service.yaml | 15 ++++++ .../k8s/blogging-service-deployment.yaml | 39 +++++++++++++++ .../k8s/blogging-service-service.yaml | 15 ++++++ .../k8s/console-client-demo-deployment.yaml | 32 ++++++++++++ .../k8s/console-client-demo-service.yaml | 15 ++++++ .../k8s/dbdata-persistentvolumeclaim.yaml | 13 +++++ .../k8s/identity-service-deployment.yaml | 37 ++++++++++++++ .../k8s/identity-service-service.yaml | 15 ++++++ .../k8s/internal-gateway-deployment.yaml | 49 +++++++++++++++++++ .../k8s/internal-gateway-service.yaml | 15 ++++++ .../k8s/migrations-deployment.yaml | 21 ++++++++ .../MicroserviceDemo/k8s/migrations-job.yaml | 12 +++++ .../k8s/mongodb-deployment.yaml | 23 +++++++++ .../MicroserviceDemo/k8s/mongodb-service.yaml | 15 ++++++ .../k8s/product-service-deployment.yaml | 40 +++++++++++++++ .../k8s/product-service-service.yaml | 15 ++++++ .../k8s/public-website-deployment.yaml | 34 +++++++++++++ .../public-website-gateway-deployment.yaml | 45 +++++++++++++++++ .../k8s/public-website-gateway-service.yaml | 15 ++++++ .../k8s/public-website-service.yaml | 15 ++++++ .../k8s/rabbitmq-deployment.yaml | 24 +++++++++ .../k8s/rabbitmq-service.yaml | 18 +++++++ .../k8s/redis-deployment.yaml | 23 +++++++++ .../MicroserviceDemo/k8s/redis-service.yaml | 15 ++++++ .../k8s/sqlserver-deployment.yaml | 36 ++++++++++++++ .../k8s/sqlserver-service.yaml | 15 ++++++ 31 files changed, 757 insertions(+) create mode 100644 samples/MicroserviceDemo/k8s/auth-server-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/auth-server-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/backend-admin-app-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/backend-admin-app-gateway-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/backend-admin-app-gateway-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/backend-admin-app-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/blogging-service-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/blogging-service-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/console-client-demo-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/console-client-demo-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/dbdata-persistentvolumeclaim.yaml create mode 100644 samples/MicroserviceDemo/k8s/identity-service-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/identity-service-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/internal-gateway-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/internal-gateway-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/migrations-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/migrations-job.yaml create mode 100644 samples/MicroserviceDemo/k8s/mongodb-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/mongodb-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/product-service-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/product-service-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/public-website-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/public-website-gateway-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/public-website-gateway-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/public-website-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/rabbitmq-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/rabbitmq-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/redis-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/redis-service.yaml create mode 100644 samples/MicroserviceDemo/k8s/sqlserver-deployment.yaml create mode 100644 samples/MicroserviceDemo/k8s/sqlserver-service.yaml diff --git a/samples/MicroserviceDemo/k8s/auth-server-deployment.yaml b/samples/MicroserviceDemo/k8s/auth-server-deployment.yaml new file mode 100644 index 0000000000..b2307834d2 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/auth-server-deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: auth-server + name: auth-server +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: auth-server + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:64999 + - name: ConnectionStrings__Default + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: RabbitMQ__Connections__Default__HostName + value: rabbitmq + - name: Redis__Configuration + value: redis + image: microservice-demo/auth-server:latest + name: auth-server + ports: + - containerPort: 64999 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/auth-server-service.yaml b/samples/MicroserviceDemo/k8s/auth-server-service.yaml new file mode 100644 index 0000000000..c96e9c3e3d --- /dev/null +++ b/samples/MicroserviceDemo/k8s/auth-server-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: auth-server + name: auth-server +spec: + ports: + - name: "64999" + port: 64999 + targetPort: 64999 + selector: + io.kompose.service: auth-server +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/backend-admin-app-deployment.yaml b/samples/MicroserviceDemo/k8s/backend-admin-app-deployment.yaml new file mode 100644 index 0000000000..ce6c238f7c --- /dev/null +++ b/samples/MicroserviceDemo/k8s/backend-admin-app-deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: backend-admin-app + name: backend-admin-app +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: backend-admin-app + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: Redis__Configuration + value: redis + - name: RemoteServices__Default__BaseUrl + value: http://backend-admin-app-gateway/ + image: microservice-demo/backend-admin-app:latest + name: backend-admin-app + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/backend-admin-app-gateway-deployment.yaml b/samples/MicroserviceDemo/k8s/backend-admin-app-gateway-deployment.yaml new file mode 100644 index 0000000000..10490961e5 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/backend-admin-app-gateway-deployment.yaml @@ -0,0 +1,47 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: backend-admin-app-gateway + name: backend-admin-app-gateway +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: backend-admin-app-gateway + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: ConnectionStrings__Default + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: GlobalConfiguration__BaseUrl + value: http://backend-admin-app-gateway + - name: ReRoutes__0__DownstreamHostAndPorts__Host + value: identity-service + - name: ReRoutes__0__DownstreamHostAndPorts__Port + value: "80" + - name: ReRoutes__1__DownstreamHostAndPorts__Host + value: product-service + - name: ReRoutes__1__DownstreamHostAndPorts__Port + value: "80" + - name: Redis__Configuration + value: redis + - name: RemoteServices__Default__BaseUrl + value: http://backend-admin-app-gateway/ + image: microservice-demo/backend-admin-app-gateway:latest + name: backend-admin-app-gateway + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/backend-admin-app-gateway-service.yaml b/samples/MicroserviceDemo/k8s/backend-admin-app-gateway-service.yaml new file mode 100644 index 0000000000..ca3faee62c --- /dev/null +++ b/samples/MicroserviceDemo/k8s/backend-admin-app-gateway-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: backend-admin-app-gateway + name: backend-admin-app-gateway +spec: + ports: + - name: "65115" + port: 65115 + targetPort: 80 + selector: + io.kompose.service: backend-admin-app-gateway +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/backend-admin-app-service.yaml b/samples/MicroserviceDemo/k8s/backend-admin-app-service.yaml new file mode 100644 index 0000000000..f735fdae1c --- /dev/null +++ b/samples/MicroserviceDemo/k8s/backend-admin-app-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: backend-admin-app + name: backend-admin-app +spec: + ports: + - name: "3000" + port: 3000 + targetPort: 80 + selector: + io.kompose.service: backend-admin-app +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/blogging-service-deployment.yaml b/samples/MicroserviceDemo/k8s/blogging-service-deployment.yaml new file mode 100644 index 0000000000..a5b801106b --- /dev/null +++ b/samples/MicroserviceDemo/k8s/blogging-service-deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: blogging-service + name: blogging-service +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: blogging-service + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: ConnectionStrings__Blogging + value: mongodb://mongodb|MsDemo_Blogging + - name: ConnectionStrings__Default + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: RabbitMQ__Connections__Default__HostName + value: rabbitmq + - name: Redis__Configuration + value: redis + image: microservice-demo/blogging-service:latest + name: blogging-service + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/blogging-service-service.yaml b/samples/MicroserviceDemo/k8s/blogging-service-service.yaml new file mode 100644 index 0000000000..d0ab95528e --- /dev/null +++ b/samples/MicroserviceDemo/k8s/blogging-service-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: blogging-service + name: blogging-service +spec: + ports: + - name: "62157" + port: 62157 + targetPort: 80 + selector: + io.kompose.service: blogging-service +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/console-client-demo-deployment.yaml b/samples/MicroserviceDemo/k8s/console-client-demo-deployment.yaml new file mode 100644 index 0000000000..4ccfd788be --- /dev/null +++ b/samples/MicroserviceDemo/k8s/console-client-demo-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: console-client-demo + name: console-client-demo +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: console-client-demo + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: IdentityClients__Default__Authority + value: http://auth-server:64999 + - name: RemoteServices__Default__BaseUrl + value: http://internal-gateway/ + image: microservice-demo/console-client-demo:latest + name: console-client-demo + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/console-client-demo-service.yaml b/samples/MicroserviceDemo/k8s/console-client-demo-service.yaml new file mode 100644 index 0000000000..5146110356 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/console-client-demo-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: console-client-demo + name: console-client-demo +spec: + ports: + - name: "3001" + port: 3001 + targetPort: 80 + selector: + io.kompose.service: console-client-demo +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/dbdata-persistentvolumeclaim.yaml b/samples/MicroserviceDemo/k8s/dbdata-persistentvolumeclaim.yaml new file mode 100644 index 0000000000..c8d0dd1f0f --- /dev/null +++ b/samples/MicroserviceDemo/k8s/dbdata-persistentvolumeclaim.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: dbdata + name: dbdata +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/samples/MicroserviceDemo/k8s/identity-service-deployment.yaml b/samples/MicroserviceDemo/k8s/identity-service-deployment.yaml new file mode 100644 index 0000000000..4df2099e49 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/identity-service-deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: identity-service + name: identity-service +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: identity-service + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: ConnectionStrings__Default + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: RabbitMQ__Connections__Default__HostName + value: rabbitmq + - name: Redis__Configuration + value: redis + image: microservice-demo/identity-service:latest + name: identity-service + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/identity-service-service.yaml b/samples/MicroserviceDemo/k8s/identity-service-service.yaml new file mode 100644 index 0000000000..8c601852a3 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/identity-service-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: identity-service + name: identity-service +spec: + ports: + - name: "63568" + port: 63568 + targetPort: 80 + selector: + io.kompose.service: identity-service +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/internal-gateway-deployment.yaml b/samples/MicroserviceDemo/k8s/internal-gateway-deployment.yaml new file mode 100644 index 0000000000..4abd77f1df --- /dev/null +++ b/samples/MicroserviceDemo/k8s/internal-gateway-deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: internal-gateway + name: internal-gateway +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: internal-gateway + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: ConnectionStrings__Default + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: GlobalConfiguration__BaseUrl + value: http://internal-gateway + - name: ReRoutes__0__DownstreamHostAndPorts__Host + value: identity-service + - name: ReRoutes__0__DownstreamHostAndPorts__Port + value: "80" + - name: ReRoutes__1__DownstreamHostAndPorts__Host + value: product-service + - name: ReRoutes__1__DownstreamHostAndPorts__Port + value: "80" + - name: ReRoutes__2__DownstreamHostAndPorts__Host + value: blogging-service + - name: ReRoutes__2__DownstreamHostAndPorts__Port + value: "80" + - name: Redis__Configuration + value: redis + image: microservice-demo/internal-gateway:latest + name: internal-gateway + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/internal-gateway-service.yaml b/samples/MicroserviceDemo/k8s/internal-gateway-service.yaml new file mode 100644 index 0000000000..5b392f5619 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/internal-gateway-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: internal-gateway + name: internal-gateway +spec: + ports: + - name: "65129" + port: 65129 + targetPort: 80 + selector: + io.kompose.service: internal-gateway +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/migrations-deployment.yaml b/samples/MicroserviceDemo/k8s/migrations-deployment.yaml new file mode 100644 index 0000000000..bae8d1388b --- /dev/null +++ b/samples/MicroserviceDemo/k8s/migrations-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: migrations + name: migrations +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: migrations + spec: + containers: + - image: microservice-demo/migrations:latest + name: migrations + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/migrations-job.yaml b/samples/MicroserviceDemo/k8s/migrations-job.yaml new file mode 100644 index 0000000000..257393379e --- /dev/null +++ b/samples/MicroserviceDemo/k8s/migrations-job.yaml @@ -0,0 +1,12 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: migrations +spec: + template: + spec: + containers: + - image: microservice-demo/migrations:latest + name: migrations + imagePullPolicy: Never + restartPolicy: Never diff --git a/samples/MicroserviceDemo/k8s/mongodb-deployment.yaml b/samples/MicroserviceDemo/k8s/mongodb-deployment.yaml new file mode 100644 index 0000000000..48617c488c --- /dev/null +++ b/samples/MicroserviceDemo/k8s/mongodb-deployment.yaml @@ -0,0 +1,23 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: mongodb + name: mongodb +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: mongodb + spec: + containers: + - image: mongo + name: mongodb + ports: + - containerPort: 27017 + resources: {} + imagePullPolicy: IfNotPresent + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/mongodb-service.yaml b/samples/MicroserviceDemo/k8s/mongodb-service.yaml new file mode 100644 index 0000000000..59480974ff --- /dev/null +++ b/samples/MicroserviceDemo/k8s/mongodb-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: mongodb + name: mongodb +spec: + ports: + - name: "27017" + port: 27017 + targetPort: 27017 + selector: + io.kompose.service: mongodb +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/product-service-deployment.yaml b/samples/MicroserviceDemo/k8s/product-service-deployment.yaml new file mode 100644 index 0000000000..5418a8abc7 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/product-service-deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: product-service + name: product-service +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: product-service + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: ConnectionStrings__Default + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: ConnectionStrings__ProductManagement + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: RabbitMQ__Connections__Default__HostName + value: rabbitmq + - name: Redis__Configuration + value: redis + image: microservice-demo/product-service:latest + name: product-service + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/product-service-service.yaml b/samples/MicroserviceDemo/k8s/product-service-service.yaml new file mode 100644 index 0000000000..25b52f9d7c --- /dev/null +++ b/samples/MicroserviceDemo/k8s/product-service-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: product-service + name: product-service +spec: + ports: + - name: "60244" + port: 60244 + targetPort: 80 + selector: + io.kompose.service: product-service +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/public-website-deployment.yaml b/samples/MicroserviceDemo/k8s/public-website-deployment.yaml new file mode 100644 index 0000000000..3c8955a99b --- /dev/null +++ b/samples/MicroserviceDemo/k8s/public-website-deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: public-website + name: public-website +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: public-website + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: Redis__Configuration + value: redis + - name: RemoteServices__Default__BaseUrl + value: http://public-website-gateway/ + image: microservice-demo/public-website:latest + name: public-website + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/public-website-gateway-deployment.yaml b/samples/MicroserviceDemo/k8s/public-website-gateway-deployment.yaml new file mode 100644 index 0000000000..9532d9334f --- /dev/null +++ b/samples/MicroserviceDemo/k8s/public-website-gateway-deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: public-website-gateway + name: public-website-gateway +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: public-website-gateway + spec: + containers: + - env: + - name: ASPNETCORE_ENVIRONMENT + value: Development + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: AuthServer__Authority + value: http://auth-server:64999 + - name: ConnectionStrings__Default + value: Server=sqlserver;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated + Security=false + - name: GlobalConfiguration__BaseUrl + value: http://public-website-gateway + - name: ReRoutes__0__DownstreamHostAndPorts__Host + value: product-service + - name: ReRoutes__0__DownstreamHostAndPorts__Port + value: "80" + - name: ReRoutes__1__DownstreamHostAndPorts__Host + value: blogging-service + - name: ReRoutes__1__DownstreamHostAndPorts__Port + value: "80" + - name: Redis__Configuration + value: redis + image: microservice-demo/public-website-gateway:latest + name: public-website-gateway + ports: + - containerPort: 80 + resources: {} + imagePullPolicy: Never + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/public-website-gateway-service.yaml b/samples/MicroserviceDemo/k8s/public-website-gateway-service.yaml new file mode 100644 index 0000000000..4c007686b7 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/public-website-gateway-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: public-website-gateway + name: public-website-gateway +spec: + ports: + - name: "64897" + port: 64897 + targetPort: 80 + selector: + io.kompose.service: public-website-gateway +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/public-website-service.yaml b/samples/MicroserviceDemo/k8s/public-website-service.yaml new file mode 100644 index 0000000000..77fac13ac3 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/public-website-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: public-website + name: public-website +spec: + ports: + - name: "3002" + port: 3002 + targetPort: 80 + selector: + io.kompose.service: public-website +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/rabbitmq-deployment.yaml b/samples/MicroserviceDemo/k8s/rabbitmq-deployment.yaml new file mode 100644 index 0000000000..5f32e398c1 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/rabbitmq-deployment.yaml @@ -0,0 +1,24 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: rabbitmq + name: rabbitmq +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: rabbitmq + spec: + containers: + - image: rabbitmq:3-management-alpine + name: rabbitmq + ports: + - containerPort: 5672 + - containerPort: 15672 + resources: {} + imagePullPolicy: IfNotPresent + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/rabbitmq-service.yaml b/samples/MicroserviceDemo/k8s/rabbitmq-service.yaml new file mode 100644 index 0000000000..b8595193e8 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/rabbitmq-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: rabbitmq + name: rabbitmq +spec: + ports: + - name: "5672" + port: 5672 + targetPort: 5672 + - name: "15672" + port: 15672 + targetPort: 15672 + selector: + io.kompose.service: rabbitmq +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/redis-deployment.yaml b/samples/MicroserviceDemo/k8s/redis-deployment.yaml new file mode 100644 index 0000000000..b4389df699 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/redis-deployment.yaml @@ -0,0 +1,23 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + strategy: {} + template: + metadata: + labels: + io.kompose.service: redis + spec: + containers: + - image: redis + name: redis + ports: + - containerPort: 6379 + resources: {} + imagePullPolicy: IfNotPresent + restartPolicy: Always +status: {} diff --git a/samples/MicroserviceDemo/k8s/redis-service.yaml b/samples/MicroserviceDemo/k8s/redis-service.yaml new file mode 100644 index 0000000000..702eaab08c --- /dev/null +++ b/samples/MicroserviceDemo/k8s/redis-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: redis + name: redis +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis +status: + loadBalancer: {} diff --git a/samples/MicroserviceDemo/k8s/sqlserver-deployment.yaml b/samples/MicroserviceDemo/k8s/sqlserver-deployment.yaml new file mode 100644 index 0000000000..568f29ab4d --- /dev/null +++ b/samples/MicroserviceDemo/k8s/sqlserver-deployment.yaml @@ -0,0 +1,36 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + io.kompose.service: sqlserver + name: sqlserver +spec: + replicas: 1 + strategy: + type: Recreate + template: + metadata: + labels: + io.kompose.service: sqlserver + spec: + containers: + - env: + - name: ACCEPT_EULA + value: "Y" + - name: SA_PASSWORD + value: yourStrong(!)Password + image: mcr.microsoft.com/mssql/server + name: sqlserver + ports: + - containerPort: 1433 + resources: {} + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /var/opt/mssql + name: dbdata + restartPolicy: Always + volumes: + - name: dbdata + persistentVolumeClaim: + claimName: dbdata +status: {} diff --git a/samples/MicroserviceDemo/k8s/sqlserver-service.yaml b/samples/MicroserviceDemo/k8s/sqlserver-service.yaml new file mode 100644 index 0000000000..57e77a1b42 --- /dev/null +++ b/samples/MicroserviceDemo/k8s/sqlserver-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: sqlserver + name: sqlserver +spec: + ports: + - name: "1433" + port: 1433 + targetPort: 1433 + selector: + io.kompose.service: sqlserver +status: + loadBalancer: {} From 9141242b2806584fe06bf8963ebe62e8a42cc546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20=C3=96zceviz?= Date: Thu, 7 Feb 2019 15:28:29 +0100 Subject: [PATCH 6/6] Created bash script for deploying to kubernetes --- samples/MicroserviceDemo/DeployToKubernetes.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 samples/MicroserviceDemo/DeployToKubernetes.sh diff --git a/samples/MicroserviceDemo/DeployToKubernetes.sh b/samples/MicroserviceDemo/DeployToKubernetes.sh new file mode 100755 index 0000000000..8ca8667878 --- /dev/null +++ b/samples/MicroserviceDemo/DeployToKubernetes.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +export SHELL="/bin/bash" + +minikube start + +eval $(minikube docker-env) +docker-compose -f docker-compose.yml -f docker-compose.migrations.yml -f docker-compose.override.yml build + +cd ./k8s +kubectl create -f $(ls -x | grep .yaml | grep -v deployment | tr " \t\n\r" "," | sed 's/.$//') +kubectl create -f $(ls -x | grep .yaml | grep deployment | tr " \t\n\r" "," | sed 's/.$//')