@le-space/rootfs 0.6.29 → 0.6.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/reference/orbitdb-relay/rootfs/build-rootfs-image.sh +1 -0
- package/reference/orbitdb-relay/rootfs/orbitdb-relay-bootstrap-deregister.service +20 -0
- package/reference/orbitdb-relay/rootfs/orbitdb-relay-bootstrap-refresh.py +48 -11
- package/reference/orbitdb-relay/rootfs/orbitdb-relay-configure.sh +5 -0
- package/reference/uc-go-peer/rootfs/__pycache__/uc-go-peer-describe.cpython-310.pyc +0 -0
- package/reference/uc-go-peer/rootfs/__pycache__/uc-go-peer-describe.cpython-312.pyc +0 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-bootstrap-deregister.service +1 -1
package/package.json
CHANGED
|
@@ -243,6 +243,7 @@ case "${ROOTFS_PROFILE}" in
|
|
|
243
243
|
--copy-in "${SCRIPT_DIR}/orbitdb-relay-bootstrap.service:/etc/systemd/system"
|
|
244
244
|
--copy-in "${SCRIPT_DIR}/orbitdb-relay-bootstrap-refresh.service:/etc/systemd/system"
|
|
245
245
|
--copy-in "${SCRIPT_DIR}/orbitdb-relay-bootstrap-refresh.timer:/etc/systemd/system"
|
|
246
|
+
--copy-in "${SCRIPT_DIR}/orbitdb-relay-bootstrap-deregister.service:/etc/systemd/system"
|
|
246
247
|
--copy-in "${SCRIPT_DIR}/orbitdb-relay-autotls-refresh.service:/etc/systemd/system"
|
|
247
248
|
--copy-in "${SCRIPT_DIR}/orbitdb-relay-bootstrap.conf:/etc/systemd/system/orbitdb-relay.service.d"
|
|
248
249
|
--run-command "tar -xf /opt/$(basename "${APP_TAR}") -C /opt/orbitdb-relay"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[Unit]
|
|
2
|
+
Description=Best-effort Aleph bootstrap deregistration on shutdown for orbitdb-relay
|
|
3
|
+
After=network-online.target orbitdb-relay.service
|
|
4
|
+
Wants=network-online.target
|
|
5
|
+
ConditionPathExists=/etc/default/orbitdb-relay.ready
|
|
6
|
+
|
|
7
|
+
[Service]
|
|
8
|
+
Type=oneshot
|
|
9
|
+
RemainAfterExit=yes
|
|
10
|
+
Environment=ENV_FILE=/etc/default/orbitdb-relay
|
|
11
|
+
Environment=DESCRIBE_SCRIPT=/usr/local/sbin/orbitdb-relay-describe.py
|
|
12
|
+
Environment=ALEPH_BOOTSTRAP_DEREGISTER_ONLY=1
|
|
13
|
+
ExecStart=/bin/true
|
|
14
|
+
ExecStop=/usr/bin/python3 /usr/local/sbin/orbitdb-relay-bootstrap-refresh.py
|
|
15
|
+
StandardOutput=journal
|
|
16
|
+
StandardError=journal
|
|
17
|
+
TimeoutStopSec=25
|
|
18
|
+
|
|
19
|
+
[Install]
|
|
20
|
+
WantedBy=multi-user.target
|
|
@@ -476,6 +476,7 @@ def fetch_previous_hashes(
|
|
|
476
476
|
sender: str,
|
|
477
477
|
current_item_hash: str,
|
|
478
478
|
now_ms: int,
|
|
479
|
+
deregister_all: bool = False,
|
|
479
480
|
) -> list[str]:
|
|
480
481
|
stale_cutoff_ms = now_ms - (STALE_RECORD_MAX_AGE_SECONDS * 1000)
|
|
481
482
|
normalized_sender = normalize_address(sender)
|
|
@@ -503,7 +504,10 @@ def fetch_previous_hashes(
|
|
|
503
504
|
}
|
|
504
505
|
if not same_publisher:
|
|
505
506
|
continue
|
|
506
|
-
if parsed["item_hash"] == current_item_hash:
|
|
507
|
+
if not deregister_all and parsed["item_hash"] == current_item_hash:
|
|
508
|
+
continue
|
|
509
|
+
if deregister_all:
|
|
510
|
+
found.append(str(parsed["item_hash"]))
|
|
507
511
|
continue
|
|
508
512
|
updated_at = timestamp_ms(parsed["updated_at"])
|
|
509
513
|
if updated_at is not None and updated_at < stale_cutoff_ms:
|
|
@@ -556,6 +560,49 @@ def main() -> None:
|
|
|
556
560
|
print(json_dumps({"status": "skipped", "reason": "missing publisher key"}))
|
|
557
561
|
return
|
|
558
562
|
|
|
563
|
+
publisher_address = address_from_private_key(publisher_private_key)
|
|
564
|
+
now_ms = int(time.time() * 1000)
|
|
565
|
+
channel = env_values.get("ALEPH_BOOTSTRAP_CHANNEL", DEFAULT_CHANNEL).strip() or DEFAULT_CHANNEL
|
|
566
|
+
ref = env_values.get("ALEPH_BOOTSTRAP_REF", DEFAULT_REF).strip() or DEFAULT_REF
|
|
567
|
+
post_type = env_values.get("ALEPH_BOOTSTRAP_POST_TYPE", POST_TYPE).strip() or POST_TYPE
|
|
568
|
+
if post_type != POST_TYPE:
|
|
569
|
+
raise RuntimeError(
|
|
570
|
+
f"Unsupported ALEPH_BOOTSTRAP_POST_TYPE: {post_type}. Expected {POST_TYPE}."
|
|
571
|
+
)
|
|
572
|
+
api_host = env_values.get("ALEPH_BOOTSTRAP_API_HOST", DEFAULT_API_HOST).strip() or DEFAULT_API_HOST
|
|
573
|
+
deregister_only = os.environ.get("ALEPH_BOOTSTRAP_DEREGISTER_ONLY", "").strip().lower() in {
|
|
574
|
+
"1",
|
|
575
|
+
"true",
|
|
576
|
+
"yes",
|
|
577
|
+
}
|
|
578
|
+
if deregister_only:
|
|
579
|
+
hashes = fetch_previous_hashes(
|
|
580
|
+
api_host,
|
|
581
|
+
channel,
|
|
582
|
+
ref,
|
|
583
|
+
post_type,
|
|
584
|
+
publisher_address,
|
|
585
|
+
"",
|
|
586
|
+
now_ms,
|
|
587
|
+
deregister_all=True,
|
|
588
|
+
)
|
|
589
|
+
forget_response = broadcast_forget(
|
|
590
|
+
api_host, publisher_address, publisher_private_key, hashes, channel
|
|
591
|
+
)
|
|
592
|
+
print(
|
|
593
|
+
json_dumps(
|
|
594
|
+
{
|
|
595
|
+
"status": "forgotten" if hashes else "skipped",
|
|
596
|
+
"reason": None if hashes else "no matching bootstrap records",
|
|
597
|
+
"sender": publisher_address,
|
|
598
|
+
"registrationId": registration_id,
|
|
599
|
+
"forgottenHashes": hashes,
|
|
600
|
+
"forgetResponse": forget_response,
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
)
|
|
604
|
+
return
|
|
605
|
+
|
|
559
606
|
describe = subprocess.run([DESCRIBE_SCRIPT], check=True, capture_output=True, text=True)
|
|
560
607
|
metadata = json.loads(describe.stdout.strip() or "{}")
|
|
561
608
|
peer_id = metadata.get("peer_id")
|
|
@@ -567,19 +614,9 @@ def main() -> None:
|
|
|
567
614
|
metadata.get("browser_bootstrap_multiaddrs") or [], browser_only=True
|
|
568
615
|
)
|
|
569
616
|
|
|
570
|
-
publisher_address = address_from_private_key(publisher_private_key)
|
|
571
|
-
now_ms = int(time.time() * 1000)
|
|
572
617
|
now_seconds = now_ms / 1000
|
|
573
618
|
profile = env_values.get("ALEPH_BOOTSTRAP_PROFILE", DEFAULT_PROFILE).strip() or DEFAULT_PROFILE
|
|
574
619
|
version = env_values.get("ALEPH_BOOTSTRAP_VERSION", "").strip() or None
|
|
575
|
-
channel = env_values.get("ALEPH_BOOTSTRAP_CHANNEL", DEFAULT_CHANNEL).strip() or DEFAULT_CHANNEL
|
|
576
|
-
ref = env_values.get("ALEPH_BOOTSTRAP_REF", DEFAULT_REF).strip() or DEFAULT_REF
|
|
577
|
-
post_type = env_values.get("ALEPH_BOOTSTRAP_POST_TYPE", POST_TYPE).strip() or POST_TYPE
|
|
578
|
-
if post_type != POST_TYPE:
|
|
579
|
-
raise RuntimeError(
|
|
580
|
-
f"Unsupported ALEPH_BOOTSTRAP_POST_TYPE: {post_type}. Expected {POST_TYPE}."
|
|
581
|
-
)
|
|
582
|
-
api_host = env_values.get("ALEPH_BOOTSTRAP_API_HOST", DEFAULT_API_HOST).strip() or DEFAULT_API_HOST
|
|
583
620
|
published_multiaddrs = select_compact_multiaddrs(browser_multiaddrs or multiaddrs)
|
|
584
621
|
published_browser_multiaddrs: list[str] = []
|
|
585
622
|
if not published_multiaddrs:
|
|
@@ -15,6 +15,8 @@ CADDY_UPSTREAM_HOST="${CADDY_UPSTREAM_HOST:-127.0.0.1}"
|
|
|
15
15
|
CADDY_UPSTREAM_METRICS_PORT="${CADDY_UPSTREAM_METRICS_PORT:-9090}"
|
|
16
16
|
AUTOTLS_REFRESH_SERVICE="${AUTOTLS_REFRESH_SERVICE:-orbitdb-relay-autotls-refresh.service}"
|
|
17
17
|
BOOTSTRAP_REFRESH_TIMER="${BOOTSTRAP_REFRESH_TIMER:-orbitdb-relay-bootstrap-refresh.timer}"
|
|
18
|
+
BOOTSTRAP_REFRESH_SERVICE="${BOOTSTRAP_REFRESH_SERVICE:-orbitdb-relay-bootstrap-refresh.service}"
|
|
19
|
+
BOOTSTRAP_DEREGISTER_SERVICE="${BOOTSTRAP_DEREGISTER_SERVICE:-orbitdb-relay-bootstrap-deregister.service}"
|
|
18
20
|
PUBLIC_IPV4=""
|
|
19
21
|
PUBLIC_IPV6=""
|
|
20
22
|
TCP_PORT=""
|
|
@@ -278,7 +280,10 @@ if [ "${START_SERVICE}" -eq 1 ]; then
|
|
|
278
280
|
systemctl restart "${SERVICE_NAME}"
|
|
279
281
|
systemctl enable "${AUTOTLS_REFRESH_SERVICE}"
|
|
280
282
|
systemctl enable "${BOOTSTRAP_REFRESH_TIMER}"
|
|
283
|
+
systemctl enable "${BOOTSTRAP_DEREGISTER_SERVICE}"
|
|
284
|
+
systemctl restart "${BOOTSTRAP_DEREGISTER_SERVICE}"
|
|
281
285
|
systemctl start "${BOOTSTRAP_REFRESH_TIMER}"
|
|
286
|
+
systemctl restart --no-block "${BOOTSTRAP_REFRESH_SERVICE}" || true
|
|
282
287
|
if [ -n "${PROXY_HOSTNAME}" ]; then
|
|
283
288
|
write_caddyfile "${PROXY_HOSTNAME}"
|
|
284
289
|
touch "${CADDY_READY_FILE}"
|
|
Binary file
|
|
Binary file
|