mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
work
This commit is contained in:
@@ -6,11 +6,11 @@ from dotenv import dotenv_values
|
||||
from fabric import Config, Connection
|
||||
|
||||
from ssh_lib.benchmark import benchmark, c1000k
|
||||
from ssh_lib.config import assets_dir, config_dir, scripts_dir
|
||||
from ssh_lib.config import ASSETS_DIR, CONFIG_DIR, REMOTE_CONFIG, SCRIPTS_DIR, TILE_GEN_BIN
|
||||
from ssh_lib.kernel import set_cpu_governor, setup_kernel_settings
|
||||
from ssh_lib.nginx import certbot, nginx
|
||||
from ssh_lib.pkg_base import pkg_base, pkg_upgrade
|
||||
from ssh_lib.planetiler import TILE_GEN_BIN, install_planetiler
|
||||
from ssh_lib.planetiler import install_planetiler
|
||||
from ssh_lib.rclone import install_rclone
|
||||
from ssh_lib.utils import add_user, enable_sudo, put, reboot, sudo_cmd
|
||||
|
||||
@@ -40,14 +40,14 @@ def prepare_tile_gen(c):
|
||||
]:
|
||||
put(
|
||||
c,
|
||||
scripts_dir / 'tile_gen' / file,
|
||||
SCRIPTS_DIR / 'tile_gen' / file,
|
||||
TILE_GEN_BIN,
|
||||
permissions='755',
|
||||
)
|
||||
|
||||
put(
|
||||
c,
|
||||
scripts_dir / 'tile_gen' / 'extract_mbtiles' / 'extract_mbtiles.py',
|
||||
SCRIPTS_DIR / 'tile_gen' / 'extract_mbtiles' / 'extract_mbtiles.py',
|
||||
f'{TILE_GEN_BIN}/extract_mbtiles/extract_mbtiles.py',
|
||||
permissions='755',
|
||||
create_parent_dir=True,
|
||||
@@ -55,12 +55,21 @@ def prepare_tile_gen(c):
|
||||
|
||||
put(
|
||||
c,
|
||||
scripts_dir / 'tile_gen' / 'shrink_btrfs' / 'shrink_btrfs.py',
|
||||
SCRIPTS_DIR / 'tile_gen' / 'shrink_btrfs' / 'shrink_btrfs.py',
|
||||
f'{TILE_GEN_BIN}/shrink_btrfs/shrink_btrfs.py',
|
||||
permissions='755',
|
||||
create_parent_dir=True,
|
||||
)
|
||||
|
||||
if (CONFIG_DIR / 'rclone.conf').exists():
|
||||
put(
|
||||
c,
|
||||
CONFIG_DIR / 'rclone.conf',
|
||||
REMOTE_CONFIG,
|
||||
permissions='600',
|
||||
create_parent_dir=True,
|
||||
)
|
||||
|
||||
c.sudo('chown ofm:ofm /data/ofm')
|
||||
c.sudo('chown -R ofm:ofm /data/ofm/tile_gen')
|
||||
|
||||
@@ -77,8 +86,8 @@ def debug_tmp(c):
|
||||
c.sudo('rm -rf /data/ofm/logs')
|
||||
c.sudo('mkdir -p /data/ofm/logs')
|
||||
c.sudo('rm -f /data/nginx/logs/*')
|
||||
put(c, f'{assets_dir}/nginx/nginx.conf', '/etc/nginx/')
|
||||
put(c, f'{scripts_dir}/http_host/nginx_site.conf', '/data/nginx/sites')
|
||||
put(c, f'{ASSETS_DIR}/nginx/nginx.conf', '/etc/nginx/')
|
||||
put(c, f'{SCRIPTS_DIR}/http_host/nginx_site.conf', '/data/nginx/sites')
|
||||
c.sudo('nginx -t')
|
||||
c.sudo('service nginx restart')
|
||||
|
||||
@@ -106,7 +115,7 @@ def main(hostname, user, port, tile_gen, http_host, skip_shared, do_reboot, debu
|
||||
if not tile_gen and not http_host:
|
||||
return
|
||||
|
||||
ssh_passwd = dotenv_values(f'{config_dir}/.env').get('SSH_PASSWD')
|
||||
ssh_passwd = dotenv_values(f'{CONFIG_DIR}/.env').get('SSH_PASSWD')
|
||||
|
||||
if ssh_passwd:
|
||||
c = Connection(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ssh_lib.config import scripts_dir
|
||||
from ssh_lib.config import SCRIPTS_DIR
|
||||
from ssh_lib.utils import apt_get_install, put
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ def c1000k(c):
|
||||
def benchmark(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'{SCRIPTS_DIR}/http_host/benchmark/wrk_custom_list.lua', '/data/ofm/benchmark')
|
||||
|
||||
# wrk -c10 -d10s -t1 -s /data/ofm/benchmark/wrk_custom_list.lua http://localhost
|
||||
|
||||
@@ -2,6 +2,11 @@ from pathlib import Path
|
||||
|
||||
|
||||
base = Path(__file__).parent.parent
|
||||
config_dir = base / 'config'
|
||||
scripts_dir = base / 'scripts'
|
||||
assets_dir = Path(__file__).parent / 'assets'
|
||||
|
||||
CONFIG_DIR = base / 'config'
|
||||
SCRIPTS_DIR = base / 'scripts'
|
||||
ASSETS_DIR = Path(__file__).parent / 'assets'
|
||||
|
||||
|
||||
TILE_GEN_BIN = '/data/ofm/tile_gen/bin'
|
||||
REMOTE_CONFIG = '/data/ofm/config'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from ssh_lib.config import assets_dir
|
||||
from ssh_lib.config import ASSETS_DIR
|
||||
from ssh_lib.utils import apt_get_install, apt_get_purge, put, put_str
|
||||
|
||||
|
||||
def setup_kernel_settings(c):
|
||||
put(c, f'{assets_dir}/kernel/60-ofm.conf', '/etc/sysctl.d/')
|
||||
put(c, f'{assets_dir}/kernel/limits-ofm.conf', '/etc/security/limits.d/')
|
||||
put(c, f'{ASSETS_DIR}/kernel/60-ofm.conf', '/etc/sysctl.d/')
|
||||
put(c, f'{ASSETS_DIR}/kernel/limits-ofm.conf', '/etc/security/limits.d/')
|
||||
|
||||
|
||||
def set_cpu_governor(c):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ssh_lib.config import assets_dir
|
||||
from ssh_lib.config import ASSETS_DIR
|
||||
from ssh_lib.utils import (
|
||||
apt_get_install,
|
||||
apt_get_purge,
|
||||
@@ -46,9 +46,9 @@ def nginx(c):
|
||||
hide=True,
|
||||
)
|
||||
|
||||
put(c, f'{assets_dir}/nginx/nginx.conf', '/etc/nginx/')
|
||||
put(c, f'{assets_dir}/nginx/default_disable.conf', '/data/nginx/sites')
|
||||
put(c, f'{assets_dir}/nginx/cloudflare.conf', '/data/nginx/config')
|
||||
put(c, f'{ASSETS_DIR}/nginx/nginx.conf', '/etc/nginx/')
|
||||
put(c, f'{ASSETS_DIR}/nginx/default_disable.conf', '/data/nginx/sites')
|
||||
put(c, f'{ASSETS_DIR}/nginx/cloudflare.conf', '/data/nginx/config')
|
||||
|
||||
c.sudo('service nginx restart')
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from ssh_lib.config import TILE_GEN_BIN
|
||||
from ssh_lib.utils import apt_get_install, apt_get_update
|
||||
|
||||
|
||||
PLANETILER_VERSION = '0.7.0'
|
||||
|
||||
TILE_GEN_BIN = '/data/ofm/tile_gen/bin'
|
||||
PLANETILER_PATH = f'{TILE_GEN_BIN}/planetiler.jar'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user