summaryrefslogtreecommitdiff
path: root/tools/compileconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/compileconfig.py')
-rwxr-xr-xtools/compileconfig.py57
1 files changed, 53 insertions, 4 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index d5a22df..c5ad00c 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -74,7 +74,7 @@ def parse_address(address):
def get_node_config(nodename, config):
nodetype = []
nodeconfig = {}
- for t in ["frontendnodes", "storagenodes", "signingnodes", "mergenodes"]:
+ for t in ["frontendnodes", "storagenodes", "signingnodes", "mergenodes", "statsservers"]:
for node in config[t]:
if node["name"] == nodename:
nodetype.append(t)
@@ -125,7 +125,22 @@ def gen_http_servers(nodetype, nodeconfig, bind_addresses, bind_publicaddress, b
if "mergenodes" in nodetype:
(host, port) = get_address(bind_addresses["merge"], nodeconfig["mergenodes"])
https_servers.append((Symbol("frontend_https_api"), host, port, Symbol("frontend")))
- if nodetype - set(["frontendnodes", "storagenodes", "signingnodes", "mergenodes"]):
+ if "statsservers" in nodetype:
+ (host, port) = get_address(None, nodeconfig["statsservers"])
+ https_servers.append((Symbol("statsserver_https_api"), host, port, Symbol("statsserver")))
+
+ if bind_publicaddress:
+ (publichost, publicport) = parse_address(bind_publicaddress)
+ else:
+ (_, publicport) = parse_address(nodeconfig["statsservers"]["publicaddress"])
+ publichost = "0.0.0.0"
+
+ if bind_publichttpaddress:
+ (publichttphost, publichttpport) = parse_address(bind_publichttpaddress)
+ http_servers.append((Symbol("external_http_api"), publichttphost, publichttpport, Symbol("statsserver")))
+ https_servers.append((Symbol("external_https_api"), publichost, publicport, Symbol("statsserver")))
+
+ if nodetype - set(["frontendnodes", "storagenodes", "signingnodes", "mergenodes", "statsservers"]):
print >>sys.stderr, "unknown nodetype", nodetype
sys.exit(1)
@@ -269,6 +284,14 @@ def gen_config(nodename, config, localconfig):
(Symbol("https_keyfile"), paths["https_keyfile"]),
]
+ if "statsservers" in nodetype:
+ plopconfig += [
+ (Symbol("https_servers"), https_servers),
+ (Symbol("http_servers"), http_servers),
+ (Symbol("https_certfile"), paths["https_certfile"]),
+ (Symbol("https_keyfile"), paths["https_keyfile"]),
+ ]
+
catlfishconfig.append((Symbol("mmd"), config["mmd"]))
lagerconfig = [
@@ -340,6 +363,8 @@ def gen_config(nodename, config, localconfig):
storagenodeaddresses = ["https://%s/plop/v1/storage/" % node["address"] for node in config["storagenodes"]]
frontendnodenames = [node["name"] for node in config["frontendnodes"]]
frontendnodeaddresses = ["https://%s/plop/v1/frontend/" % node["address"] for node in config["frontendnodes"]]
+ statsservernames = [node["name"] for node in config["statsservers"]]
+ statsserveraddresses = ["https://%s/plop/v1/status/" % node["address"] for node in config["statsservers"]]
allowed_clients = []
allowed_servers = []
@@ -412,6 +437,27 @@ def gen_config(nodename, config, localconfig):
(Symbol("plopcontrol"), plopcontrolfilename),
]
+ reloadableplopconfig.append((Symbol("statsservers"), statsserveraddresses))
+ allowed_servers += [
+ ("/plop/v1/status/merge_dist", statsservernames),
+ ("/plop/v1/status/merge_backup", statsservernames),
+ ("/plop/v1/status/merge_sth", statsservernames),
+ ("/plop/v1/status/merge_fetch", statsservernames),
+ ("/plop/v1/status/storage", statsservernames),
+ ("/plop/v1/status/merge_errors", statsservernames),
+ ]
+
+ if "statsservers" in nodetype:
+ allowed_clients += [
+ ("/plop/v1/status/merge_dist", mergenodenames),
+ ("/plop/v1/status/merge_backup", mergenodenames),
+ ("/plop/v1/status/merge_sth", mergenodenames),
+ ("/plop/v1/status/merge_fetch", mergenodenames),
+ ("/plop/v1/status/merge_errors", mergenodenames),
+ ("/plop/v1/status/storage", list(storagenodenames)),
+ ("/status", Symbol("noauth")),
+ ]
+
reloadableplopconfig += [
(Symbol("allowed_clients"), list(allowed_clients)),
(Symbol("allowed_servers"), list(allowed_servers)),
@@ -463,11 +509,12 @@ def gen_testmakefile(config, testmakefile, shellvars=False):
signingnodenames = set([node["name"] for node in config["signingnodes"]])
mergenodenames = set([node["name"] for node in config["mergenodes"]])
mergesecondarynodenames = set([node["name"] for node in config["mergenodes"] if node["name"] != config["primarymergenode"]])
+ statsservernodenames = set([node["name"] for node in config.get("statsservers")])
frontendnodenames_except_last = sorted(frontendnodenames)[:-1]
frontendnodenames_except_first = sorted(frontendnodenames)[1:]
- allnodes = config["frontendnodes"] + config["storagenodes"] + config["signingnodes"] + config["mergenodes"]
+ allnodes = config["frontendnodes"] + config["storagenodes"] + config["signingnodes"] + config["mergenodes"] + config["statsservers"]
testaddresses = multivaldict([(node["name"], node["address"]) for node in allnodes])
@@ -480,6 +527,7 @@ def gen_testmakefile(config, testmakefile, shellvars=False):
print_nodevar(configfile, delimiter, "SIGNING", "catlfish", signingnodenames, testaddresses)
print_nodevar(configfile, delimiter, "MERGESECONDARY", "catlfish", mergesecondarynodenames, testaddresses)
print_nodevar(configfile, delimiter, "MERGEPRIMARY", "merge", [config["primarymergenode"]], testaddresses, gentesturl=False)
+ print_nodevar(configfile, delimiter, "STATSSERVER", "statsserver", statsservernodenames, testaddresses)
print >>configfile, "NODES=" + delimiter + " ".join(set([node["name"] for node in allnodes])) + delimiter
@@ -493,8 +541,9 @@ def printnodenames(config):
storagenodenames = set([node["name"] for node in config["storagenodes"]])
signingnodenames = set([node["name"] for node in config["signingnodes"]])
mergenodenames = set([node["name"] for node in config["mergenodes"]])
+ statsservernodenames = set([node["name"] for node in config.get("statsservers")])
- print " ".join(frontendnodenames|storagenodenames|signingnodenames|mergenodenames)
+ print " ".join(frontendnodenames|storagenodenames|signingnodenames|mergenodenames|statsservernodenames)
def main():
parser = argparse.ArgumentParser(description="")