Host a bootstrap node for domegle
A Domegle seed in one Python file. Run it on an always-on machine, share the ticket it writes, and every Domegle client (desktop, Android, browser) can join the swarm through it.
Files in this repo:
| file | purpose |
|---|---|
domegle_bootstrap.py |
the node |
domegle-bootstrap.service |
systemd unit, copied as-is to /etc/systemd/system/ |
- Rendezvous: answers the lobby protocol (
/domegle/lobby/1). A client announces itself and gets back a random sample of up to 32 known peers. - Ticket: writes its current ticket to
ticket.txtand rewrites it whenever it changes. - Unlisted: it never lists itself as a chat partner. It only introduces peers.
Works on any systemd-based Ubuntu (20.04+). No new user is created; the service runs as root inside a systemd sandbox.
sudo apt update
sudo apt install -y python3 python3-venvRun this from the folder that contains the repo files:
sudo mkdir -p /opt/domegle-bootstrap
sudo cp domegle_bootstrap.py /opt/domegle-bootstrap/
sudo python3 -m venv /opt/domegle-bootstrap/venv
sudo /opt/domegle-bootstrap/venv/bin/pip install irohsudo /opt/domegle-bootstrap/venv/bin/python /opt/domegle-bootstrap/domegle_bootstrap.py --dir /tmp/domegle-testYou should see node <id> up (...) and a few seconds later ticket file: ....
Stop it with Ctrl+C.
sudo cp domegle-bootstrap.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now domegle-bootstrapsystemctl status domegle-bootstrapLook for active (running). Press q to leave the status view. To follow the logs:
journalctl -u domegle-bootstrap -fGive it 10 to 20 seconds after starting, then:
sudo ls -l /var/lib/domegle-bootstrap/
cat /var/lib/domegle-bootstrap/node_id.txt
cat /var/lib/domegle-bootstrap/ticket.txtYou should see node_id.txt, ticket.txt, status.json, ticket-history.log
and secret.key. ticket.txt is the file to share. If it is missing, the node
has not reached a relay yet; check journalctl -u domegle-bootstrap -n 50.
By default the node listens on a random UDP port and clients reach it through the iroh relay. On a server with a public IP, pin the port instead:
- Edit
/etc/systemd/system/domegle-bootstrap.service: comment out the plainExecStart=line and uncomment the one with--bind 0.0.0.0:11204. - Apply it and open the port:
sudo systemctl daemon-reload
sudo systemctl restart domegle-bootstrap
sudo ufw allow 11204/udp # and your cloud provider's firewall, if anyAny free port works; 11204 is only an example.
- Desktop: Settings, add a bootstrap ticket, or
python -m domegle --seed <ticket> - Android: start screen, Name, ticket and seeds, Add a bootstrap ticket
- Browser: the seed field in the settings panel
To ship it as a built-in seed, add it to DEFAULT_BOOTSTRAP in
domegle/config.py, android/.../core/Config.kt and wasm/src/node.rs.
A ticket is the node's id plus its current addresses (home relay URL and direct IP:port).
- The id never changes; it comes from
secret.key, created on first start. - The addresses can change on a restart or a network change. The node
rewrites
ticket.txtwhen that happens, andticket-history.loglists every ticket it has published. - An older ticket usually still works through the home relay. Share the current one anyway.
- Tickets contain the server's IP addresses. Don't publish one from a machine whose address you want to keep private.
Put one ticket per line in /var/lib/domegle-bootstrap/seeds.txt (lines
starting with # are ignored) and restart the service:
sudo systemctl restart domegle-bootstrapAlternatively, append --seed <ticket> to the ExecStart= line. The node also
joins through the built-in Domegle seed; add --no-default-seeds to run a
completely separate swarm.
Everything lives in /var/lib/domegle-bootstrap:
| file | |
|---|---|
ticket.txt |
current ticket, one line (the file to share) |
node_id.txt |
the node's stable id |
status.json |
running state, peer count, counters; refreshed every 30 s |
ticket-history.log |
every ticket published, with a UTC timestamp |
secret.key |
the node's identity (mode 0600) |
seeds.txt |
optional extra seed tickets |
Back up secret.key. Restore it on a new server and the node keeps the same
id. Delete it to get a new identity.
sudo systemctl restart domegle-bootstrap # new ticket, same id
sudo systemctl stop domegle-bootstrap
sudo systemctl disable --now domegle-bootstrap # stop and don't start on bootOnce a minute the log shows a heartbeat such as:
alive: 12 peers | lobby in 480 | announces 21 ok / 0 failed | joined
--dir DIR state directory
--seed TICKET another node to federate with (repeatable)
--no-default-seeds don't join through the built-in Domegle seed
--bind ADDR:PORT fixed UDP address, e.g. 0.0.0.0:11204
--log-level LEVEL DEBUG, INFO (default), WARNING, ERROR
--show-ticket print the ticket from the state directory and exit
nohup venv/bin/python domegle_bootstrap.py >> bootstrap.log 2>&1 &It will not restart after a crash or reboot, so use the service for anything long-lived.