diff --git a/README.md b/README.md index 6912036..c9d75ff 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,9 @@ See [dev setup docs](docs/dev_setup.md). ## Changelog +##### v0.6 +Load-balancer implemented with new config format. + ##### v0.5 Using a "done" file in the R2 buckets to mark the upload as finished. All scripts are checking for this file now. diff --git a/init-server.py b/init-server.py index adaaa6b..4d43473 100755 --- a/init-server.py +++ b/init-server.py @@ -11,7 +11,6 @@ from ssh_lib.tasks import ( run_http_host_sync, setup_ledns_writer, setup_loadbalancer, - upload_config_json, ) from ssh_lib.utils import ( put, @@ -66,8 +65,6 @@ def http_host_static(hostname, user, port, noninteractive): c = get_connection(hostname, user, port) prepare_shared(c) - upload_config_json(c) - prepare_http_host(c) run_http_host_sync(c) @@ -84,8 +81,6 @@ def http_host_autoupdate(hostname, user, port, noninteractive): c.sudo('rm -f /etc/cron.d/ofm_http_host') prepare_shared(c) - - upload_config_json(c) prepare_http_host(c) run_http_host_sync(c) @@ -101,6 +96,7 @@ def tile_gen(hostname, user, port, cron, noninteractive): return c = get_connection(hostname, user, port) + prepare_shared(c) prepare_tile_gen(c, enable_cron=cron) @@ -134,8 +130,6 @@ def loadbalancer(hostname, user, port, noninteractive): def debug(hostname, user, port, noninteractive): c = get_connection(hostname, user, port) - upload_config_json(c) - if __name__ == '__main__': cli() diff --git a/modules/loadbalancer/loadbalancer_lib/loadbalance.py b/modules/loadbalancer/loadbalancer_lib/loadbalance.py index 3ac8d10..2ff089d 100644 --- a/modules/loadbalancer/loadbalancer_lib/loadbalance.py +++ b/modules/loadbalancer/loadbalancer_lib/loadbalance.py @@ -1,8 +1,6 @@ -from http_host_lib.shared import get_deployed_version - from loadbalancer_lib.cloudflare import get_zone_id, set_records_round_robin from loadbalancer_lib.config import config -from loadbalancer_lib.shared import check_host_latest +from loadbalancer_lib.shared import check_host_latest, get_deployed_version from loadbalancer_lib.telegram_ import telegram_send_message diff --git a/ssh_lib/tasks.py b/ssh_lib/tasks.py index cf42863..aaf1a12 100644 --- a/ssh_lib/tasks.py +++ b/ssh_lib/tasks.py @@ -29,10 +29,13 @@ def prepare_shared(c): pkg_base(c) rclone(c) + c.sudo(f'rm -rf {REMOTE_CONFIG}') c.sudo(f'mkdir -p {REMOTE_CONFIG}') c.sudo(f'chown ofm:ofm {REMOTE_CONFIG}') c.sudo(f'chown ofm:ofm {OFM_DIR}') + upload_config_json(c) + prepare_venv(c) @@ -228,7 +231,7 @@ def upload_config_json(c): def setup_loadbalancer(c): - upload_config_json(c) + c.sudo('rm -f /etc/cron.d/ofm_loadbalancer') put( c, @@ -248,6 +251,6 @@ def setup_loadbalancer(c): c.sudo(f'{VENV_BIN}/pip install -e /data/ofm/loadbalancer --use-pep517') c.sudo('mkdir -p /data/ofm/loadbalancer/logs') - put(c, MODULES_DIR / 'loadbalancer' / 'cron.d' / 'ofm_loadbalancer', '/etc/cron.d/') - c.sudo('chown -R ofm:ofm /data/ofm/loadbalancer') + + put(c, MODULES_DIR / 'loadbalancer' / 'cron.d' / 'ofm_loadbalancer', '/etc/cron.d/')