Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperknot committed Dec 27, 2023
1 parent ab1db8e commit 6201463
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/_not_used/extract_ext4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sudo mount -v \

sudo chown ofm:ofm -R mnt

../../tile_gen/venv/bin/python ../../tile_gen/extract.py output.mbtiles mnt/extract \
/data/ofm/venv/bin/python ../../tile_gen/extract.py output.mbtiles mnt/extract \
> "extract_out.log" 2> "extract_err.log"

sudo umount mnt
Expand Down
24 changes: 18 additions & 6 deletions init-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
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, REMOTE_CONFIG, SCRIPTS_DIR, TILE_GEN_BIN
from ssh_lib.benchmark import c1000k
from ssh_lib.config import CONFIG_DIR, OFM_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
Expand All @@ -26,6 +26,22 @@ def prepare_shared(c):
setup_kernel_settings(c)
set_cpu_governor(c)

prepare_venv(c)


def prepare_venv(c):
c.sudo(f'mkdir -p {OFM_DIR}')
put(
c,
SCRIPTS_DIR / 'prepare-virtualenv.sh',
OFM_DIR,
permissions='755',
)

c.sudo('chown ofm:ofm /data/ofm')

sudo_cmd(c, f'cd {OFM_DIR} && source prepare-virtualenv.sh', user='ofm')


def prepare_tile_gen(c):
install_planetiler(c)
Expand All @@ -35,7 +51,6 @@ def prepare_tile_gen(c):
'extract_btrfs.sh',
'planetiler_monaco.sh',
'planetiler_planet.sh',
'prepare-virtualenv.sh',
'upload_cloudflare.sh',
]:
put(
Expand Down Expand Up @@ -70,12 +85,9 @@ def prepare_tile_gen(c):
create_parent_dir=True,
)

c.sudo('chown ofm:ofm /data/ofm')
c.sudo('chown -R ofm:ofm /data/ofm/tile_gen')
c.sudo('chown -R ofm:ofm /data/ofm/config')

sudo_cmd(c, f'cd {TILE_GEN_BIN} && source prepare-virtualenv.sh', user='ofm')


def prepare_http_host(c):
nginx(c)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/tile_gen/extract_btrfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

TILE_GEN_BIN=/data/ofm/tile_gen/bin
VENV_PYTHON=$TILE_GEN_BIN/venv/bin/python
VENV_PYTHON=/data/ofm/venv/bin/python

sudo umount mnt_rw 2> /dev/null || true
sudo umount mnt_rw2 2> /dev/null || true
Expand Down
4 changes: 2 additions & 2 deletions scripts/tile_gen/upload_cloudflare.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -e

RUN_STR=$(basename "$PWD")
AREA=$(basename "$(dirname "$PWD")")
VERSION=$(basename "$PWD")


if [[ $AREA != "planet" && $AREA != "monaco" ]]; then
Expand All @@ -28,5 +28,5 @@ rclone sync \
--stats-one-line \
--log-file logs/rclone.log \
--exclude 'logs/**' \
. "cf:ofm-$AREA/$RUN_STR"
. "cf:ofm-$AREA/$VERSION"

3 changes: 2 additions & 1 deletion ssh_lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
ASSETS_DIR = Path(__file__).parent / 'assets'


TILE_GEN_BIN = '/data/ofm/tile_gen/bin'
OFM_DIR = '/data/ofm'
REMOTE_CONFIG = '/data/ofm/config'
TILE_GEN_BIN = '/data/ofm/tile_gen/bin'

0 comments on commit 6201463

Please sign in to comment.