diff --git a/bin/wtl-services-build b/bin/wtl-services-build index 02b2d6b..4997b76 100755 --- a/bin/wtl-services-build +++ b/bin/wtl-services-build @@ -1,78 +1,79 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import argcomplete, argparse import yaml import subprocess from pprint import pprint WTL_DEV_KIT_PATH = os.environ.get("WTL_DEV_KIT_PATH") WTL_DEV_KIT_REPOS_PATH = os.environ.get("WTL_DEV_KIT_REPOS_PATH") WTL_DEV_KIT_BIN_PATH = os.environ.get("WTL_DEV_KIT_BIN_PATH") config = {} with open(WTL_DEV_KIT_PATH + "/config/config.yml") as fh: config['config'] = yaml.load(fh) if os.path.isfile(WTL_DEV_KIT_PATH + "/config/repositories.yml"): with open(WTL_DEV_KIT_PATH + "/config/repositories.yml") as fh: config['repositories'] = yaml.load(fh) else: with open(WTL_DEV_KIT_PATH + "/config/repositories.example.yml") as fh: config['repositories'] = yaml.load(fh) parser = argparse.ArgumentParser() argcomplete.autocomplete(parser) args = parser.parse_args() os.environ['KEYCLOAK_URI'] = 'http://{host_ip}:9080'.format(host_ip=config['config']['host_ip']) os.environ['COURSES_BACKEND_URI'] = 'http://{host_ip}:10000'.format(host_ip=config['config']['host_ip']) os.environ['CHAPTERS_BACKEND_URI'] = 'http://{host_ip}:10001'.format(host_ip=config['config']['host_ip']) os.environ['PAGES_BACKEND_URI'] = 'http://{host_ip}:10002'.format(host_ip=config['config']['host_ip']) os.environ['COURSE_MIDTIER_URI'] = 'http://{host_ip}:11000'.format(host_ip=config['config']['host_ip']) os.environ['PWA_GATEWAY_URI'] = 'http://{host_ip}:12000'.format(host_ip=config['config']['host_ip']) +os.environ['MONGO_HOST'] = 'mongodb://{host_ip}:27017'.format(host_ip=config['config']['host_ip']) os.environ['PUBLIC_KEYCLOAK_URI'] = 'http://localhost:9080' os.environ['PUBLIC_PWA_GATEWAY_URI'] = 'http://localhost:12000' for service_name in [ "shared-services", "courses-backend", "chapters-backend", "pages-backend", "coursessecurity-backend", "course-midtier", "pwa-gateway", "frontend", ]: if service_name in config['repositories']: service_path = WTL_DEV_KIT_REPOS_PATH + "/" + service_name print("Build '{service_name}'".format(service_name=service_name)) if not os.path.isdir(service_path): clone_cmd = [ "git", "clone", config['repositories'][service_name]['git'], service_path ] if 'git_branch' in config['repositories'][service_name]: clone_cmd.append("-b") clone_cmd.append(config['repositories'][service_name]['git_branch']) subprocess.call(clone_cmd) subprocess.call([ "git", "pull", ], cwd=service_path) docker_compose_command = [ "docker-compose", "-f","docker-compose.yml", ] if os.path.isfile(service_path + "/" + "docker-compose-dev-deps.yml"): docker_compose_command.append("-f") docker_compose_command.append("docker-compose-dev-deps.yml") docker_compose_command.append("build") if subprocess.call(docker_compose_command, cwd=service_path, env=os.environ.copy()) != 0: raise Exception("{} failed".format(docker_compose_command)) diff --git a/bin/wtl-services-run b/bin/wtl-services-run index e4cbae8..e8ad0c9 100755 --- a/bin/wtl-services-run +++ b/bin/wtl-services-run @@ -1,62 +1,63 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import argcomplete, argparse import yaml import subprocess from pprint import pprint WTL_DEV_KIT_PATH = os.environ.get("WTL_DEV_KIT_PATH") WTL_DEV_KIT_REPOS_PATH = os.environ.get("WTL_DEV_KIT_REPOS_PATH") WTL_DEV_KIT_BIN_PATH = os.environ.get("WTL_DEV_KIT_BIN_PATH") config = {} with open(WTL_DEV_KIT_PATH + "/config/config.yml") as fh: config['config'] = yaml.load(fh) if os.path.isfile(WTL_DEV_KIT_PATH + "/config/repositories.yml"): with open(WTL_DEV_KIT_PATH + "/config/repositories.yml") as fh: config['repositories'] = yaml.load(fh) else: with open(WTL_DEV_KIT_PATH + "/config/repositories.example.yml") as fh: config['repositories'] = yaml.load(fh) parser = argparse.ArgumentParser() argcomplete.autocomplete(parser) args = parser.parse_args() os.environ['KEYCLOAK_URI'] = 'http://{host_ip}:9080'.format(host_ip=config['config']['host_ip']) os.environ['COURSES_BACKEND_URI'] = 'http://{host_ip}:10000'.format(host_ip=config['config']['host_ip']) os.environ['CHAPTERS_BACKEND_URI'] = 'http://{host_ip}:10001'.format(host_ip=config['config']['host_ip']) os.environ['PAGES_BACKEND_URI'] = 'http://{host_ip}:10002'.format(host_ip=config['config']['host_ip']) os.environ['COURSE_MIDTIER_URI'] = 'http://{host_ip}:11000'.format(host_ip=config['config']['host_ip']) os.environ['PWA_GATEWAY_URI'] = 'http://{host_ip}:12000'.format(host_ip=config['config']['host_ip']) +os.environ['MONGO_HOST'] = 'mongodb://{host_ip}:27017'.format(host_ip=config['config']['host_ip']) os.environ['PUBLIC_KEYCLOAK_URI'] = 'http://localhost:9080' os.environ['PUBLIC_PWA_GATEWAY_URI'] = 'http://localhost:12000' for service_name in [ "shared-services", "courses-backend", "chapters-backend", "pages-backend", "coursessecurity-backend", "course-midtier", "pwa-gateway", "frontend", ]: if service_name in config['repositories']: service_path = WTL_DEV_KIT_REPOS_PATH + "/" + service_name print("Run '{service_name}'".format(service_name=service_name)) docker_compose_command = [ "docker-compose", "-f","docker-compose.yml", ] if os.path.isfile(service_path + "/" + "docker-compose-dev-deps.yml"): docker_compose_command.append("-f") docker_compose_command.append("docker-compose-dev-deps.yml") docker_compose_command.append("up") docker_compose_command.append("-d") subprocess.call(docker_compose_command, cwd=service_path) diff --git a/bin/wtl-services-stop b/bin/wtl-services-stop index f35cbd5..722bf32 100755 --- a/bin/wtl-services-stop +++ b/bin/wtl-services-stop @@ -1,61 +1,62 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import argcomplete, argparse import yaml import subprocess from pprint import pprint WTL_DEV_KIT_PATH = os.environ.get("WTL_DEV_KIT_PATH") WTL_DEV_KIT_REPOS_PATH = os.environ.get("WTL_DEV_KIT_REPOS_PATH") WTL_DEV_KIT_BIN_PATH = os.environ.get("WTL_DEV_KIT_BIN_PATH") config = {} with open(WTL_DEV_KIT_PATH + "/config/config.yml") as fh: config['config'] = yaml.load(fh) if os.path.isfile(WTL_DEV_KIT_PATH + "/config/repositories.yml"): with open(WTL_DEV_KIT_PATH + "/config/repositories.yml") as fh: config['repositories'] = yaml.load(fh) else: with open(WTL_DEV_KIT_PATH + "/config/repositories.example.yml") as fh: config['repositories'] = yaml.load(fh) parser = argparse.ArgumentParser() argcomplete.autocomplete(parser) args = parser.parse_args() os.environ['KEYCLOAK_URI'] = 'http://{host_ip}:9080'.format(host_ip=config['config']['host_ip']) os.environ['COURSES_BACKEND_URI'] = 'http://{host_ip}:10000'.format(host_ip=config['config']['host_ip']) os.environ['CHAPTERS_BACKEND_URI'] = 'http://{host_ip}:10001'.format(host_ip=config['config']['host_ip']) os.environ['PAGES_BACKEND_URI'] = 'http://{host_ip}:10002'.format(host_ip=config['config']['host_ip']) os.environ['COURSE_MIDTIER_URI'] = 'http://{host_ip}:11000'.format(host_ip=config['config']['host_ip']) os.environ['PWA_GATEWAY_URI'] = 'http://{host_ip}:12000'.format(host_ip=config['config']['host_ip']) +os.environ['MONGO_HOST'] = 'mongodb://{host_ip}:27017'.format(host_ip=config['config']['host_ip']) os.environ['PUBLIC_KEYCLOAK_URI'] = 'http://localhost:9080' os.environ['PUBLIC_PWA_GATEWAY_URI'] = 'http://localhost:12000' for service_name in reversed([ "shared-services", "courses-backend", "chapters-backend", "pages-backend", "coursessecurity-backend", "course-midtier", "pwa-gateway", "frontend", ]): if service_name in config['repositories']: service_path = WTL_DEV_KIT_REPOS_PATH + "/" + service_name print("Stop '{service_name}'".format(service_name=service_name)) docker_compose_command = [ "docker-compose", "-f","docker-compose.yml", ] if os.path.isfile(service_path + "/" + "docker-compose-dev-deps.yml"): docker_compose_command.append("-f") docker_compose_command.append("docker-compose-dev-deps.yml") docker_compose_command.append("down") subprocess.call(docker_compose_command, cwd=service_path)