Browse Source

Base path fix and k8s config updated

pull/333/head
Eduard Tomàs 7 years ago
parent
commit
7321d5e5fc
12 changed files with 89 additions and 22 deletions
  1. +18
    -18
      k8s/deployments.yaml
  2. +6
    -4
      k8s/gen-k8s-env.ps1
  3. +6
    -0
      src/Services/Basket/Basket.API/Startup.cs
  4. +7
    -0
      src/Services/Catalog/Catalog.API/Startup.cs
  5. +7
    -0
      src/Services/Identity/Identity.API/Startup.cs
  6. +6
    -0
      src/Services/Location/Locations.API/Startup.cs
  7. +6
    -0
      src/Services/Marketing/Marketing.API/Startup.cs
  8. +7
    -0
      src/Services/Ordering/Ordering.API/Startup.cs
  9. +6
    -0
      src/Services/Payment/Payment.API/Startup.cs
  10. +7
    -0
      src/Web/WebMVC/Startup.cs
  11. +7
    -0
      src/Web/WebSPA/Startup.cs
  12. +6
    -0
      src/Web/WebStatus/Startup.cs

+ 18
- 18
k8s/deployments.yaml View File

@ -15,8 +15,8 @@ spec:
image: eshop/basket.api image: eshop/basket.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/basket-api
- name: PATH_BASE
value: /basket-api
- name: ConnectionString - name: ConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -59,8 +59,8 @@ spec:
image: eshop/catalog.api image: eshop/catalog.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/catalog-api
- name: PATH_BASE
value: /catalog-api
- name: ConnectionString - name: ConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -103,8 +103,8 @@ spec:
image: eshop/identity.api image: eshop/identity.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/identity
- name: PATH_BASE
value: /identity
- name: ConnectionStrings__DefaultConnection - name: ConnectionStrings__DefaultConnection
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -169,8 +169,8 @@ spec:
image: eshop/ordering.api image: eshop/ordering.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/ordering-api
- name: PATH_BASE
value: /ordering-api
- name: ConnectionString - name: ConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -213,8 +213,8 @@ spec:
image: eshop/locations.api image: eshop/locations.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/locations-api
- name: PATH_BASE
value: /locations-api
- name: ConnectionString - name: ConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -267,8 +267,8 @@ spec:
image: eshop/marketing.api image: eshop/marketing.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/marketing-api
- name: PATH_BASE
value: /marketing-api
- name: ConnectionString - name: ConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -331,8 +331,8 @@ spec:
image: eshop/payment.api image: eshop/payment.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/payment-api
- name: PATH_BASE
value: /payment-api
- name: AzureServiceBusEnabled - name: AzureServiceBusEnabled
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -365,8 +365,8 @@ spec:
image: eshop/webmvc image: eshop/webmvc
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/webmvc
- name: PATH_BASE
value: /webmvc
- name: DPConnectionString - name: DPConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -426,8 +426,8 @@ spec:
image: eshop/webstatus image: eshop/webstatus
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/webstatus
- name: PATH_BASE
value: /webstatus
- name: BasketUrl - name: BasketUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:


+ 6
- 4
k8s/gen-k8s-env.ps1 View File

@ -1,7 +1,7 @@
Param( Param(
[parameter(Mandatory=$true)][string]$resourceGroupName, [parameter(Mandatory=$true)][string]$resourceGroupName,
[parameter(Mandatory=$true)][string]$location, [parameter(Mandatory=$true)][string]$location,
[parameter(Mandatory=$true)][string]$registryName,
[parameter(Mandatory=$false)][string]$registryName,
[parameter(Mandatory=$true)][string]$orchestratorName, [parameter(Mandatory=$true)][string]$orchestratorName,
[parameter(Mandatory=$true)][string]$dnsName, [parameter(Mandatory=$true)][string]$dnsName,
[parameter(Mandatory=$true)][string]$createAcr=$true [parameter(Mandatory=$true)][string]$createAcr=$true
@ -11,7 +11,7 @@
Write-Host "Creating resource group..." -ForegroundColor Yellow Write-Host "Creating resource group..." -ForegroundColor Yellow
az group create --name=$resourceGroupName --location=$location az group create --name=$resourceGroupName --location=$location
if ($createAcr) {
if ($createAcr -eq $true) {
# Create Azure Container Registry # Create Azure Container Registry
Write-Host "Creating Azure Container Registry..." -ForegroundColor Yellow Write-Host "Creating Azure Container Registry..." -ForegroundColor Yellow
az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic
@ -24,5 +24,7 @@ az acs create --orchestrator-type=kubernetes --resource-group $resourceGroupName
# Retrieve kubernetes cluster configuration and save it under ~/.kube/config # Retrieve kubernetes cluster configuration and save it under ~/.kube/config
az acs kubernetes get-credentials --resource-group=$resourceGroupName --name=$orchestratorName az acs kubernetes get-credentials --resource-group=$resourceGroupName --name=$orchestratorName
# Show ACR credentials
az acr credential show -n $registryName
if ($createAcr -eq $true) {
# Show ACR credentials
az acr credential show -n $registryName
}

+ 6
- 0
src/Services/Basket/Basket.API/Startup.cs View File

@ -169,6 +169,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env) public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{ {
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
app.UseStaticFiles(); app.UseStaticFiles();
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");


+ 7
- 0
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -167,6 +167,13 @@
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
app.UseMvcWithDefaultRoute(); app.UseMvcWithDefaultRoute();


+ 7
- 0
src/Services/Identity/Identity.API/Startup.cs View File

@ -125,6 +125,13 @@ namespace eShopOnContainers.Identity
app.UseExceptionHandler("/Home/Error"); app.UseExceptionHandler("/Home/Error");
} }
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseStaticFiles(); app.UseStaticFiles();


+ 6
- 0
src/Services/Location/Locations.API/Startup.cs View File

@ -141,6 +141,12 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{ {
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);


+ 6
- 0
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -173,6 +173,12 @@
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env,ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IHostingEnvironment env,ILoggerFactory loggerFactory)
{ {
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);


+ 7
- 0
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -189,6 +189,13 @@
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);


+ 6
- 0
src/Services/Payment/Payment.API/Startup.cs View File

@ -92,6 +92,12 @@ namespace Payment.API
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env) public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{ {
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
app.UseMvcWithDefaultRoute(); app.UseMvcWithDefaultRoute();
app.UseSwagger() app.UseSwagger()


+ 7
- 0
src/Web/WebMVC/Startup.cs View File

@ -123,6 +123,13 @@ namespace Microsoft.eShopOnContainers.WebMVC
app.UseExceptionHandler("/Error"); app.UseExceptionHandler("/Error");
} }
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseSession(); app.UseSession();
app.UseStaticFiles(); app.UseStaticFiles();


+ 7
- 0
src/Web/WebSPA/Startup.cs View File

@ -95,6 +95,13 @@ namespace eShopConContainers.WebSPA
//Seed Data //Seed Data
WebContextSeed.Seed(app, env, loggerFactory); WebContextSeed.Seed(app, env, loggerFactory);
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.Use(async (context, next) => app.Use(async (context, next) =>
{ {
await next(); await next();


+ 6
- 0
src/Web/WebStatus/Startup.cs View File

@ -60,6 +60,12 @@ namespace WebStatus
app.UseExceptionHandler("/Home/Error"); app.UseExceptionHandler("/Home/Error");
} }
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
app.UseStaticFiles(); app.UseStaticFiles();
app.UseMvc(routes => app.UseMvc(routes =>


Loading…
Cancel
Save