From d63f6db19fe66e4162867cef5694d8e888423a13 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Mon, 9 Nov 2020 16:53:58 +0800 Subject: [PATCH 1/6] feat: add logs to support xud-docker-api setup-status --- images/utils/Dockerfile | 2 +- images/utils/launcher/auto_unlock.py | 4 ++++ images/utils/launcher/check_wallets.py | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/images/utils/Dockerfile b/images/utils/Dockerfile index be406ae1f..1fd54ff50 100644 --- a/images/utils/Dockerfile +++ b/images/utils/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8-alpine3.12 +FROM python:3.9-alpine3.12 RUN pip install toml docker demjson ADD . /usr/local/src/utils WORKDIR /usr/local/src/utils diff --git a/images/utils/launcher/auto_unlock.py b/images/utils/launcher/auto_unlock.py index 430680116..2d4a37f8e 100644 --- a/images/utils/launcher/auto_unlock.py +++ b/images/utils/launcher/auto_unlock.py @@ -1,5 +1,8 @@ +import logging from .node import XudApiError +logger = logging.getLogger(__name__) + class Action: def __init__(self, node_manager): @@ -33,4 +36,5 @@ def execute(self): xud = self.node_manager.get_node("xud") if not self.xud_is_locked(xud): return + logger.info("Unlock wallets") self.xucli_unlock_wrapper(xud) diff --git a/images/utils/launcher/check_wallets.py b/images/utils/launcher/check_wallets.py index 13826ce96..2b778c4bc 100644 --- a/images/utils/launcher/check_wallets.py +++ b/images/utils/launcher/check_wallets.py @@ -164,6 +164,8 @@ def _print_lnd_cfheaders(self, erase_last_line=True): lndltc = self.lnd_cfheaders["litecoin"] services["lndltc"] = "Syncing " + self._get_percentage(lndltc.current, lndltc.total) + self.logger.info("[LightSync] %s", " | ".join(["%s: %s" % (key, value) for key, value in services.items()])) + table = ServiceTable(services) table_str = str(table) if erase_last_line: @@ -305,6 +307,7 @@ def ensure_layer2_ready(self) -> None: print() def xucli_create_wrapper(self, xud): + self.logger.info("Create wallets") counter = 0 ok = False while counter < 3: @@ -323,6 +326,8 @@ def xucli_create_wrapper(self, xud): raise Exception("Failed to create wallets") def xucli_restore_wrapper(self, xud): + self.logger.info("Restore wallets") + counter = 0 ok = False while counter < 3: @@ -377,6 +382,8 @@ def setup_backup_dir(self): if self.config.backup_dir: return + self.logger.info("Setup backup location") + backup_dir = None while True: @@ -468,8 +475,12 @@ def setup_restore_dir(self) -> None: def execute(self): xud = self.node_manager.get_node("xud") + + self.logger.info("Waiting for XUD dependencies to be ready") self.ensure_layer2_ready() + if self.node_manager.newly_installed: + self.logger.info("Setup wallets") while True: print("Do you want to create a new xud environment or restore an existing one?") print("1) Create New") From 156051615fcaebaab51cd66de53ae78518c6390c Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Mon, 9 Nov 2020 16:56:15 +0800 Subject: [PATCH 2/6] revoke python version change (3.9->3.8) --- images/utils/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/utils/Dockerfile b/images/utils/Dockerfile index 1fd54ff50..be406ae1f 100644 --- a/images/utils/Dockerfile +++ b/images/utils/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-alpine3.12 +FROM python:3.8-alpine3.12 RUN pip install toml docker demjson ADD . /usr/local/src/utils WORKDIR /usr/local/src/utils From 4e98f88f1d2bb99e4bfca7bf12274f45db9d7c3d Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Mon, 9 Nov 2020 20:18:36 +0800 Subject: [PATCH 3/6] proxy:latest uses setup-status branch for testing --- images/proxy/src.py | 2 +- images/utils/launcher/config/config.py | 2 ++ images/utils/launcher/config/template.py | 13 ++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/images/proxy/src.py b/images/proxy/src.py index 256aec792..b6fc0ea0e 100644 --- a/images/proxy/src.py +++ b/images/proxy/src.py @@ -14,7 +14,7 @@ def ensure(self, version): if version == "latest": # change "master" or "main" to a another xud branch for testing self.checkout_repo(self.frontend_dir, "main") - self.checkout_repo(self.backend_dir, "master") + self.checkout_repo(self.backend_dir, "setup-status") else: self.checkout_repo(self.frontend_dir, "v" + version) self.checkout_repo(self.backend_dir, "v" + version) diff --git a/images/utils/launcher/config/config.py b/images/utils/launcher/config/config.py index 3d5afce81..72f74bd8c 100644 --- a/images/utils/launcher/config/config.py +++ b/images/utils/launcher/config/config.py @@ -940,6 +940,8 @@ def expand_vars(self, value): if isinstance(value, str): if "$home_dir" in value: value = value.replace("$home_dir", self.home_dir) + if "$network_dir" in value: + value = value.replace("$network_dir", self.network_dir) if f"${self.network}_dir" in value: value = value.replace(f"${self.network}_dir", self.network_dir) if "$data_dir" in value: diff --git a/images/utils/launcher/config/template.py b/images/utils/launcher/config/template.py index 117f140e5..dd8f1358a 100644 --- a/images/utils/launcher/config/template.py +++ b/images/utils/launcher/config/template.py @@ -174,6 +174,10 @@ def __str__(self): "host": "$data_dir/lndltc", "container": "/root/.lndltc", }, + { + "host": "$network_dir", + "container": "/root/network", + }, ], "ports": [PortPublish("127.0.0.1:28889:8080")], "mode": "native", @@ -392,7 +396,10 @@ def __str__(self): "host": "$data_dir/lndltc", "container": "/root/.lndltc", }, - + { + "host": "$network_dir", + "container": "/root/network", + }, ], "ports": [PortPublish("127.0.0.1:18889:8080")], "mode": "native", @@ -610,6 +617,10 @@ def __str__(self): "host": "$data_dir/lndltc", "container": "/root/.lndltc", }, + { + "host": "$network_dir", + "container": "/root/network", + }, ], "ports": [PortPublish("127.0.0.1:8889:8080")], "mode": "native", From 4a368ef19bfae0ec090c35195bf94f9175bc9426 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Tue, 10 Nov 2020 17:20:38 +0800 Subject: [PATCH 4/6] change proxy:latest back to master branch --- images/proxy/src.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/proxy/src.py b/images/proxy/src.py index b6fc0ea0e..256aec792 100644 --- a/images/proxy/src.py +++ b/images/proxy/src.py @@ -14,7 +14,7 @@ def ensure(self, version): if version == "latest": # change "master" or "main" to a another xud branch for testing self.checkout_repo(self.frontend_dir, "main") - self.checkout_repo(self.backend_dir, "setup-status") + self.checkout_repo(self.backend_dir, "master") else: self.checkout_repo(self.frontend_dir, "v" + version) self.checkout_repo(self.backend_dir, "v" + version) From 479562cef100073294749e35daf18d49e3552330 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Tue, 10 Nov 2020 19:19:07 +0800 Subject: [PATCH 5/6] use proxy:latest on mainnet for testing --- images/utils/launcher/config/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/utils/launcher/config/template.py b/images/utils/launcher/config/template.py index dd8f1358a..b81587fba 100644 --- a/images/utils/launcher/config/template.py +++ b/images/utils/launcher/config/template.py @@ -595,7 +595,7 @@ def __str__(self): }, "proxy": { "name": "proxy", - "image": "exchangeunion/proxy:1.0.0", + "image": "exchangeunion/proxy:latest", "volumes": [ { "host": "/var/run/docker.sock", From d7ffe12153aaaf6ad86431e77248a22d903b9021 Mon Sep 17 00:00:00 2001 From: raladev Date: Tue, 10 Nov 2020 14:46:03 +0300 Subject: [PATCH 6/6] revert proxy latest using on mainnet --- images/utils/launcher/config/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/utils/launcher/config/template.py b/images/utils/launcher/config/template.py index b81587fba..dd8f1358a 100644 --- a/images/utils/launcher/config/template.py +++ b/images/utils/launcher/config/template.py @@ -595,7 +595,7 @@ def __str__(self): }, "proxy": { "name": "proxy", - "image": "exchangeunion/proxy:latest", + "image": "exchangeunion/proxy:1.0.0", "volumes": [ { "host": "/var/run/docker.sock",