Browse Source

add variables for new api sf

pull/897/head
Erik Pique 6 years ago
parent
commit
be0b868d3b
12 changed files with 64 additions and 28 deletions
  1. +9
    -0
      ServiceFabric/Linux/.dockerignore
  2. +3
    -0
      ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj
  3. +6
    -5
      ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml
  4. +11
    -1
      ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml
  5. +11
    -6
      ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json
  6. +6
    -1
      ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml
  7. +1
    -2
      docker-compose.override.yml
  8. +1
    -2
      docker-compose.prod.yml
  9. +1
    -2
      docker-compose.yml
  10. +11
    -5
      src/ApiGateways/ApiGw-Base/Program.cs
  11. +1
    -1
      src/ApiGateways/ApiGw-Base/Services/SettingService.cs
  12. +3
    -3
      src/ApiGateways/ApiGw-Base/Startup.cs

+ 9
- 0
ServiceFabric/Linux/.dockerignore View File

@ -0,0 +1,9 @@
.dockerignore
.env
.git
.gitignore
.vs
.vscode
*/bin
*/obj
**/.toolstarget

+ 3
- 0
ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj View File

@ -6,6 +6,8 @@
<ServerGarbageCollection>True</ServerGarbageCollection> <ServerGarbageCollection>True</ServerGarbageCollection>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier> <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<TargetLatestRuntimePatch>False</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>False</TargetLatestRuntimePatch>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<UserSecretsId>860c6d00-8a17-45b6-be76-28c2395d468e</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -16,6 +18,7 @@
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" /> <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="3.3.617" /> <PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="3.3.617" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" />
</ItemGroup> </ItemGroup>
</Project> </Project>

+ 6
- 5
ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric"> <Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<!-- Add your custom configuration sections and parameters here --> <!-- Add your custom configuration sections and parameters here -->
<!--
<Section Name="MyConfigSection">
<Parameter Name="MyParameter" Value="Value1" />
</Section>
-->
<!--<Section Name="ServiceFabricSettings">
<Parameter Name="UrlMobilMarketing" Value="configuration/mobile/marketing" />
<Parameter Name="UrlMobilShopping" Value="/configuration/mobile/shopping" />
<Parameter Name="UrlWebMarketing" Value="/configuration/web/marketing" />
<Parameter Name="UrlWebShopping" Value="/configuration/web/shopping" />
</Section>-->
</Settings> </Settings>

+ 11
- 1
ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml View File

@ -17,9 +17,18 @@
<Program>ApiGw_Base.exe</Program> <Program>ApiGw_Base.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder> <WorkingFolder>CodePackage</WorkingFolder>
</ExeHost> </ExeHost>
<!--<ContainerHost>
<ImageName>eshop/sf.linux.settings.api:#{tag}#</ImageName>
</ContainerHost>-->
</EntryPoint> </EntryPoint>
<EnvironmentVariables> <EnvironmentVariables>
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value=""/>
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
<EnvironmentVariable Name="UrlMobilMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/mobile/marketing" />
<EnvironmentVariable Name="UrlMobilShopping" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/mobile/shopping" />
<EnvironmentVariable Name="UrlWebMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/web/marketing" />
<EnvironmentVariable Name="UrlWebShopping" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/web/shopping" />
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>
@ -32,6 +41,7 @@
<!-- This endpoint is used by the communication listener to obtain the port on which to <!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. --> replicas of different partitions that are placed in your code. -->
<!--<Endpoint UriScheme="http" Name="sf.linux.settings.api.endpoint" Port="8912" />-->
<Endpoint Protocol="https" Name="ServiceEndpoint" Type="Input" Port="8912" /> <Endpoint Protocol="https" Name="ServiceEndpoint" Type="Input" Port="8912" />
</Endpoints> </Endpoints>
</Resources> </Resources>

+ 11
- 6
ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json View File

@ -1,13 +1,13 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
{
"iisSettings": { "iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:51647", "applicationUrl": "http://localhost:51647",
"sslPort": 44363 "sslPort": 44363
} }
}, },
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": { "profiles": {
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",
@ -21,10 +21,15 @@
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "api/values", "launchUrl": "api/values",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values"
} }
} }
} }

