From 9ede5f0522f94f62d1701eea82103e4a29c93708 Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Wed, 14 Sep 2016 21:37:48 -0700 Subject: [PATCH] Ordering.API integrated and working now on the solutions's docker-compose.yml. Also created an independent docker-compose.yml for the Ordering.API microservice to deploy and test in isolation. --- docker-compose.yml | 15 +++++++++- src/Services/Ordering/Ordering.API/Dockerfile | 28 +++++++++---------- src/Services/Ordering/Ordering.API/Startup.cs | 2 +- .../Ordering/Ordering.API/docker-compose.yml | 11 ++++---- .../UnitOfWork/DBContextUtil.cs | 2 +- .../UnitOfWork/OrderingDbContext.cs | 2 +- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 72142bd45..0e662d94e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: - "80:80" depends_on: - catalog.api + catalog.api: image: eshop/catalog.api environment: @@ -17,5 +18,17 @@ services: - "80" depends_on: - catalogdata + catalogdata: - image: glennc/eshopdata \ No newline at end of file + image: glennc/eshopdata + + ordering.api: + image: eshop/ordering.api + environment: + - ConnectionString=TBD + expose: + - "80" + ports: + - "81:80" + extra_hosts: + - "CESARDLBOOKVHD:10.0.75.1" diff --git a/src/Services/Ordering/Ordering.API/Dockerfile b/src/Services/Ordering/Ordering.API/Dockerfile index 73fbf1c1d..95f6db16f 100644 --- a/src/Services/Ordering/Ordering.API/Dockerfile +++ b/src/Services/Ordering/Ordering.API/Dockerfile @@ -1,30 +1,30 @@ -FROM microsoft/dotnet:1.0.0-preview2-sdk +FROM microsoft/aspnetcore +# Other .NET images +# FROM microsoft/dotnet:1.0.0-preview2-sdk +# FROM microsoft/dotnet:1.0.0-core -#Lighter image if copying the compiled app and entrypoint as ENTRYPOINT dotnet Ordering.API.dll -#FROM microsoft/dotnet:1.0.0-core - -# Set the Working Directory WORKDIR /app +EXPOSE 80 # Configure the listening port to 80 -ENV ASPNETCORE_URLS http://*:80 +# ENV ASPNETCORE_URLS http://*:80 -# Open port exposed by Docker -EXPOSE 80/tcp +ADD . /app +# COPY . /app -# Copy the app -COPY . /app +# Entry point through the copied assembly +ENTRYPOINT dotnet Ordering.API.dll ################# +# Entry point running the SDK --> Requires heavy Docker .NET image, not for production # Restore NuGet packages #RUN ["dotnet", "restore"] - # Build the .NET Core app #RUN ["dotnet", "build"] - # Entrypoint #ENTRYPOINT ["dotnet", "run"] ################# -# Entry point through the copied assembly -ENTRYPOINT dotnet Ordering.API.dll \ No newline at end of file + + + diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index cda11d529..ab493b335 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -46,7 +46,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API //var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;Trusted_Connection=True;"; //(SQL Server Authentication) - var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"; + var connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"; //(TBD) connString = config.GetConnectionString("SqlStandardAuthentication.OrderingDb"); diff --git a/src/Services/Ordering/Ordering.API/docker-compose.yml b/src/Services/Ordering/Ordering.API/docker-compose.yml index 288e759c6..0eb73b061 100644 --- a/src/Services/Ordering/Ordering.API/docker-compose.yml +++ b/src/Services/Ordering/Ordering.API/docker-compose.yml @@ -1,12 +1,11 @@ version: '2' services: - microsoft.eshoponcontainers.services.ordering.api: - image: username/microsoft.eshoponcontainers.services.ordering.api - build: - context: . - dockerfile: Dockerfile + ordering.api: + image: eshop/ordering.api + environment: + - ConnectionString=TBD ports: - - "80:80" + - "81:80" extra_hosts: - "CESARDLBOOKVHD:10.0.75.1" \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.SqlData/UnitOfWork/DBContextUtil.cs b/src/Services/Ordering/Ordering.SqlData/UnitOfWork/DBContextUtil.cs index 4766c38d0..3672653f2 100644 --- a/src/Services/Ordering/Ordering.SqlData/UnitOfWork/DBContextUtil.cs +++ b/src/Services/Ordering/Ordering.SqlData/UnitOfWork/DBContextUtil.cs @@ -39,7 +39,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork //(Integrated Security) var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;Trusted_Connection=True;"; //(SQL Server Authentication) - var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"; + var connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"; //SQL LOCALDB builder.UseSqlServer(connString); diff --git a/src/Services/Ordering/Ordering.SqlData/UnitOfWork/OrderingDbContext.cs b/src/Services/Ordering/Ordering.SqlData/UnitOfWork/OrderingDbContext.cs index 25ce0430c..45fd50a59 100644 --- a/src/Services/Ordering/Ordering.SqlData/UnitOfWork/OrderingDbContext.cs +++ b/src/Services/Ordering/Ordering.SqlData/UnitOfWork/OrderingDbContext.cs @@ -31,7 +31,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork //var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;Trusted_Connection=True;"; //(SQL Server Authentication) - var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"; + var connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"; //SQL LOCALDB optionsBuilder.UseSqlServer(connString);