This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| worker_processes 4; | |
| events { worker_connections 1024; } | |
| http { | |
| upstream container { | |
| least_conn; | |
| server container-app1; | |
| server container-app2; | |
| server container-app3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server | |
| container_name: container-sql | |
| ports: | |
| - "1433:1433" | |
| environment: | |
| SA_PASSWORD: "Docker12345" | |
| ACCEPT_EULA: "Y" | |
| networks: | |
| - minha-rede |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app1: | |
| image: docker-example-app | |
| container_name: container-app1 | |
| ports: | |
| - "5000" | |
| networks: | |
| - minha-rede | |
| depends_on: | |
| - "sqlserver" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nginx: | |
| build: | |
| dockerfile: ./docker/nginx.dockerfile | |
| context: . | |
| image: nginx | |
| container_name: container-lb | |
| ports: | |
| - "80:80" | |
| networks: | |
| - minha-rede |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Program | |
| { | |
| public static IWebHostBuilder CreateWebHostBuilder(string[] args) => | |
| WebHost.CreateDefaultBuilder(args) | |
| .ConfigureAppConfiguration(ic => ic.AddJsonFile("configuration.json")) | |
| .UseStartup<Startup>(); | |
| public static void Main(string[] args) | |
| { | |
| CreateWebHostBuilder(args).Build().Run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Startup | |
| { | |
| private readonly IConfiguration _configuration; | |
| public Startup(IConfiguration configuration) | |
| { | |
| _configuration = configuration; | |
| } | |
| public void ConfigureServices(IServiceCollection services) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "ReRoutes": [ | |
| { | |
| "DownstreamPathTemplate": "/precodoproduto", | |
| "DownstreamScheme": "http", | |
| "DownstreamHostAndPorts": [ | |
| { | |
| "Host": "container-ms-preco", | |
| "Port": 80 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "ReRoutes": [ ... ], | |
| "Aggregates": [ | |
| { | |
| "ReRouteKeys": [ | |
| "validade", | |
| "preco" | |
| ], | |
| "UpstreamPathTemplate": "/produto" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BlackListHandler : DelegatingHandler | |
| { | |
| protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
| { | |
| return base.SendAsync(request, cancellationToken); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| services | |
| .AddOcelot(_configuration) | |
| .AddDelegatingHandler<BlackListHandler>(true); | |
| } |
OlderNewer