summaryrefslogtreecommitdiff
path: root/tools/compileconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/compileconfig.py')
-rwxr-xr-xtools/compileconfig.py58
1 files changed, 46 insertions, 12 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index c48ba66..0e4a839 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -67,7 +67,7 @@ def parse_address(address):
def get_node_config(nodename, config):
nodetype = None
nodeconfig = None
- for t in ["frontendnodes", "storagenodes", "signingnodes"]:
+ for t in ["frontendnodes", "storagenodes", "signingnodes", "mergenodes"]:
for node in config[t]:
if node["name"] == nodename:
nodetype = t
@@ -106,16 +106,31 @@ def gen_http_servers(nodetype, nodeconfig, bind_address, bind_publicaddress, bin
elif nodetype == "signingnodes":
return ([],
[(Symbol("signing_https_api"), host, port, Symbol("signing"))])
+ elif nodetype == "mergenodes":
+ return ([],
+ [(Symbol("frontend_https_api"), host, port, Symbol("frontend"))])
+ else:
+ print >>sys.stderr, "unknown nodetype", nodetype
+ sys.exit(1)
-def allowed_clients_frontend(mergenodenames):
+def allowed_clients_frontend(mergenodenames, primarymergenode):
return [
("/ct/frontend/sendentry", mergenodenames),
("/ct/frontend/sendlog", mergenodenames),
- ("/ct/frontend/sendsth", mergenodenames),
+ ("/ct/frontend/sendsth", [primarymergenode]),
("/ct/frontend/currentposition", mergenodenames),
("/ct/frontend/missingentries", mergenodenames),
]
+def allowed_clients_mergesecondary(primarymergenode):
+ return [
+ ("/catlfish/merge/sendentry", [primarymergenode]),
+ ("/catlfish/merge/sendlog", [primarymergenode]),
+ ("/catlfish/merge/verifyroot", [primarymergenode]),
+ ("/catlfish/merge/verifiedsize", [primarymergenode]),
+ ("/catlfish/merge/missingentries", [primarymergenode]),
+ ]
+
def allowed_clients_public():
noauth = Symbol("noauth")
return [
@@ -129,10 +144,10 @@ def allowed_clients_public():
("/ct/v1/get-roots", noauth),
]
-def allowed_clients_signing(frontendnodenames, mergenodenames):
+def allowed_clients_signing(frontendnodenames, primarymergenode):
return [
("/ct/signing/sct", frontendnodenames),
- ("/ct/signing/sth", mergenodenames),
+ ("/ct/signing/sth", [primarymergenode]),
]
def allowed_clients_storage(frontendnodenames, mergenodenames):
@@ -182,11 +197,12 @@ def gen_config(nodename, config, localconfig):
catlfishconfig = []
plopconfig = []
- if nodetype == "frontendnodes":
+ if nodetype in ("frontendnodes", "mergenodes"):
catlfishconfig.append((Symbol("known_roots_path"), localconfig["paths"]["knownroots"]))
+ if nodetype == "frontendnodes":
if "sctcaching" in options:
catlfishconfig.append((Symbol("sctcache_root_path"), paths["db"] + "sctcache/"))
- if localconfig["ratelimits"]:
+ if "ratelimits" in localconfig:
ratelimits = map(parse_ratelimit, localconfig["ratelimits"].items())
catlfishconfig.append((Symbol("ratelimits"), ratelimits))
@@ -231,13 +247,23 @@ def gen_config(nodename, config, localconfig):
(Symbol("sth_path"), paths["db"] + "sth"),
(Symbol("entryhash_from_entry"),
(Symbol("catlfish"), Symbol("entryhash_from_entry"))),
+ ]
+ if nodetype in ("frontendnodes", "mergenodes"):
+ plopconfig += [
(Symbol("verify_entry"),
(Symbol("catlfish"), Symbol("verify_entry"))),
]
+ if nodetype == "mergenodes":
+ plopconfig += [
+ (Symbol("verifiedsize_path"), paths["mergedb"] + "/verifiedsize"),
+ (Symbol("index_path"), paths["mergedb"] + "/logorder"),
+ (Symbol("entry_root_path"), paths["mergedb"] + "/chains/"),
+ ]
signingnodes = config["signingnodes"]
signingnodeaddresses = ["https://%s/ct/signing/" % node["address"] for node in config["signingnodes"]]
mergenodenames = [node["name"] for node in config["mergenodes"]]
+ primarymergenode = config["primarymergenode"]
storagenodeaddresses = ["https://%s/ct/storage/" % node["address"] for node in config["storagenodes"]]
frontendnodenames = [node["name"] for node in config["frontendnodes"]]
@@ -249,15 +275,21 @@ def gen_config(nodename, config, localconfig):
plopconfig.append((Symbol("storage_nodes"), storagenodeaddresses))
plopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"]))
services = [Symbol("ht")]
- allowed_clients += allowed_clients_frontend(mergenodenames)
+ allowed_clients += allowed_clients_frontend(mergenodenames, primarymergenode)
allowed_clients += allowed_clients_public()
allowed_servers += allowed_servers_frontend([node["name"] for node in signingnodes], storagenodenames)
elif nodetype == "storagenodes":
allowed_clients += allowed_clients_storage(frontendnodenames, mergenodenames)
services = []
elif nodetype == "signingnodes":
- allowed_clients += allowed_clients_signing(frontendnodenames, mergenodenames)
+ allowed_clients += allowed_clients_signing(frontendnodenames, primarymergenode)
services = [Symbol("sign")]
+ elif nodetype == "mergenodes":
+ storagenodenames = [node["name"] for node in config["storagenodes"]]
+ plopconfig.append((Symbol("storage_nodes"), storagenodeaddresses))
+ plopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"]))
+ services = [Symbol("ht")]
+ allowed_clients += allowed_clients_mergesecondary(primarymergenode)
plopconfig += [
(Symbol("publickey_path"), paths["publickeys"]),
@@ -299,15 +331,17 @@ def gen_testmakefile(config, testmakefile, machines):
configfile = open(testmakefile, "w")
frontendnodenames = [node["name"] for node in config["frontendnodes"]]
storagenodenames = [node["name"] for node in config["storagenodes"]]
- signingnodename = [node["name"] for node in config["signingnodes"]]
+ signingnodenames = [node["name"] for node in config["signingnodes"]]
+ mergenodenames = [node["name"] for node in config["mergenodes"]]
frontendnodeaddresses = [node["publicaddress"] for node in config["frontendnodes"]]
storagenodeaddresses = [node["address"] for node in config["storagenodes"]]
signingnodeaddresses = [node["address"] for node in config["signingnodes"]]
+ mergenodeaddresses = [node["address"] for node in config["mergenodes"] if node["name"] != config["primarymergenode"]]
- print >>configfile, "NODES=" + " ".join(frontendnodenames+storagenodenames+signingnodename)
+ print >>configfile, "NODES=" + " ".join(frontendnodenames+storagenodenames+signingnodenames+mergenodenames)
print >>configfile, "MACHINES=" + " ".join([str(e) for e in range(1, machines+1)])
- print >>configfile, "TESTURLS=" + " ".join(frontendnodeaddresses+storagenodeaddresses+signingnodeaddresses)
+ print >>configfile, "TESTURLS=" + " ".join(frontendnodeaddresses+storagenodeaddresses+signingnodeaddresses+mergenodeaddresses)
print >>configfile, "BASEURL=" + config["baseurl"]
configfile.close()