summaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-07-20 11:38:40 -0500
committerGitHub <noreply@github.com>2018-07-20 11:38:40 -0500
commit45f76344b4278f1ecf9956f3a81bfe11cd525c43 (patch)
tree08cfb059940190cac3eb62bcb8b5a6d01ca67396 /lavalab-gen.py
parented83f7aa1af39e75c10d5e8c4f1385c302beec12 (diff)
parent0f09e5c9b89cee21a6ee39db9daf8e17525dd493 (diff)
Merge pull request #32 from montjoie/persistantdb_pr
Persistantdb pr
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index f6663a2..6637bc5 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -85,7 +85,7 @@ def main():
sys.exit(1)
masters = workers["masters"]
for master in masters:
- keywords_master = [ "name", "type", "host", "users", "tokens", "webadmin_https" ]
+ keywords_master = [ "name", "type", "host", "users", "tokens", "webadmin_https", "persistent_db" ]
for keyword in master:
if not keyword in keywords_master:
print("WARNING: unknown keyword %s" % keyword)
@@ -108,6 +108,16 @@ def main():
dockcomp["services"][name]["volumes"] = [ "/boot:/boot", "/lib/modules:/lib/modules" ]
dockcomp["services"][name]["build"] = {}
dockcomp["services"][name]["build"]["context"] = name
+ persistent_db = False
+ if "persistent_db" in master:
+ persistent_db = master["persistent_db"]
+ if persistent_db:
+ pg_volume_name = "pgdata_" + name
+ dockcomp["services"][name]["volumes"].append(pg_volume_name + ":/var/lib/postgresql")
+ dockcomp["services"][name]["volumes"].append("lava_job_output:/var/lib/lava-server/default/media/job-output/")
+ dockcomp["volumes"] = {}
+ dockcomp["volumes"][pg_volume_name] = {}
+ dockcomp["volumes"]["lava_job_output"] = {}
with open(dockcomposeymlpath, 'w') as f:
yaml.dump(dockcomp, f)