init --no-phrase: an identity without a recovery phrase
For bootstrap nodes and other unattended setups: nothing is shown or logged, and the data directory is marked so later messages do not point to 'allmende recover', which cannot work. The identity lasts the certificate lifetime (a year) and then has to be replaced; the node says so. The Kubernetes StatefulSet now initialises itself on first start with it, so no manual exec step is left. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
+15
-12
@@ -43,17 +43,11 @@ so:
|
||||
kubectl apply -k k8s/base # with a LoadBalancer (MetalLB, kube-vip, ...)
|
||||
kubectl apply -k k8s/overlays/nodeport # or: NodePort 30401, no load balancer
|
||||
```
|
||||
The pod starts and waits: it has no identity yet.
|
||||
4. **Create the identity, once.** This shows the 12-word recovery phrase; it is
|
||||
done by hand so the phrase never lands in a log.
|
||||
```
|
||||
kubectl -n allmende exec -it allmende-0 -- allmende init
|
||||
```
|
||||
Write the words down. The node starts by itself a few seconds later. Keys
|
||||
and the database are on the volume (`data-allmende-0`): keep it, and back
|
||||
it up if you can; the phrase can recover the identity (`allmende recover`)
|
||||
but not the listings of other people.
|
||||
5. **Publish the DNS records.** The node prints them at start:
|
||||
On its first start the pod creates its identity by itself
|
||||
(`allmende init --no-phrase`): no recovery phrase is made or logged. The keys
|
||||
and the database live on the volume (`data-allmende-0`). **Keep that volume**
|
||||
(and back it up if you can): the peer ID in your DNS records is stored there.
|
||||
4. **Publish the DNS records.** The node prints them at start:
|
||||
```
|
||||
kubectl -n allmende logs allmende-0 | grep dnsaddr=
|
||||
```
|
||||
@@ -62,7 +56,7 @@ so:
|
||||
```
|
||||
dig +short TXT _dnsaddr.allmende.stinnesbeck.com
|
||||
```
|
||||
6. **Try it from outside your network** (a phone on mobile data, or a VPS):
|
||||
5. **Try it from outside your network** (a phone on mobile data, or a VPS):
|
||||
```
|
||||
allmende init && allmende run # no --bootstrap needed
|
||||
```
|
||||
@@ -70,6 +64,15 @@ so:
|
||||
|
||||
## Good to know
|
||||
|
||||
- **The identity lasts a year, and cannot be renewed.** A certificate is valid
|
||||
for at most 366 days, and without a recovery phrase nothing can sign a new
|
||||
one. The node warns in its log 30 days before and refuses to start after.
|
||||
Then: delete the volume (or its contents), let the pod start again (a new
|
||||
identity, so a new peer ID), and replace the `dnsaddr=` records with the new
|
||||
ones from the log. Do it a few days early and keep the old records until the
|
||||
new node is up. If you would rather have a renewable identity, create it once
|
||||
by hand with a phrase (`allmende init`, without `--no-phrase`) on the volume
|
||||
before the first start.
|
||||
- **One replica only.** A second pod would be a second node with its own
|
||||
identity, not a copy.
|
||||
- **No sign-in link in the log.** `allmende run` normally prints the owner
|
||||
|
||||
+10
-16
@@ -1,9 +1,8 @@
|
||||
# One node, with its keys and database on a volume. Keep it at one replica: a
|
||||
# second pod would be a second node with its own identity, not a copy.
|
||||
#
|
||||
# The identity is created by hand, once, because it shows a recovery phrase
|
||||
# that must never end up in a log. Until you do, the pod waits:
|
||||
# kubectl -n allmende exec -it allmende-0 -- allmende init
|
||||
# The identity is created on the first start, without a recovery phrase (so
|
||||
# nothing secret is logged). It lasts a year; see k8s/README.md.
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
@@ -31,16 +30,15 @@ spec:
|
||||
- name: allmende
|
||||
image: allmende
|
||||
imagePullPolicy: IfNotPresent
|
||||
# Wait for 'allmende init' (it writes admin.token last), then run as a
|
||||
# bootstrap node: --public serves the DHT and relays for nodes behind
|
||||
# a NAT, --announce names the address the router forwards.
|
||||
# First start: create the identity without a recovery phrase (a
|
||||
# bootstrap node has nothing to recover; its identity is its peer ID,
|
||||
# which lives on the volume). Then run as a bootstrap node: --public
|
||||
# serves the DHT and relays for nodes behind a NAT, --announce names
|
||||
# the address the router forwards.
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
until [ -f /data/admin.token ]; do
|
||||
echo "not set up yet: run kubectl -n allmende exec -it allmende-0 -- allmende init"
|
||||
sleep 10
|
||||
done
|
||||
[ -f /data/admin.token ] || allmende init --no-phrase
|
||||
exec allmende run \
|
||||
--public \
|
||||
--no-default-bootstrap \
|
||||
@@ -67,21 +65,17 @@ spec:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
# Ready once the node answers; before 'init' it never does, which keeps
|
||||
# a half-set-up node out of the Services without restarting it.
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /api/v1/status
|
||||
port: http
|
||||
periodSeconds: 10
|
||||
# Only judge it dead after the first start succeeded (the wait for
|
||||
# 'init' may take as long as you need).
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /api/v1/status
|
||||
port: http
|
||||
periodSeconds: 10
|
||||
failureThreshold: 360
|
||||
periodSeconds: 5
|
||||
failureThreshold: 60
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /api/v1/status
|
||||
|
||||
Reference in New Issue
Block a user