From 6ff97c2f2adaa309baf597027494a7e5f77f1be1 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Wed, 4 Oct 2023 19:27:36 -0300 Subject: [PATCH] (feat) adapt create hummingbot instance to manage controllers and configs --- docker_manager/docker_manager.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docker_manager/docker_manager.py b/docker_manager/docker_manager.py index 1466b4a..cceb600 100644 --- a/docker_manager/docker_manager.py +++ b/docker_manager/docker_manager.py @@ -94,6 +94,8 @@ def create_hummingbot_instance(self, instance_name: str, config['instance_id'] = instance_name os_utils.dump_dict_to_yaml(config, conf_file_path) # TODO: Mount script folder for custom scripts + # TODO: Refactor of this logic that it's a mess now, split between the process that creates the instance from + # the one that copies the files create_container_command = ["docker", "run", "-it", "-d", "--log-opt", "max-size=10m", "--log-opt", "max-file=5", "--name", instance_name, @@ -104,11 +106,12 @@ def create_hummingbot_instance(self, instance_name: str, "-v", f"./{target_conf_folder}/logs:/home/hummingbot/logs", "-v", f"./{target_conf_folder}/data/:/home/hummingbot/data", "-v", f"./{target_conf_folder}/scripts:/home/hummingbot/scripts", - "-v", f"./{target_conf_folder}/certs:/home/hummingbot/certs", - "-v", f"./{controllers_folder}:/home/hummingbot/hummingbot/smart_components/controllers", - "-v", f"./{controllers_config_folder}:/home/hummingbot/conf/controllers_config", - "-e", "CONFIG_PASSWORD=a"] - + "-v", f"./{target_conf_folder}/certs:/home/hummingbot/certs"] + if controllers_folder: + create_container_command.extend(["-v", f"./{controllers_folder}:/home/hummingbot/hummingbot/smart_components/controllers"]) + if controllers_config_folder: + create_container_command.extend(["-v", f"./{controllers_config_folder}:/home/hummingbot/conf/controllers_config"]) + create_container_command.extend(["-e", "CONFIG_PASSWORD=a"]) if extra_environment_variables: create_container_command.extend(extra_environment_variables) create_container_command.append(image)