diff --git a/README.md b/README.md index 5179364..e9de024 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ There is no cloud, just dedicated servers. The HTTPS server is nginx on Ubuntu. Production-quality hosting of 300 million tiny files is hard. The average file size is just 450 byte. Dozens of tile servers have been written to tackle this problem, but they all have their limitations. -The original idea of this project is to avoid using tile servers altogether. Instead, the tiles are directly served from Btrfs partition images + hard links using an optimised nginx config. I wrote [extract_mbtiles](scripts/tile_gen/scripts/extract_mbtiles.py) and [shrink_btrfs](scripts/tile_gen/scripts/shrink_btrfs.py) scripts for this very purpose. +The original idea of this project is to avoid using tile servers altogether. Instead, the tiles are directly served from Btrfs partition images + hard links using an optimised nginx config. I wrote [extract_mbtiles](modules/tile_gen/scripts/extract_mbtiles.py) and [shrink_btrfs](modules/tile_gen/scripts/shrink_btrfs.py) scripts for this very purpose. This replaces a running service with a pure, file-system-level implementation. Since the Linux kernel's file caching is among the highest-performing and most thoroughly tested codes ever written, it delivers serious performance. @@ -70,7 +70,7 @@ The project has the following parts This sets up everything on a clean Ubuntu server. You run it locally and it sets up the server via SSH. -#### HTTP host - scripts/http_host +#### HTTP host - modules/http_host Inside `http_host`, all work is done by `host_manager.py`. @@ -85,13 +85,13 @@ It does the following: You can run `./host_manager.py --help` to see which options are available. Some commands can be run locally, including on non-linux machines. -#### tile generation - scripts/tile_gen +#### tile generation - modules/tile_gen _note: Tile generation is 100% optional, as we are providing the processed full planet files for public download._ The `tile_gen` script downloads a full planet OSM extract and runs it through Planetiler. -The created .mbtiles file is then extracted into a Btrfs partition image using the custom [extract_mbtiles](scripts/tile_gen/scripts/extract_mbtiles.py) script. The partition is shrunk using the [shrink_btrfs](scripts/tile_gen/scripts/shrink_btrfs.py) script. +The created .mbtiles file is then extracted into a Btrfs partition image using the custom [extract_mbtiles](modules/tile_gen/scripts/extract_mbtiles.py) script. The partition is shrunk using the [shrink_btrfs](modules/tile_gen/scripts/shrink_btrfs.py) script. Finally, it's uploaded to a public Cloudflare R2 bucket using rclone. @@ -99,7 +99,7 @@ Finally, it's uploaded to a public Cloudflare R2 bucket using rclone. A very important part, probably needs the most work in the long term future. -#### load balancer script - scripts/loadbalancer +#### load balancer script - modules/loadbalancer A Round Robin DNS based load balancer script for health checking and updating records. It pushes status messages to a Telegram bot. diff --git a/init-server.py b/init-server.py index b2ee6e8..d44e237 100755 --- a/init-server.py +++ b/init-server.py @@ -3,7 +3,7 @@ import click from fabric import Config, Connection -from ssh_lib import SCRIPTS_DIR, dotenv_val +from ssh_lib import MODULES_DIR, dotenv_val from ssh_lib.tasks import ( prepare_http_host, prepare_shared, @@ -89,7 +89,7 @@ def http_host_autoupdate(hostname, user, port): run_http_host_sync(c) - put(c, SCRIPTS_DIR / 'http_host' / 'cron.d' / 'ofm_http_host', '/etc/cron.d/') + put(c, MODULES_DIR / 'http_host' / 'cron.d' / 'ofm_http_host', '/etc/cron.d/') @cli.command() diff --git a/scripts/debug_proxy/.gitignore b/modules/debug_proxy/.gitignore similarity index 100% rename from scripts/debug_proxy/.gitignore rename to modules/debug_proxy/.gitignore diff --git a/scripts/debug_proxy/package.json b/modules/debug_proxy/package.json similarity index 100% rename from scripts/debug_proxy/package.json rename to modules/debug_proxy/package.json diff --git a/scripts/debug_proxy/pnpm-lock.yaml b/modules/debug_proxy/pnpm-lock.yaml similarity index 100% rename from scripts/debug_proxy/pnpm-lock.yaml rename to modules/debug_proxy/pnpm-lock.yaml diff --git a/scripts/debug_proxy/src/index.js b/modules/debug_proxy/src/index.js similarity index 100% rename from scripts/debug_proxy/src/index.js rename to modules/debug_proxy/src/index.js diff --git a/scripts/debug_proxy/wrangler.toml b/modules/debug_proxy/wrangler.toml similarity index 100% rename from scripts/debug_proxy/wrangler.toml rename to modules/debug_proxy/wrangler.toml diff --git a/scripts/http_host/benchmark/create_path_list.py b/modules/http_host/benchmark/create_path_list.py similarity index 100% rename from scripts/http_host/benchmark/create_path_list.py rename to modules/http_host/benchmark/create_path_list.py diff --git a/scripts/http_host/benchmark/wrk_custom_list.lua b/modules/http_host/benchmark/wrk_custom_list.lua similarity index 100% rename from scripts/http_host/benchmark/wrk_custom_list.lua rename to modules/http_host/benchmark/wrk_custom_list.lua diff --git a/scripts/http_host/benchmark/wrk_usage.txt b/modules/http_host/benchmark/wrk_usage.txt similarity index 100% rename from scripts/http_host/benchmark/wrk_usage.txt rename to modules/http_host/benchmark/wrk_usage.txt diff --git a/scripts/http_host/cron.d/ofm_http_host b/modules/http_host/cron.d/ofm_http_host similarity index 100% rename from scripts/http_host/cron.d/ofm_http_host rename to modules/http_host/cron.d/ofm_http_host diff --git a/scripts/http_host/cron.d/ofm_ledns_reader b/modules/http_host/cron.d/ofm_ledns_reader similarity index 100% rename from scripts/http_host/cron.d/ofm_ledns_reader rename to modules/http_host/cron.d/ofm_ledns_reader diff --git a/scripts/http_host/http_host.py b/modules/http_host/http_host.py similarity index 81% rename from scripts/http_host/http_host.py rename to modules/http_host/http_host.py index d91a51d..acd7449 100755 --- a/scripts/http_host/http_host.py +++ b/modules/http_host/http_host.py @@ -1,24 +1,18 @@ #!/usr/bin/env python3 import datetime -import subprocess import sys -from pathlib import Path import click -import requests from http_host_lib.assets import ( - download_and_extract_asset_tar_gz, download_assets, - download_sprites, ) from http_host_lib.btrfs import ( - download_and_extract_btrfs, download_area_version, get_versions_for_area, ) from http_host_lib.config import config -from http_host_lib.mount import clean_up_mounts, create_fstab +from http_host_lib.mount import auto_mount_unmount from http_host_lib.nginx import write_nginx_config from http_host_lib.set_tileset_versions import set_tileset_versions from http_host_lib.utils import assert_linux, assert_sudo @@ -28,8 +22,8 @@ from http_host_lib.utils import assert_linux, assert_sudo def cli(): """ Manages OpenFreeMap HTTP hosts, including:\n + - Downloading btrfs images\n - Downloading assets\n - - Downloading tilesets\n - Mounting directories\n - Updating nginx config\n - Getting the deployed versions of tilesets\n @@ -68,21 +62,7 @@ def mount(): When finished, /mnt/ofm dir will have all the present tiles.btrfs files mounted in a read-only way. """ - print('running mount') - - assert_linux() - assert_sudo() - - if not config.runs_dir.exists(): - sys.exit(' download_tileset needs to be run first') - - clean_up_mounts(config.mnt_dir) - create_fstab() - - print(' running mount -a') - subprocess.run(['mount', '-a'], check=True) - - clean_up_mounts(config.mnt_dir) + auto_mount_unmount() @cli.command() @@ -140,10 +120,10 @@ def sync(ctx, force): assert_sudo() download_done = False - download_done += ctx.invoke(download_tileset, area='monaco') + download_done += ctx.invoke(download_btrfs, area='monaco') if not config.host_config.get('skip_planet'): - download_done += ctx.invoke(download_tileset, area='planet') + download_done += ctx.invoke(download_btrfs, area='planet') if download_done: ctx.invoke(mount) diff --git a/scripts/http_host/http_host_lib/__init__.py b/modules/http_host/http_host_lib/__init__.py similarity index 100% rename from scripts/http_host/http_host_lib/__init__.py rename to modules/http_host/http_host_lib/__init__.py diff --git a/scripts/http_host/http_host_lib/assets.py b/modules/http_host/http_host_lib/assets.py similarity index 97% rename from scripts/http_host/http_host_lib/assets.py rename to modules/http_host/http_host_lib/assets.py index f609e34..6ef0d4c 100644 --- a/scripts/http_host/http_host_lib/assets.py +++ b/modules/http_host/http_host_lib/assets.py @@ -8,6 +8,10 @@ from http_host_lib.utils import download_file_aria2, download_if_size_differs def download_assets(): + """ + Downloads and extracts assets + """ + download_and_extract_asset_tar_gz('fonts') download_and_extract_asset_tar_gz('styles') download_and_extract_asset_tar_gz('natural_earth') diff --git a/scripts/http_host/http_host_lib/btrfs.py b/modules/http_host/http_host_lib/btrfs.py similarity index 96% rename from scripts/http_host/http_host_lib/btrfs.py rename to modules/http_host/http_host_lib/btrfs.py index bdbef08..4c325f9 100644 --- a/scripts/http_host/http_host_lib/btrfs.py +++ b/modules/http_host/http_host_lib/btrfs.py @@ -9,6 +9,10 @@ from http_host_lib.utils import download_file_aria2, get_remote_file_size def download_area_version(area: str, version: str): + """ + Downloads and uncompresses tiles.btrfs files from the btrfs bucket + """ + if area not in config.areas: sys.exit(f' please specify area: {config.areas}') diff --git a/scripts/http_host/http_host_lib/config.py b/modules/http_host/http_host_lib/config.py similarity index 100% rename from scripts/http_host/http_host_lib/config.py rename to modules/http_host/http_host_lib/config.py diff --git a/scripts/http_host/http_host_lib/mount.py b/modules/http_host/http_host_lib/mount.py similarity index 75% rename from scripts/http_host/http_host_lib/mount.py rename to modules/http_host/http_host_lib/mount.py index fcec9f9..0870969 100644 --- a/scripts/http_host/http_host_lib/mount.py +++ b/modules/http_host/http_host_lib/mount.py @@ -1,7 +1,32 @@ import subprocess +import sys from pathlib import Path from http_host_lib.config import config +from http_host_lib.utils import assert_linux, assert_sudo + + +def auto_mount_unmount(): + """ + Mounts/unmounts the btrfs images from /data/ofm/http_host/runs automatically. + When finished, /mnt/ofm dir will have all the present tiles.btrfs files mounted in a read-only way. + """ + + print('running mount') + + assert_linux() + assert_sudo() + + if not config.runs_dir.exists(): + sys.exit(' download-btrfs needs to be run first') + + clean_up_mounts(config.mnt_dir) + create_fstab() + + print(' running mount -a') + subprocess.run(['mount', '-a'], check=True) + + clean_up_mounts(config.mnt_dir) def create_fstab(): diff --git a/scripts/http_host/http_host_lib/nginx.py b/modules/http_host/http_host_lib/nginx.py similarity index 100% rename from scripts/http_host/http_host_lib/nginx.py rename to modules/http_host/http_host_lib/nginx.py diff --git a/scripts/http_host/http_host_lib/nginx_confs/le.conf b/modules/http_host/http_host_lib/nginx_confs/le.conf similarity index 100% rename from scripts/http_host/http_host_lib/nginx_confs/le.conf rename to modules/http_host/http_host_lib/nginx_confs/le.conf diff --git a/scripts/http_host/http_host_lib/nginx_confs/ledns.conf b/modules/http_host/http_host_lib/nginx_confs/ledns.conf similarity index 100% rename from scripts/http_host/http_host_lib/nginx_confs/ledns.conf rename to modules/http_host/http_host_lib/nginx_confs/ledns.conf diff --git a/scripts/http_host/http_host_lib/nginx_confs/location_static.conf b/modules/http_host/http_host_lib/nginx_confs/location_static.conf similarity index 100% rename from scripts/http_host/http_host_lib/nginx_confs/location_static.conf rename to modules/http_host/http_host_lib/nginx_confs/location_static.conf diff --git a/scripts/http_host/http_host_lib/set_tileset_versions.py b/modules/http_host/http_host_lib/set_tileset_versions.py similarity index 100% rename from scripts/http_host/http_host_lib/set_tileset_versions.py rename to modules/http_host/http_host_lib/set_tileset_versions.py diff --git a/scripts/http_host/http_host_lib/utils.py b/modules/http_host/http_host_lib/utils.py similarity index 100% rename from scripts/http_host/http_host_lib/utils.py rename to modules/http_host/http_host_lib/utils.py diff --git a/scripts/http_host/scripts/metadata_to_tilejson.py b/modules/http_host/scripts/metadata_to_tilejson.py similarity index 100% rename from scripts/http_host/scripts/metadata_to_tilejson.py rename to modules/http_host/scripts/metadata_to_tilejson.py diff --git a/scripts/http_host/setup.py b/modules/http_host/setup.py similarity index 100% rename from scripts/http_host/setup.py rename to modules/http_host/setup.py diff --git a/scripts/ledns/rclone_write.sh b/modules/ledns/rclone_write.sh similarity index 100% rename from scripts/ledns/rclone_write.sh rename to modules/ledns/rclone_write.sh diff --git a/scripts/loadbalancer/cron.d/ofm_loadbalancer b/modules/loadbalancer/cron.d/ofm_loadbalancer similarity index 100% rename from scripts/loadbalancer/cron.d/ofm_loadbalancer rename to modules/loadbalancer/cron.d/ofm_loadbalancer diff --git a/scripts/loadbalancer/loadbalancer.py b/modules/loadbalancer/loadbalancer.py similarity index 100% rename from scripts/loadbalancer/loadbalancer.py rename to modules/loadbalancer/loadbalancer.py diff --git a/scripts/loadbalancer/loadbalancer_lib/__init__.py b/modules/loadbalancer/loadbalancer_lib/__init__.py similarity index 100% rename from scripts/loadbalancer/loadbalancer_lib/__init__.py rename to modules/loadbalancer/loadbalancer_lib/__init__.py diff --git a/scripts/loadbalancer/loadbalancer_lib/cloudflare.py b/modules/loadbalancer/loadbalancer_lib/cloudflare.py similarity index 100% rename from scripts/loadbalancer/loadbalancer_lib/cloudflare.py rename to modules/loadbalancer/loadbalancer_lib/cloudflare.py diff --git a/scripts/loadbalancer/loadbalancer_lib/curl.py b/modules/loadbalancer/loadbalancer_lib/curl.py similarity index 100% rename from scripts/loadbalancer/loadbalancer_lib/curl.py rename to modules/loadbalancer/loadbalancer_lib/curl.py diff --git a/scripts/loadbalancer/loadbalancer_lib/telegram_.py b/modules/loadbalancer/loadbalancer_lib/telegram_.py similarity index 100% rename from scripts/loadbalancer/loadbalancer_lib/telegram_.py rename to modules/loadbalancer/loadbalancer_lib/telegram_.py diff --git a/scripts/loadbalancer/setup.py b/modules/loadbalancer/setup.py similarity index 100% rename from scripts/loadbalancer/setup.py rename to modules/loadbalancer/setup.py diff --git a/scripts/prepare-virtualenv.sh b/modules/prepare-virtualenv.sh similarity index 100% rename from scripts/prepare-virtualenv.sh rename to modules/prepare-virtualenv.sh diff --git a/scripts/set_version/setup.py b/modules/set_version/setup.py similarity index 100% rename from scripts/set_version/setup.py rename to modules/set_version/setup.py diff --git a/scripts/set_version/setversion.py b/modules/set_version/setversion.py similarity index 100% rename from scripts/set_version/setversion.py rename to modules/set_version/setversion.py diff --git a/scripts/set_version/setversion_lib/__init__.py b/modules/set_version/setversion_lib/__init__.py similarity index 100% rename from scripts/set_version/setversion_lib/__init__.py rename to modules/set_version/setversion_lib/__init__.py diff --git a/scripts/tile_gen/cron.d/ofm_tile_gen b/modules/tile_gen/cron.d/ofm_tile_gen similarity index 100% rename from scripts/tile_gen/cron.d/ofm_tile_gen rename to modules/tile_gen/cron.d/ofm_tile_gen diff --git a/scripts/tile_gen/scripts/README.md b/modules/tile_gen/scripts/README.md similarity index 100% rename from scripts/tile_gen/scripts/README.md rename to modules/tile_gen/scripts/README.md diff --git a/scripts/tile_gen/scripts/extract_mbtiles.py b/modules/tile_gen/scripts/extract_mbtiles.py similarity index 100% rename from scripts/tile_gen/scripts/extract_mbtiles.py rename to modules/tile_gen/scripts/extract_mbtiles.py diff --git a/scripts/tile_gen/scripts/shrink_btrfs.py b/modules/tile_gen/scripts/shrink_btrfs.py similarity index 100% rename from scripts/tile_gen/scripts/shrink_btrfs.py rename to modules/tile_gen/scripts/shrink_btrfs.py diff --git a/scripts/tile_gen/setup.py b/modules/tile_gen/setup.py similarity index 100% rename from scripts/tile_gen/setup.py rename to modules/tile_gen/setup.py diff --git a/scripts/tile_gen/tile_gen.py b/modules/tile_gen/tile_gen.py similarity index 100% rename from scripts/tile_gen/tile_gen.py rename to modules/tile_gen/tile_gen.py diff --git a/scripts/tile_gen/tile_gen_lib/__init__.py b/modules/tile_gen/tile_gen_lib/__init__.py similarity index 100% rename from scripts/tile_gen/tile_gen_lib/__init__.py rename to modules/tile_gen/tile_gen_lib/__init__.py diff --git a/scripts/tile_gen/tile_gen_lib/btrfs.py b/modules/tile_gen/tile_gen_lib/btrfs.py similarity index 100% rename from scripts/tile_gen/tile_gen_lib/btrfs.py rename to modules/tile_gen/tile_gen_lib/btrfs.py diff --git a/scripts/tile_gen/tile_gen_lib/config.py b/modules/tile_gen/tile_gen_lib/config.py similarity index 100% rename from scripts/tile_gen/tile_gen_lib/config.py rename to modules/tile_gen/tile_gen_lib/config.py diff --git a/scripts/tile_gen/tile_gen_lib/planetiler.py b/modules/tile_gen/tile_gen_lib/planetiler.py similarity index 100% rename from scripts/tile_gen/tile_gen_lib/planetiler.py rename to modules/tile_gen/tile_gen_lib/planetiler.py diff --git a/scripts/tile_gen/tile_gen_lib/rclone.py b/modules/tile_gen/tile_gen_lib/rclone.py similarity index 100% rename from scripts/tile_gen/tile_gen_lib/rclone.py rename to modules/tile_gen/tile_gen_lib/rclone.py diff --git a/scripts/tile_gen/tile_gen_lib/utils.py b/modules/tile_gen/tile_gen_lib/utils.py similarity index 100% rename from scripts/tile_gen/tile_gen_lib/utils.py rename to modules/tile_gen/tile_gen_lib/utils.py diff --git a/prepare-virtualenv.sh b/prepare-virtualenv.sh index cdd7319..14c33e5 100755 --- a/prepare-virtualenv.sh +++ b/prepare-virtualenv.sh @@ -11,10 +11,10 @@ source venv/bin/activate pip install -U pip wheel setuptools pip install -e . -pip install -e scripts/http_host -pip install -e scripts/tile_gen -pip install -e scripts/loadbalancer -pip install -e scripts/setversion +pip install -e modules/http_host +pip install -e modules/tile_gen +pip install -e modules/loadbalancer +pip install -e modules/set_version diff --git a/ssh_lib/__init__.py b/ssh_lib/__init__.py index b8009b3..387fbe1 100644 --- a/ssh_lib/__init__.py +++ b/ssh_lib/__init__.py @@ -5,7 +5,7 @@ from dotenv import dotenv_values ASSETS_DIR = Path(__file__).parent / 'assets' CONFIG_DIR = Path(__file__).parent.parent / 'config' -SCRIPTS_DIR = Path(__file__).parent.parent / 'scripts' +MODULES_DIR = Path(__file__).parent.parent / 'modules' OFM_DIR = '/data/ofm' REMOTE_CONFIG = f'{OFM_DIR}/config' diff --git a/ssh_lib/benchmark.py b/ssh_lib/benchmark.py index 75dd6fc..8e42ea9 100644 --- a/ssh_lib/benchmark.py +++ b/ssh_lib/benchmark.py @@ -1,4 +1,4 @@ -from ssh_lib import SCRIPTS_DIR +from ssh_lib import MODULES_DIR from ssh_lib.utils import apt_get_install, exists, put @@ -20,4 +20,4 @@ def c1000k(c): def wrk(c): apt_get_install(c, 'wrk') c.sudo('mkdir -p /data/ofm/benchmark') - put(c, f'{SCRIPTS_DIR}/http_host/benchmark/wrk_custom_list.lua', '/data/ofm/benchmark') + put(c, f'{MODULES_DIR}/http_host/benchmark/wrk_custom_list.lua', '/data/ofm/benchmark') diff --git a/ssh_lib/tasks.py b/ssh_lib/tasks.py index 69d9e0d..9221379 100644 --- a/ssh_lib/tasks.py +++ b/ssh_lib/tasks.py @@ -6,7 +6,7 @@ from ssh_lib import ( HTTP_HOST_BIN, OFM_DIR, REMOTE_CONFIG, - SCRIPTS_DIR, + MODULES_DIR, TILE_GEN_BIN, VENV_BIN, dotenv_val, @@ -39,7 +39,7 @@ def prepare_shared(c): def prepare_venv(c): put( c, - SCRIPTS_DIR / 'prepare-virtualenv.sh', + MODULES_DIR / 'prepare-virtualenv.sh', OFM_DIR, permissions='755', user='ofm', @@ -54,10 +54,10 @@ def prepare_tile_gen(c): c.sudo(f'rm -rf {TILE_GEN_BIN}') - put_dir(c, SCRIPTS_DIR / 'tile_gen', TILE_GEN_BIN, file_permissions='755') + put_dir(c, MODULES_DIR / 'tile_gen', TILE_GEN_BIN, file_permissions='755') for dirname in ['tile_gen_lib', 'scripts']: - put_dir(c, SCRIPTS_DIR / 'tile_gen' / dirname, f'{TILE_GEN_BIN}/{dirname}') + put_dir(c, MODULES_DIR / 'tile_gen' / dirname, f'{TILE_GEN_BIN}/{dirname}') if (CONFIG_DIR / 'rclone.conf').exists(): put( @@ -75,7 +75,7 @@ def prepare_tile_gen(c): c.sudo('chown ofm:ofm /data/ofm/tile_gen/{,*}') c.sudo(f'chown ofm:ofm -R {TILE_GEN_BIN}') - put(c, SCRIPTS_DIR / 'tile_gen' / 'cron.d' / 'ofm_tile_gen', '/etc/cron.d/') + put(c, MODULES_DIR / 'tile_gen' / 'cron.d' / 'ofm_tile_gen', '/etc/cron.d/') def upload_http_host_config(c): @@ -109,7 +109,7 @@ def upload_http_host_config(c): f'{REMOTE_CONFIG}/rclone.conf', permissions=400, ) - put(c, SCRIPTS_DIR / 'http_host' / 'cron.d' / 'ofm_ledns_reader', '/etc/cron.d/') + put(c, MODULES_DIR / 'http_host' / 'cron.d' / 'ofm_ledns_reader', '/etc/cron.d/') def prepare_http_host(c): @@ -140,14 +140,14 @@ def run_http_host_sync(c): def upload_http_host_files(c): c.sudo(f'mkdir -p {HTTP_HOST_BIN}') - put_dir(c, SCRIPTS_DIR / 'http_host', HTTP_HOST_BIN, file_permissions='755') + put_dir(c, MODULES_DIR / 'http_host', HTTP_HOST_BIN, file_permissions='755') for dirname in ['http_host_lib', 'scripts']: - put_dir(c, SCRIPTS_DIR / 'http_host' / dirname, f'{HTTP_HOST_BIN}/{dirname}') + put_dir(c, MODULES_DIR / 'http_host' / dirname, f'{HTTP_HOST_BIN}/{dirname}') put_dir( c, - SCRIPTS_DIR / 'http_host' / 'http_host_lib' / 'nginx_confs', + MODULES_DIR / 'http_host' / 'http_host_lib' / 'nginx_confs', f'{HTTP_HOST_BIN}/http_host_lib/nginx_confs', ) @@ -198,7 +198,7 @@ def setup_ledns_writer(c): put( c, - SCRIPTS_DIR / 'ledns' / 'rclone_write.sh', + MODULES_DIR / 'ledns' / 'rclone_write.sh', '/data/ofm/ledns/rclone_write.sh', create_parent_dir=True, permissions=500, @@ -248,16 +248,16 @@ def setup_loadbalancer(c): ) c.sudo('rm -rf /data/ofm/loadbalancer') - put_dir(c, SCRIPTS_DIR / 'loadbalancer', '/data/ofm/loadbalancer') + put_dir(c, MODULES_DIR / 'loadbalancer', '/data/ofm/loadbalancer') put_dir( c, - SCRIPTS_DIR / 'loadbalancer' / 'loadbalancer_lib', + MODULES_DIR / 'loadbalancer' / 'loadbalancer_lib', '/data/ofm/loadbalancer/loadbalancer_lib', ) c.sudo(f'{VENV_BIN}/pip install -e /data/ofm/loadbalancer --use-pep517') c.sudo('mkdir -p /data/ofm/loadbalancer/logs') - put(c, SCRIPTS_DIR / 'loadbalancer' / 'cron.d' / 'ofm_loadbalancer', '/etc/cron.d/') + put(c, MODULES_DIR / 'loadbalancer' / 'cron.d' / 'ofm_loadbalancer', '/etc/cron.d/') c.sudo('chown -R ofm:ofm /data/ofm/loadbalancer')