aboutsummaryrefslogtreecommitdiff
path: root/scenarios/fragments/garage.py
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-09-24 17:01:34 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-09-24 17:01:34 +0200
commita869e3614bef8d011d56880f4df5f7d47dfb6735 (patch)
tree89d6efcf4f0e30f2c19a4b59e6b57ddbd3088d16 /scenarios/fragments/garage.py
parenta744f72f15f45818e39848bfa4c03b5af6c2cf9a (diff)
downloadmknet-a869e3614bef8d011d56880f4df5f7d47dfb6735.tar.gz
mknet-a869e3614bef8d011d56880f4df5f7d47dfb6735.zip
LMDB s3 million objects
Diffstat (limited to 'scenarios/fragments/garage.py')
-rw-r--r--scenarios/fragments/garage.py67
1 files changed, 43 insertions, 24 deletions
diff --git a/scenarios/fragments/garage.py b/scenarios/fragments/garage.py
index b291321..e19a09e 100644
--- a/scenarios/fragments/garage.py
+++ b/scenarios/fragments/garage.py
@@ -38,11 +38,11 @@ if 'HOST' in env:
config = storage_path / "garage.toml"
env['GARAGE_CONFIG_FILE'] = str(config)
-def deploy_coord(gw=None):
+def deploy_coord(gw=None, uroot={}, us3_api={}, us3_web={}, uadmin={}):
destroy()
shared.log("start daemon")
shared.exec(f"{version['path']} --version")
- daemon()
+ daemon(uroot,us3_api,us3_web,uadmin)
shared.log("discover nodes")
connect()
shared.log("build layout")
@@ -51,43 +51,62 @@ def deploy_coord(gw=None):
create_key()
shared.log("ready")
-def deploy_follow():
+def deploy_follow(uroot={}, us3_api={}, us3_web={}, uadmin={}):
destroy()
shared.log("start daemon")
- daemon()
+ daemon(uroot,us3_api,us3_web,uadmin)
shared.log("wait for coord")
sync_on_key_up()
shared.log("ready")
-def daemon():
+def to_toml(d): return "\n".join([ f"{k} = \"{v}\"" for k, v in d.items() ])
+def daemon(uroot={}, us3_api={}, us3_web={}, uadmin={}):
+ root = {
+ "metadata_dir": f"{storage_path}/meta",
+ "data_dir": f"{storage_path}/data",
+ "replication_mode": "3",
+ "rpc_bind_addr": "[::]:3901",
+ "rpc_public_addr": f"[{env['IP']}]:3901",
+ "rpc_secret": f"{rpc_secret}",
+ }
+ root.update(uroot)
+
+ s3_api = {
+ "s3_region": "garage",
+ "api_bind_addr": "[::]:3900",
+ "root_domain": ".s3.garage",
+ }
+ s3_api.update(us3_api)
+
+ s3_web = {
+ "bind_addr": "[::]:3902",
+ "root_domain": ".web.garage",
+ "index": "index.html",
+ }
+ s3_web.update(us3_web)
+
+ sect_admin = {
+ "api_bind_addr": "0.0.0.0:3903",
+ "metrics_token": f"{metrics}",
+ "admin_token": f"{admin}",
+ }
+ sect_admin.update(uadmin)
+
+
shared.exec(f"mkdir -p {storage_path}")
with open(config, 'w+') as f:
f.write(f"""
-metadata_dir = "{storage_path}/meta"
-data_dir = "{storage_path}/data"
-
-replication_mode = "3"
-
-rpc_bind_addr = "[::]:3901"
-rpc_public_addr = "[{env['IP']}]:3901"
-rpc_secret = "{rpc_secret}"
-
-bootstrap_peers=[]
+{to_toml(root)}
+bootstrap_peers = []
[s3_api]
-s3_region = "garage"
-api_bind_addr = "[::]:3900"
-root_domain = ".s3.garage"
+{to_toml(s3_api)}
[s3_web]
-bind_addr = "[::]:3902"
-root_domain = ".web.garage"
-index = "index.html"
+{to_toml(s3_web)}
[admin]
-api_bind_addr = "0.0.0.0:3903"
-metrics_token = "{metrics}"
-admin_token = "{admin}"
+{to_toml(sect_admin)}
""")
shared.exec(f"{version['path']} server 2>> {storage_path}/logs.stderr 1>> {storage_path}/logs.stdout & echo $! > {storage_path}/daemon.pid")