From 3fdd42acf4925534f5f43e0ae1205c966583a133 Mon Sep 17 00:00:00 2001 From: yungwine Date: Tue, 21 May 2024 19:22:28 +0700 Subject: [PATCH 1/2] move setting archive ttl to FN --- mytoncore/functions.py | 9 --------- mytoninstaller/settings.py | 6 ++---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/mytoncore/functions.py b/mytoncore/functions.py index 97b0f8d3..0cca873a 100755 --- a/mytoncore/functions.py +++ b/mytoncore/functions.py @@ -57,8 +57,6 @@ def Event(local, event_name): enable_ton_storage_provider_event(local) elif event_name == "enable_liteserver_mode": enable_liteserver_mode(local) - elif event_name == "enable_validator_mode": - enable_validator_mode(local) local.exit() # end define @@ -95,17 +93,10 @@ def enable_ton_storage_provider_event(local): #end define -def enable_validator_mode(local): - from mytoninstaller.mytoninstaller import set_node_argument - set_node_argument(local, ['--archive-ttl', '86400']) # limit validator archive ttl to 1 day - - def enable_liteserver_mode(local): - from mytoninstaller.mytoninstaller import set_node_argument ton = MyTonCore(local) ton.disable_mode('validator') ton.enable_mode('liteserver') - set_node_argument(local, ['--archive-ttl', '2592000']) # limit liteserver archive ttl to 30 days #end define diff --git a/mytoninstaller/settings.py b/mytoninstaller/settings.py index 995dca30..993a1531 100644 --- a/mytoninstaller/settings.py +++ b/mytoninstaller/settings.py @@ -34,6 +34,7 @@ def FirstNodeSettings(local): validatorAppPath = local.buffer.validator_app_path globalConfigPath = local.buffer.global_config_path vconfig_path = local.buffer.vconfig_path + archive_ttl = 2592000 if local.buffer.mode == 'liteserver' else 86400 # Проверить конфигурацию if os.path.isfile(vconfig_path): @@ -57,8 +58,7 @@ def FirstNodeSettings(local): # Прописать автозагрузку cpus = psutil.cpu_count() - 1 - cmd = "{validatorAppPath} --threads {cpus} --daemonize --global-config {globalConfigPath} --db {ton_db_dir} --logname {tonLogPath} --state-ttl 604800 --verbosity 1" - cmd = cmd.format(validatorAppPath=validatorAppPath, globalConfigPath=globalConfigPath, ton_db_dir=ton_db_dir, tonLogPath=tonLogPath, cpus=cpus) + cmd = f"{validatorAppPath} --threads {cpus} --daemonize --global-config {globalConfigPath} --db {ton_db_dir} --logname {tonLogPath} --state-ttl 604800 --archive-ttl {archive_ttl} --verbosity 1" add2systemd(name="validator", user=vuser, start=cmd) # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\"" # Получить внешний ip адрес @@ -894,6 +894,4 @@ def EnableMode(local): args = ["python3", "-m", "mytoncore", "-e"] if local.buffer.mode == 'liteserver': args.append("enable_liteserver_mode") - elif local.buffer.mode == 'validator': - args.append("enable_validator_mode") subprocess.run(args) From 03dd9c6b4f4eb0bdd3f88030618301b4d97e5a98 Mon Sep 17 00:00:00 2001 From: yungwine Date: Wed, 22 May 2024 12:24:03 +0700 Subject: [PATCH 2/2] fix installing ls mode --- mytoninstaller/settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mytoninstaller/settings.py b/mytoninstaller/settings.py index 993a1531..9f4ca19f 100644 --- a/mytoninstaller/settings.py +++ b/mytoninstaller/settings.py @@ -894,4 +894,7 @@ def EnableMode(local): args = ["python3", "-m", "mytoncore", "-e"] if local.buffer.mode == 'liteserver': args.append("enable_liteserver_mode") + else: + return + args = ["su", "-l", local.buffer.user, "-c", ' '.join(args)] subprocess.run(args)