+ 6
- 1
ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -13,6 +13,11 @@
<EnvironmentOverrides CodePackageRef="code"> <EnvironmentOverrides CodePackageRef="code">
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="[ApiGw_Base_ASPNETCORE_ENVIRONMENT]" /> <EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="[ApiGw_Base_ASPNETCORE_ENVIRONMENT]" />
</EnvironmentOverrides> </EnvironmentOverrides>
<!--<Policies>
<ContainerHostPolicies CodePackageRef="Code">
<PortBinding ContainerPort="80" EndpointRef="sf.linux.settings.api.endpoint" />
</ContainerHostPolicies>
</Policies>-->
</ServiceManifestImport> </ServiceManifestImport>
<DefaultServices> <DefaultServices>
<!-- The section below creates instances of service types, when an instance of this <!-- The section below creates instances of service types, when an instance of this
@ -20,7 +25,7 @@
ServiceFabric PowerShell module. ServiceFabric PowerShell module.
The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. --> The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
<Service Name="ApiGw_Base" ServicePackageActivationMode="ExclusiveProcess">
<Service Name="ApiGw_Base" ServiceDnsName="apigw_base.eshoponservicefabricapigwtype" ServicePackageActivationMode="ExclusiveProcess">
<StatelessService ServiceTypeName="ApiGw_BaseType" InstanceCount="[ApiGw_Base_InstanceCount]"> <StatelessService ServiceTypeName="ApiGw_BaseType" InstanceCount="[ApiGw_Base_InstanceCount]">
<SingletonPartition /> <SingletonPartition />
</StatelessService> </StatelessService>


+ 1
- 2
docker-compose.override.yml View File

@ -313,5 +313,4 @@ services:
- OrchestratorType=${ORCHESTRATOR_TYPE} - OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False} - UseLoadTest=${USE_LOADTEST:-False}
ports: ports:
- "5100:80"
- "5100:80"

+ 1
- 2
docker-compose.prod.yml View File

@ -303,5 +303,4 @@ services:
- urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports: ports:
- "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes. - "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes.
# The API Gateway redirects and access through the internal port (80).
# The API Gateway redirects and access through the internal port (80).

+ 1
- 2
docker-compose.yml View File

@ -215,5 +215,4 @@ services:
depends_on: depends_on:
- webshoppingagg - webshoppingagg
- webshoppingapigw - webshoppingapigw
- webmarketingapigw
- webmarketingapigw

+ 11
- 5
src/ApiGateways/ApiGw-Base/Program.cs View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace OcelotApiGw namespace OcelotApiGw
{ {
@ -7,12 +9,16 @@ namespace OcelotApiGw
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) =>
{
config.SetBasePath(Directory.GetCurrentDirectory());
config.AddJsonFile(Path.Combine("configuration", "configuration.json"));
config.AddCommandLine(args);
})
.UseStartup<Startup>() .UseStartup<Startup>()
.Build();
.Build()
.Run();
}
} }
} }

+ 1
- 1
src/ApiGateways/ApiGw-Base/Services/SettingService.cs View File

@ -45,7 +45,7 @@ namespace OcelotApiGw.Services
Task.WaitAll(tasks.Select(task => task()).ToArray()); Task.WaitAll(tasks.Select(task => task()).ToArray());
return string.Concat(strings);
return string.Join(',', strings);
} }
} }
} }

+ 3
- 3
src/ApiGateways/ApiGw-Base/Startup.cs View File

@ -17,7 +17,7 @@ namespace OcelotApiGw
{ {
public class Startup public class Startup
{ {
private readonly IConfiguration _configuration;
private IConfiguration _configuration;
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
@ -59,13 +59,13 @@ namespace OcelotApiGw
var config = new ConfigurationBuilder() var config = new ConfigurationBuilder()
.AddConfiguration(_configuration); .AddConfiguration(_configuration);
var cfg = services.BuildServiceProvider()
_configuration = services.BuildServiceProvider()
.GetServices<IOrchestratorStrategy>() .GetServices<IOrchestratorStrategy>()
.Single(strategy => strategy.OrchestratorType == orchestratorType) .Single(strategy => strategy.OrchestratorType == orchestratorType)
.ConfigureOrchestrator(config) .ConfigureOrchestrator(config)
.Build(); .Build();
services.AddOcelot(cfg);
services.AddOcelot(_configuration);
} }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)


Loading…
Cancel
Save