This commit is contained in:
Zsolt Ero
2024-03-03 01:03:50 +01:00
parent 23e39704f4
commit e079bd1c67
5 changed files with 25 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
[cf]
[remote]
type = s3
provider = Cloudflare
access_key_id = xxx

View File

@@ -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()

View File

@@ -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

View File

@@ -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"

View File

@@ -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')