@le-space/rootfs 0.2.0 → 0.3.2
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-pinner/rootfs/build-rootfs-image.sh +10 -0
- package/reference/orbitdb-relay-pinner/rootfs/orbitdb-relay-pinner-bootstrap-refresh.py +546 -0
- package/reference/orbitdb-relay-pinner/rootfs/orbitdb-relay-pinner-bootstrap-refresh.service +13 -0
- package/reference/orbitdb-relay-pinner/rootfs/orbitdb-relay-pinner-bootstrap-refresh.timer +12 -0
- package/reference/orbitdb-relay-pinner/rootfs/orbitdb-relay-pinner-bootstrap.sh +3 -1
- package/reference/orbitdb-relay-pinner/rootfs/orbitdb-relay-pinner-configure.sh +49 -0
- package/reference/orbitdb-relay-pinner/rootfs/orbitdb-relay-pinner-setup-server.py +27 -0
- package/reference/uc-go-peer/rootfs/build-rootfs-image.sh +4 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-bootstrap-refresh.py +544 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-bootstrap-refresh.service +13 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-bootstrap-refresh.timer +12 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-bootstrap.sh +2 -1
- package/reference/uc-go-peer/rootfs/uc-go-peer-configure.sh +63 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-setup-server.py +27 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[Unit]
|
|
2
|
+
Description=Refresh Aleph bootstrap registration for uc-go-peer
|
|
3
|
+
Wants=network-online.target
|
|
4
|
+
After=network-online.target uc-go-peer.service
|
|
5
|
+
ConditionPathExists=/etc/default/uc-go-peer.ready
|
|
6
|
+
|
|
7
|
+
[Service]
|
|
8
|
+
Type=oneshot
|
|
9
|
+
Environment=ENV_FILE=/etc/default/uc-go-peer
|
|
10
|
+
Environment=DESCRIBE_SCRIPT=/usr/local/sbin/uc-go-peer-describe.py
|
|
11
|
+
ExecStart=/usr/bin/python3 /usr/local/sbin/uc-go-peer-bootstrap-refresh.py
|
|
12
|
+
StandardOutput=journal
|
|
13
|
+
StandardError=journal
|
|
@@ -31,7 +31,8 @@ run_phase_base() {
|
|
|
31
31
|
echo "[uc-go-peer-bootstrap] running apt-get update"
|
|
32
32
|
apt-get update
|
|
33
33
|
echo "[uc-go-peer-bootstrap] installing base packages"
|
|
34
|
-
apt-get install -y ca-certificates curl caddy
|
|
34
|
+
apt-get install -y ca-certificates curl caddy python3-pip
|
|
35
|
+
python3 -m pip install --break-system-packages --no-cache-dir eth-account
|
|
35
36
|
rm -rf /var/lib/apt/lists/*
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -9,6 +9,7 @@ AUTOTLS_HOSTS_FILE="${AUTOTLS_HOSTS_FILE:-/etc/default/uc-go-peer.autotls-hosts}
|
|
|
9
9
|
AUTOTLS_CADDY_READY_FILE="${AUTOTLS_CADDY_READY_FILE:-/etc/default/uc-go-peer.caddy-ready}"
|
|
10
10
|
SERVICE_NAME="${SERVICE_NAME:-uc-go-peer.service}"
|
|
11
11
|
AUTOTLS_REFRESH_SERVICE="${AUTOTLS_REFRESH_SERVICE:-uc-go-peer-autotls-refresh.service}"
|
|
12
|
+
BOOTSTRAP_REFRESH_TIMER="${BOOTSTRAP_REFRESH_TIMER:-uc-go-peer-bootstrap-refresh.timer}"
|
|
12
13
|
CADDY_SERVICE="${CADDY_SERVICE:-caddy.service}"
|
|
13
14
|
CADDYFILE="${CADDYFILE:-/etc/caddy/Caddyfile}"
|
|
14
15
|
BOOTSTRAP_SERVICE="${BOOTSTRAP_SERVICE:-uc-go-peer-bootstrap.service}"
|
|
@@ -20,6 +21,11 @@ WS_PORT="9097"
|
|
|
20
21
|
WS_BACKEND_PORT="9096"
|
|
21
22
|
PROXY_HOSTNAME=""
|
|
22
23
|
UDP_PORT=""
|
|
24
|
+
BOOTSTRAP_PUBLISHER_PRIVATE_KEY=""
|
|
25
|
+
BOOTSTRAP_PUBLISHER_LIBP2P_IDENTITY_B64=""
|
|
26
|
+
BOOTSTRAP_OWNER_PRIVATE_KEY=""
|
|
27
|
+
BOOTSTRAP_OWNER_AUTHORIZATION_B64=""
|
|
28
|
+
BOOTSTRAP_REGISTRATION_ID=""
|
|
23
29
|
START_SERVICE=1
|
|
24
30
|
|
|
25
31
|
usage() {
|
|
@@ -35,6 +41,11 @@ Usage:
|
|
|
35
41
|
[--quic-port <host-port>] \
|
|
36
42
|
[--webtransport-port <host-port>] \
|
|
37
43
|
[--webrtc-port <host-port>] \
|
|
44
|
+
[--bootstrap-publisher-private-key <hex>] \
|
|
45
|
+
[--bootstrap-publisher-libp2p-identity-b64 <base64>] \
|
|
46
|
+
[--bootstrap-owner-private-key <hex>] \
|
|
47
|
+
[--bootstrap-owner-authorization-b64 <base64>] \
|
|
48
|
+
[--bootstrap-registration-id <id>] \
|
|
38
49
|
[--no-start]
|
|
39
50
|
EOF
|
|
40
51
|
}
|
|
@@ -68,6 +79,16 @@ https://${proxy_hostname} {
|
|
|
68
79
|
EOF
|
|
69
80
|
}
|
|
70
81
|
|
|
82
|
+
current_identity_path() {
|
|
83
|
+
local existing
|
|
84
|
+
existing="$(grep -E '^[#[:space:]]*GO_PEER_IDENTITY_PATH=' "${ENV_FILE}" 2>/dev/null | tail -n1 | cut -d= -f2- || true)"
|
|
85
|
+
if [ -n "${existing}" ]; then
|
|
86
|
+
printf '%s\n' "${existing}"
|
|
87
|
+
return
|
|
88
|
+
fi
|
|
89
|
+
printf '/var/lib/uc-go-peer/identity.key\n'
|
|
90
|
+
}
|
|
91
|
+
|
|
71
92
|
while [ "$#" -gt 0 ]; do
|
|
72
93
|
case "$1" in
|
|
73
94
|
--public-ipv4)
|
|
@@ -106,6 +127,26 @@ while [ "$#" -gt 0 ]; do
|
|
|
106
127
|
UDP_PORT="${2:-}"
|
|
107
128
|
shift 2
|
|
108
129
|
;;
|
|
130
|
+
--bootstrap-publisher-private-key)
|
|
131
|
+
BOOTSTRAP_PUBLISHER_PRIVATE_KEY="${2:-}"
|
|
132
|
+
shift 2
|
|
133
|
+
;;
|
|
134
|
+
--bootstrap-publisher-libp2p-identity-b64)
|
|
135
|
+
BOOTSTRAP_PUBLISHER_LIBP2P_IDENTITY_B64="${2:-}"
|
|
136
|
+
shift 2
|
|
137
|
+
;;
|
|
138
|
+
--bootstrap-owner-private-key)
|
|
139
|
+
BOOTSTRAP_OWNER_PRIVATE_KEY="${2:-}"
|
|
140
|
+
shift 2
|
|
141
|
+
;;
|
|
142
|
+
--bootstrap-owner-authorization-b64)
|
|
143
|
+
BOOTSTRAP_OWNER_AUTHORIZATION_B64="${2:-}"
|
|
144
|
+
shift 2
|
|
145
|
+
;;
|
|
146
|
+
--bootstrap-registration-id)
|
|
147
|
+
BOOTSTRAP_REGISTRATION_ID="${2:-}"
|
|
148
|
+
shift 2
|
|
149
|
+
;;
|
|
109
150
|
--no-start)
|
|
110
151
|
START_SERVICE=0
|
|
111
152
|
shift
|
|
@@ -183,6 +224,26 @@ if [ -n "${UDP_PORT}" ]; then
|
|
|
183
224
|
write_env_var "EXTERNAL_RELAY_WEBTRANSPORT_PORT" "${UDP_PORT}"
|
|
184
225
|
write_env_var "EXTERNAL_RELAY_WEBRTC_PORT" "${UDP_PORT}"
|
|
185
226
|
fi
|
|
227
|
+
if [ -n "${BOOTSTRAP_PUBLISHER_PRIVATE_KEY}" ]; then
|
|
228
|
+
write_env_var "ALEPH_BOOTSTRAP_PUBLISHER_PRIVATE_KEY" "${BOOTSTRAP_PUBLISHER_PRIVATE_KEY}"
|
|
229
|
+
fi
|
|
230
|
+
if [ -n "${BOOTSTRAP_PUBLISHER_LIBP2P_IDENTITY_B64}" ]; then
|
|
231
|
+
identity_path="$(current_identity_path)"
|
|
232
|
+
mkdir -p "$(dirname "${identity_path}")"
|
|
233
|
+
printf '%s' "${BOOTSTRAP_PUBLISHER_LIBP2P_IDENTITY_B64}" | base64 -d > "${identity_path}"
|
|
234
|
+
chmod 0400 "${identity_path}"
|
|
235
|
+
chown uc-go-peer:uc-go-peer "${identity_path}" || true
|
|
236
|
+
fi
|
|
237
|
+
if [ -n "${BOOTSTRAP_OWNER_PRIVATE_KEY}" ]; then
|
|
238
|
+
write_env_var "ALEPH_BOOTSTRAP_OWNER_PRIVATE_KEY" "${BOOTSTRAP_OWNER_PRIVATE_KEY}"
|
|
239
|
+
fi
|
|
240
|
+
if [ -n "${BOOTSTRAP_OWNER_AUTHORIZATION_B64}" ]; then
|
|
241
|
+
write_env_var "ALEPH_BOOTSTRAP_OWNER_AUTHORIZATION_B64" "${BOOTSTRAP_OWNER_AUTHORIZATION_B64}"
|
|
242
|
+
fi
|
|
243
|
+
if [ -n "${BOOTSTRAP_REGISTRATION_ID}" ]; then
|
|
244
|
+
write_env_var "ALEPH_BOOTSTRAP_REGISTRATION_ID" "${BOOTSTRAP_REGISTRATION_ID}"
|
|
245
|
+
fi
|
|
246
|
+
write_env_var "ALEPH_BOOTSTRAP_PROFILE" "uc-go-peer"
|
|
186
247
|
write_env_var "LIBP2P_ANNOUNCE_ADDRS" "${announce_value}"
|
|
187
248
|
touch "${READY_FILE}"
|
|
188
249
|
|
|
@@ -191,6 +252,8 @@ if [ "${START_SERVICE}" -eq 1 ]; then
|
|
|
191
252
|
systemctl enable "${SERVICE_NAME}"
|
|
192
253
|
systemctl restart "${SERVICE_NAME}"
|
|
193
254
|
systemctl enable "${AUTOTLS_REFRESH_SERVICE}"
|
|
255
|
+
systemctl enable "${BOOTSTRAP_REFRESH_TIMER}"
|
|
256
|
+
systemctl start "${BOOTSTRAP_REFRESH_TIMER}"
|
|
194
257
|
if [ -n "${PROXY_HOSTNAME}" ]; then
|
|
195
258
|
systemctl enable "${CADDY_SERVICE}"
|
|
196
259
|
systemctl restart "${CADDY_SERVICE}"
|
|
@@ -135,6 +135,14 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
135
135
|
udp_port = payload.get("udp_port")
|
|
136
136
|
quic_port = payload.get("quic_port")
|
|
137
137
|
webrtc_port = payload.get("webrtc_port")
|
|
138
|
+
bootstrap_publisher_private_key = payload.get("bootstrap_publisher_private_key")
|
|
139
|
+
bootstrap_publisher_libp2p_identity_b64 = payload.get(
|
|
140
|
+
"bootstrap_publisher_libp2p_identity_b64"
|
|
141
|
+
)
|
|
142
|
+
bootstrap_owner_private_key = payload.get("bootstrap_owner_private_key")
|
|
143
|
+
bootstrap_owner_authorization_b64 = payload.get("bootstrap_owner_authorization_b64")
|
|
144
|
+
bootstrap_registration_id = payload.get("bootstrap_registration_id")
|
|
145
|
+
no_start = bool(payload.get("no_start"))
|
|
138
146
|
args = [
|
|
139
147
|
CONFIGURE_SCRIPT,
|
|
140
148
|
"--public-ipv4",
|
|
@@ -153,6 +161,25 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
153
161
|
udp_candidate = webrtc_port
|
|
154
162
|
if udp_candidate is not None:
|
|
155
163
|
args.extend(["--udp-port", _validate_port(udp_candidate, "udp_port")])
|
|
164
|
+
if bootstrap_publisher_private_key is not None:
|
|
165
|
+
args.extend(["--bootstrap-publisher-private-key", str(bootstrap_publisher_private_key)])
|
|
166
|
+
if bootstrap_publisher_libp2p_identity_b64 is not None:
|
|
167
|
+
args.extend(
|
|
168
|
+
[
|
|
169
|
+
"--bootstrap-publisher-libp2p-identity-b64",
|
|
170
|
+
str(bootstrap_publisher_libp2p_identity_b64),
|
|
171
|
+
]
|
|
172
|
+
)
|
|
173
|
+
if bootstrap_owner_private_key is not None:
|
|
174
|
+
args.extend(["--bootstrap-owner-private-key", str(bootstrap_owner_private_key)])
|
|
175
|
+
if bootstrap_owner_authorization_b64 is not None:
|
|
176
|
+
args.extend(
|
|
177
|
+
["--bootstrap-owner-authorization-b64", str(bootstrap_owner_authorization_b64)]
|
|
178
|
+
)
|
|
179
|
+
if bootstrap_registration_id is not None:
|
|
180
|
+
args.extend(["--bootstrap-registration-id", str(bootstrap_registration_id)])
|
|
181
|
+
if no_start:
|
|
182
|
+
args.append("--no-start")
|
|
156
183
|
except ValueError as error:
|
|
157
184
|
self._send_json(400, {"status": "bad-request", "error": str(error)})
|
|
158
185
|
return
|