mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-27 08:04:14 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
101 lines
2.7 KiB
Nix
101 lines
2.7 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
|
|
let
|
|
backend =
|
|
{ pkgs, ... }:
|
|
{
|
|
services.httpd = {
|
|
enable = true;
|
|
adminAddr = "foo@example.org";
|
|
virtualHosts.localhost.documentRoot = "${pkgs.valgrind.doc}/share/doc/valgrind/html";
|
|
};
|
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
};
|
|
in
|
|
{
|
|
name = "proxy";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ ];
|
|
};
|
|
|
|
nodes = {
|
|
proxy =
|
|
{ nodes, ... }:
|
|
{
|
|
services.httpd = {
|
|
enable = true;
|
|
adminAddr = "bar@example.org";
|
|
extraModules = [
|
|
"proxy_balancer"
|
|
"lbmethod_byrequests"
|
|
];
|
|
extraConfig = ''
|
|
ExtendedStatus on
|
|
'';
|
|
virtualHosts.localhost = {
|
|
extraConfig = ''
|
|
<Location /server-status>
|
|
Require all granted
|
|
SetHandler server-status
|
|
</Location>
|
|
|
|
<Proxy balancer://cluster>
|
|
Require all granted
|
|
BalancerMember http://${nodes.backend1.config.networking.hostName} retry=0
|
|
BalancerMember http://${nodes.backend2.config.networking.hostName} retry=0
|
|
</Proxy>
|
|
|
|
ProxyStatus full
|
|
ProxyPass /server-status !
|
|
ProxyPass / balancer://cluster/
|
|
ProxyPassReverse / balancer://cluster/
|
|
|
|
# For testing; don't want to wait forever for dead backend servers.
|
|
ProxyTimeout 5
|
|
'';
|
|
};
|
|
};
|
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
};
|
|
|
|
backend1 = backend;
|
|
backend2 = backend;
|
|
|
|
client = { ... }: { };
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
proxy.wait_for_unit("httpd")
|
|
backend1.wait_for_unit("httpd")
|
|
backend2.wait_for_unit("httpd")
|
|
client.wait_for_unit("network.target")
|
|
|
|
# With the back-ends up, the proxy should work.
|
|
client.succeed("curl --fail http://proxy/")
|
|
|
|
client.succeed("curl --fail http://proxy/server-status")
|
|
|
|
# Block the first back-end.
|
|
backend1.block()
|
|
|
|
# The proxy should still work.
|
|
client.succeed("curl --fail http://proxy/")
|
|
client.succeed("curl --fail http://proxy/")
|
|
|
|
# Block the second back-end.
|
|
backend2.block()
|
|
|
|
# Now the proxy should fail as well.
|
|
client.fail("curl --fail http://proxy/")
|
|
|
|
# But if the second back-end comes back, the proxy should start
|
|
# working again.
|
|
backend2.unblock()
|
|
client.succeed("curl --fail http://proxy/")
|
|
'';
|
|
}
|
|
)
|