Base path fix and k8s config updated

This commit is contained in:
Eduard Tomàs 2017-09-07 19:18:53 +02:00
parent 0f1d904459
commit 7321d5e5fc
12 changed files with 89 additions and 22 deletions

View File

@ -15,8 +15,8 @@ spec:
image: eshop/basket.api image: eshop/basket.api
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: ASPNETCORE_URLS - name: PATH_BASE
value: http://0.0.0.0:80/basket-api 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 - name: PATH_BASE
value: http://0.0.0.0:80/catalog-api 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 - name: PATH_BASE
value: http://0.0.0.0:80/identity 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 - name: PATH_BASE
value: http://0.0.0.0:80/ordering-api 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 - name: PATH_BASE
value: http://0.0.0.0:80/locations-api 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 - name: PATH_BASE
value: http://0.0.0.0:80/marketing-api 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 - name: PATH_BASE
value: http://0.0.0.0:80/payment-api 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 - name: PATH_BASE
value: http://0.0.0.0:80/webmvc 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 - name: PATH_BASE
value: http://0.0.0.0:80/webstatus value: /webstatus
- name: BasketUrl - name: BasketUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:

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
if ($createAcr -eq $true) {
# Show ACR credentials # Show ACR credentials
az acr credential show -n $registryName az acr credential show -n $registryName
}

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");

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();

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();

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);

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);

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);

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()

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();

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();

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 =>