commit cf7350ea98573e0238c6cf3aa94812c5652e0d36 Author: Clemens Klug Date: Tue Apr 24 10:04:37 2018 +0200 Initialer Commit diff --git a/sample.json b/sample.json new file mode 100644 index 0000000..7fa4d52 --- /dev/null +++ b/sample.json @@ -0,0 +1,12 @@ +{ + "/srv/services": [ + "gitea", + "http", + "icinga", + "rz_measurements", + "traefik" + ], + "/home/clemens/hg/biodiv2go/games/web": [ + "." + ] +} diff --git a/start.py b/start.py new file mode 100644 index 0000000..cd2c415 --- /dev/null +++ b/start.py @@ -0,0 +1,25 @@ +import argparse +import json +import os +import subprocess + +def start(config): + with open(config, "r") as src: + data = json.load(src) + if data: + for base in data: + for service in data[base]: + path = os.path.join(base, service) + print(path) + r = subprocess.run(["docker-compose", "up", "-d"], cwd=path) + print(r) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Docker-compose Autostart") + parser.add_argument("config_file") + + args = parser.parse_args() + + start(args.config_file) + \ No newline at end of file