Browse Source

Added redis cache too all applications/services

pull/751/head
Halil ibrahim Kalkan 8 years ago
parent
commit
6418eb2d91
  1. 1
      samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj
  2. 7
      samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs
  3. 3
      samples/MicroserviceDemo/applications/AuthServer.Host/appsettings.json
  4. 1
      samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj
  5. 7
      samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs
  6. 3
      samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json
  7. 1
      samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj
  8. 7
      samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs
  9. 3
      samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json
  10. 1
      samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj
  11. 7
      samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs
  12. 3
      samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json
  13. 1
      samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj
  14. 7
      samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs
  15. 3
      samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json
  16. 1
      samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj
  17. 7
      samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs
  18. 13
      samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json
  19. 1
      samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj
  20. 9
      samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs
  21. 3
      samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json
  22. 1
      samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj
  23. 7
      samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs
  24. 3
      samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json
  25. 1
      samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj
  26. 7
      samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs
  27. 3
      samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json

1
samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj

@ -15,6 +15,7 @@
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs

@ -35,6 +35,8 @@ namespace AuthServer.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddAbpDbContext<AuthServerDbContext>(options =>
{
options.AddDefaultRepositories();
@ -49,6 +51,11 @@ namespace AuthServer.Host
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/applications/AuthServer.Host/appsettings.json

@ -2,6 +2,9 @@
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"

1
samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj

@ -17,6 +17,7 @@
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs

@ -32,6 +32,8 @@ namespace BackendAdminApp.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
@ -71,6 +73,11 @@ namespace BackendAdminApp.Host
options.SwaggerDoc("v1", new Info { Title = "Backend Admin Application API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json

@ -4,6 +4,9 @@
"BaseUrl": "http://localhost:65115/"
}
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"

1
samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj

@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs

@ -28,6 +28,8 @@ namespace PublicWebSite.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
@ -65,6 +67,11 @@ namespace PublicWebSite.Host
options.ClaimActions.MapAbpClaimTypes();
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json

@ -4,6 +4,9 @@
"BaseUrl": "http://localhost:64897/"
}
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"

1
samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj

@ -18,6 +18,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Ocelot" Version="13.0.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs

@ -28,7 +28,7 @@ namespace BackendAdminAppGateway.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//TODO: Internal gateway may not need to authentication in the gateway level, we may remove this when we complete and use the other gateways
var configuration = context.Services.GetConfiguration();
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
@ -60,6 +60,11 @@ namespace BackendAdminAppGateway.Host
{
options.UseSqlServer();
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json

@ -2,6 +2,9 @@
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/identity/{everything}",

1
samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj

@ -18,6 +18,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Ocelot" Version="13.0.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs

@ -28,7 +28,7 @@ namespace InternalGateway.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//TODO: Internal gateway may not need to authentication in the gateway level, we may remove this when we complete and use the other gateways
var configuration = context.Services.GetConfiguration();
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
@ -60,6 +60,11 @@ namespace InternalGateway.Host
{
options.UseSqlServer();
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json

@ -2,6 +2,9 @@
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/identity/{everything}",

1
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj

@ -18,6 +18,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Ocelot" Version="13.0.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs

@ -28,7 +28,7 @@ namespace PublicWebSiteGateway.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//TODO: Internal gateway may not need to authentication in the gateway level, we may remove this when we complete and use the other gateways
var configuration = context.Services.GetConfiguration();
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
@ -60,6 +60,11 @@ namespace PublicWebSiteGateway.Host
{
options.UseSqlServer();
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

13
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json

@ -2,6 +2,9 @@
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/productManagement/{everything}",
@ -13,7 +16,7 @@
}
],
"UpstreamPathTemplate": "/api/productManagement/{everything}",
"UpstreamHttpMethod": ["Put", "Delete", "Get", "Post"]
"UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ]
},
{
"DownstreamPathTemplate": "/api/blogging/{everything}",
@ -25,15 +28,13 @@
}
],
"UpstreamPathTemplate": "/api/blogging/{everything}",
"UpstreamHttpMethod": ["Put", "Delete", "Get", "Post"]
"UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ]
}
],
"GlobalConfiguration":
{
"GlobalConfiguration": {
"BaseUrl": "http://localhost:64897"
},
"Logging":
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}

1
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj

@ -17,6 +17,7 @@
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

9
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs

@ -35,6 +35,8 @@ namespace BloggingService.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -63,11 +65,16 @@ namespace BloggingService.Host
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
});
Configure<AbpDbContextOptions>(options =>
{
options.UseSqlServer();
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json

@ -3,6 +3,9 @@
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true",
"Blogging": "mongodb://localhost|MsDemo_Blogging"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"

1
samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj

@ -17,6 +17,7 @@
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs

@ -30,6 +30,8 @@ namespace IdentityService.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -63,6 +65,11 @@ namespace IdentityService.Host
{
options.UseSqlServer();
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json

@ -2,6 +2,9 @@
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"

1
samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj

@ -17,6 +17,7 @@
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
</ItemGroup>
<ItemGroup>

7
samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs

@ -30,6 +30,8 @@ namespace ProductService.Host
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -63,6 +65,11 @@ namespace ProductService.Host
{
options.UseSqlServer();
});
context.Services.AddDistributedRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json

@ -3,6 +3,9 @@
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true",
"ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"

Loading…
Cancel
Save