This commit is contained in:
Zsolt Ero
2023-12-07 23:37:45 +01:00
parent e2e7f78494
commit 9b595f2edc
6 changed files with 26 additions and 28 deletions

View File

@@ -24,24 +24,22 @@ def prepare_shared(c):
set_cpu_governor(c) set_cpu_governor(c)
def prepare_tile_creator(c): def prepare_tile_gen(c):
install_planetiler(c) install_planetiler(c)
put( for file in [
c, 'prepare-virtualenv.sh',
scripts / 'tile_creator' / 'prepare-virtualenv.sh', 'run_planet.sh',
TILE_GEN_BIN, 'run_monaco.sh',
permissions='755', 'gen_monaco.sh',
owner='ofm', ]:
) put(
c,
put( scripts / 'tile_gen' / file,
c, TILE_GEN_BIN,
scripts / 'tile_creator' / 'run_planet.sh', permissions='755',
TILE_GEN_BIN, owner='ofm',
permissions='755', )
owner='ofm',
)
sudo_cmd(c, f'cd {TILE_GEN_BIN} && source prepare-virtualenv.sh', user='ofm') sudo_cmd(c, f'cd {TILE_GEN_BIN} && source prepare-virtualenv.sh', user='ofm')
@@ -55,16 +53,16 @@ def prepare_http_host(c):
@click.argument('hostname') @click.argument('hostname')
@click.option('--port', type=int, help='SSH port (if not in .ssh/config)') @click.option('--port', type=int, help='SSH port (if not in .ssh/config)')
@click.option('--user', help='SSH user (if not in .ssh/config)') @click.option('--user', help='SSH user (if not in .ssh/config)')
@click.option('--tile-creator', is_flag=True, help='Install tile-creator task') @click.option('--tile-gen', is_flag=True, help='Install tile-gen task')
@click.option('--http-host', is_flag=True, help='Install http-host task') @click.option('--http-host', is_flag=True, help='Install http-host task')
def main(hostname, user, port, tile_creator, http_host): def main(hostname, user, port, tile_gen, http_host):
if not click.confirm(f'Run script on {hostname}?'): if not click.confirm(f'Run script on {hostname}?'):
return return
if not tile_creator and not http_host: if not tile_gen and not http_host:
tile_creator = click.confirm('Would you like to install tile-creator task?') tile_gen = click.confirm('Would you like to install tile-gen task?')
http_host = click.confirm('Would you like to install http-host task?') http_host = click.confirm('Would you like to install http-host task?')
if not tile_creator and not http_host: if not tile_gen and not http_host:
return return
ssh_passwd = dotenv_values('.env').get('SSH_PASSWD') ssh_passwd = dotenv_values('.env').get('SSH_PASSWD')
@@ -86,8 +84,8 @@ def main(hostname, user, port, tile_creator, http_host):
# prepare_shared(c) # prepare_shared(c)
if tile_creator: if tile_gen:
prepare_tile_creator(c) prepare_tile_gen(c)
if http_host: if http_host:
prepare_http_host(c) prepare_http_host(c)

View File

@@ -2,10 +2,10 @@
DATE=$(date +"%Y%m%d_%H%M%S") DATE=$(date +"%Y%m%d_%H%M%S")
RUN_FOLDER="/data/tile_creator/runs/monaco_$DATE" RUN_FOLDER="/data/ofm/runs/monaco_$DATE"
mkdir -p "$RUN_FOLDER" mkdir -p "$RUN_FOLDER"
cd "$RUN_FOLDER" || exit cd "$RUN_FOLDER" || exit
bash /data/tile_creator/bin/run_monaco.sh "$DATE" bash /data/tile_gen/run_monaco.sh "$DATE"

View File

@@ -5,7 +5,7 @@
# setting it to too much means there is too much memory used # setting it to too much means there is too much memory used
java -Xmx1g \ java -Xmx1g \
-jar /data/ofm/tile_creator/bin/planetiler.jar \ -jar /data/ofm/tile_gen/planetiler.jar \
`# Download the latest planet.osm.pbf from s3://osm-pds bucket` \ `# Download the latest planet.osm.pbf from s3://osm-pds bucket` \
--area=monaco --download \ --area=monaco --download \
`# Accelerate the download by fetching the 10 1GB chunks at a time in parallel` \ `# Accelerate the download by fetching the 10 1GB chunks at a time in parallel` \

View File

@@ -5,7 +5,7 @@
# setting it to too much means there is too much memory used # setting it to too much means there is too much memory used
java -Xmx30g \ java -Xmx30g \
-jar /data/ofm/tile_creator/bin/planetiler.jar \ -jar /data/ofm/tile_gen/planetiler.jar \
`# Download the latest planet.osm.pbf from s3://osm-pds bucket` \ `# Download the latest planet.osm.pbf from s3://osm-pds bucket` \
--area=planet --bounds=planet --download \ --area=planet --bounds=planet --download \
`# Accelerate the download by fetching the 10 1GB chunks at a time in parallel` \ `# Accelerate the download by fetching the 10 1GB chunks at a time in parallel` \

View File

@@ -3,7 +3,7 @@ from ssh_lib.utils import apt_get_install, apt_get_update
PLANETILER_VERSION = '0.7.0' PLANETILER_VERSION = '0.7.0'
TILE_GEN_BIN = '/data/ofm/tile_gen/bin' TILE_GEN_BIN = '/data/ofm/tile_gen'
PLANETILER_PATH = f'{TILE_GEN_BIN}/planetiler.jar' PLANETILER_PATH = f'{TILE_GEN_BIN}/planetiler.jar'