mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 05:52:17 +00:00
ledns
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[cf]
|
||||
[remote]
|
||||
type = s3
|
||||
provider = Cloudflare
|
||||
access_key_id = xxx
|
||||
|
||||
@@ -10,7 +10,7 @@ from ssh_lib.tasks import (
|
||||
prepare_shared,
|
||||
prepare_tile_gen,
|
||||
run_http_host_sync,
|
||||
setup_ledns_manager,
|
||||
setup_ledns_writer,
|
||||
upload_http_host_config,
|
||||
)
|
||||
from ssh_lib.utils import (
|
||||
@@ -98,13 +98,14 @@ def tile_gen(hostname, user, port):
|
||||
|
||||
@cli.command()
|
||||
@common_options
|
||||
def ledns_manager(hostname, user, port):
|
||||
def ledns_writer(hostname, user, port):
|
||||
if not click.confirm(f'Run script on {hostname}?'):
|
||||
return
|
||||
|
||||
c = get_connection(hostname, user, port)
|
||||
|
||||
setup_ledns_manager(c)
|
||||
setup_ledns_writer(c)
|
||||
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
||||
@@ -14,15 +14,15 @@ for AREA in "${AREAS[@]}"; do
|
||||
--fast-list \
|
||||
--exclude dirs.txt \
|
||||
--exclude index.txt \
|
||||
"cf:ofm-$AREA" > index/index.txt
|
||||
"remote:ofm-$AREA" > index/index.txt
|
||||
|
||||
rclone lsf -R \
|
||||
--dirs-only \
|
||||
--dir-slash=false \
|
||||
--fast-list \
|
||||
"cf:ofm-$AREA" > index/dirs.txt
|
||||
"remote:ofm-$AREA" > index/dirs.txt
|
||||
|
||||
rclone copy index "cf:ofm-$AREA"
|
||||
rclone copy index "remote:ofm-$AREA"
|
||||
done
|
||||
|
||||
rm -rf index
|
||||
|
||||
@@ -30,7 +30,7 @@ rclone sync \
|
||||
--stats-one-line \
|
||||
--log-file logs/rclone.log \
|
||||
--exclude 'logs/**' \
|
||||
. "cf:ofm-$AREA/$VERSION"
|
||||
. "remote:ofm-$AREA/$VERSION"
|
||||
|
||||
|
||||
bash "$SCRIPT_DIR/cloudflare_index.sh"
|
||||
@@ -30,8 +30,8 @@ def prepare_shared(c):
|
||||
kernel_tweaks_ofm(c)
|
||||
|
||||
c.sudo(f'mkdir -p {REMOTE_CONFIG}')
|
||||
c.sudo('chown ofm:ofm /data/ofm/config')
|
||||
c.sudo('chown ofm:ofm /data/ofm')
|
||||
c.sudo(f'chown ofm:ofm {REMOTE_CONFIG}')
|
||||
c.sudo(f'chown ofm:ofm {OFM_DIR}')
|
||||
|
||||
prepare_venv(c)
|
||||
|
||||
@@ -178,11 +178,24 @@ def install_benchmark(c):
|
||||
wrk(c)
|
||||
|
||||
|
||||
def setup_ledns_manager(c):
|
||||
def setup_ledns_writer(c):
|
||||
le_email = dotenv_val('LE_EMAIL').lower()
|
||||
domain_ledns = dotenv_val('DOMAIN_LEDNS').lower()
|
||||
assert le_email
|
||||
assert domain_ledns
|
||||
assert (CONFIG_DIR / 'rclone.conf').exists()
|
||||
|
||||
rclone(c)
|
||||
c.sudo(f'mkdir -p {REMOTE_CONFIG}')
|
||||
|
||||
put(
|
||||
c,
|
||||
CONFIG_DIR / 'rclone.conf',
|
||||
f'{REMOTE_CONFIG}/rclone.conf',
|
||||
permissions='600',
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
c.sudo('mkdir -p /root/.secrets')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user