diff --git a/init-server.py b/init-server.py index ab5f316..f3d5d52 100755 --- a/init-server.py +++ b/init-server.py @@ -4,6 +4,7 @@ import click from fabric import Config, Connection from ssh_lib import SCRIPTS_DIR, dotenv_val +from ssh_lib.planetiler import planetiler from ssh_lib.tasks import ( prepare_http_host, prepare_shared, @@ -115,9 +116,11 @@ def ledns_writer(hostname, user, port): def debug(hostname, user, port): c = get_connection(hostname, user, port) - upload_http_host_config(c) - upload_http_host_files(c) - sudo_cmd(c, '/data/ofm/venv/bin/python -u /data/ofm/http_host/bin/host_manager.py nginx-sync') + # upload_http_host_config(c) + # upload_http_host_files(c) + # sudo_cmd(c, '/data/ofm/venv/bin/python -u /data/ofm/http_host/bin/host_manager.py nginx-sync') + + planetiler(c) if __name__ == '__main__': diff --git a/ssh_lib/__init__.py b/ssh_lib/__init__.py index ef0bfbf..f49cad8 100644 --- a/ssh_lib/__init__.py +++ b/ssh_lib/__init__.py @@ -9,6 +9,7 @@ SCRIPTS_DIR = Path(__file__).parent.parent / 'scripts' OFM_DIR = '/data/ofm' REMOTE_CONFIG = '/data/ofm/config' +TILE_GEN_SRC = '/data/ofm/tile_gen/src' TILE_GEN_BIN = '/data/ofm/tile_gen/bin' HTTP_HOST_BIN = '/data/ofm/http_host/bin' diff --git a/ssh_lib/planetiler.py b/ssh_lib/planetiler.py index d14ad02..cfdd689 100644 --- a/ssh_lib/planetiler.py +++ b/ssh_lib/planetiler.py @@ -1,8 +1,8 @@ -from ssh_lib import TILE_GEN_BIN -from ssh_lib.utils import apt_get_install, apt_get_update +from ssh_lib import TILE_GEN_BIN, TILE_GEN_SRC +from ssh_lib.utils import apt_get_install, apt_get_update, sudo_cmd -PLANETILER_VERSION = '0.7.0' +PLANETILER_COMMIT = 'cf6c55' PLANETILER_PATH = f'{TILE_GEN_BIN}/planetiler.jar' @@ -10,11 +10,23 @@ def planetiler(c): apt_get_update(c) apt_get_install(c, 'openjdk-21-jre-headless') - c.sudo(f'mkdir -p {TILE_GEN_BIN}') + c.sudo(f'rm -rf {TILE_GEN_BIN} {TILE_GEN_SRC}') + c.sudo(f'mkdir -p {TILE_GEN_BIN} {TILE_GEN_SRC}') c.sudo( - f'wget -q https://github.com/onthegomap/planetiler/releases/download/v{PLANETILER_VERSION}/planetiler.jar ' - f'-O {PLANETILER_PATH}', + f'git clone --recurse-submodules https://github.com/onthegomap/planetiler.git {TILE_GEN_SRC}' + ) + + sudo_cmd(c, f'cd {TILE_GEN_SRC} && git checkout {PLANETILER_COMMIT}') + sudo_cmd(c, f'cd {TILE_GEN_SRC} && git submodule update --init --recursive') + + sudo_cmd(c, f'cd {TILE_GEN_SRC} && ./mvnw clean test package > {TILE_GEN_SRC}/_build.log') + + c.sudo( + f'mv {TILE_GEN_SRC}/planetiler-dist/target/planetiler-dist-*-SNAPSHOT-with-deps.jar {PLANETILER_PATH}', + warn=True, ) c.sudo(f'java -jar {PLANETILER_PATH} --help', hide=True) + + c.sudo(f'rm -rf {TILE_GEN_SRC}')