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