host_manager

This commit is contained in:
Zsolt Ero
2024-01-03 19:22:03 +01:00
parent 67587076fd
commit e663196013
5 changed files with 22 additions and 17 deletions

View File

@@ -20,14 +20,14 @@ def write_nginx_config():
run_dir = DEFAULT_RUNS_DIR / area / version
if not run_dir.is_dir():
print(f"{run_dir} doesn't exists, skipping")
print(f" {run_dir} doesn't exists, skipping")
continue
tilejson_path = run_dir / 'tilejson-tiles-org.json'
metadata_path = subdir / 'metadata.json'
if not metadata_path.is_file():
print(f"{metadata_path} doesn't exists, skipping")
print(f" {metadata_path} doesn't exists, skipping")
continue
url_prefix = f'https://tiles.openfreemap.org/{area}/{version}'
@@ -44,7 +44,7 @@ def write_nginx_config():
check=True,
)
# TODO raise the expires times once things are stable
# TODO # target 10y
version_str = f"""
location /{area}/{version} {{ # no trailing hash
alias {tilejson_path}; # no trailing hash

View File

@@ -1,6 +1,7 @@
import os
import subprocess
import sys
import time
from pathlib import Path
import requests
@@ -16,9 +17,11 @@ def assert_linux():
sys.exit('Needs to be run on Linux')
# TODO
def assert_single_process():
pass
p = subprocess.run(['pgrep', '-fl', sys.argv[0]], capture_output=True, text=True)
lines = [l for l in p.stdout.splitlines() if 'python' in l]
if len(lines) >= 2:
sys.exit('Detected multiple processes, terminating')
def download_if_size_differs(url: str, local_file: Path) -> bool: