Skip to content
domeglePublic

About

Host a bootstrap node for domegle

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

bootstrap

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/

What it does

  • 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.txt and rewrites it whenever it changes.
  • Unlisted: it never lists itself as a chat partner. It only introduces peers.

Install on Ubuntu

Works on any systemd-based Ubuntu (20.04+). No new user is created; the service runs as root inside a systemd sandbox.

1. Install packages

sudo apt update
sudo apt install -y python3 python3-venv

2. Put the script in place and create the venv

Run 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 iroh

3. (Optional) Test in the foreground

sudo /opt/domegle-bootstrap/venv/bin/python /opt/domegle-bootstrap/domegle_bootstrap.py --dir /tmp/domegle-test

You should see node <id> up (...) and a few seconds later ticket file: .... Stop it with Ctrl+C.

4. Install the service

sudo cp domegle-bootstrap.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now domegle-bootstrap

5. Check that it is running

systemctl status domegle-bootstrap

Look for active (running). Press q to leave the status view. To follow the logs:

journalctl -u domegle-bootstrap -f

6. Check that the id and ticket were created

Give 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.txt

You 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.

Let peers connect directly (recommended on a public server)

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:

  1. Edit /etc/systemd/system/domegle-bootstrap.service: comment out the plain ExecStart= line and uncomment the one with --bind 0.0.0.0:11204.
  2. 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 any

Any free port works; 11204 is only an example.

Giving the ticket to users

  • 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.

About the ticket

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.txt when that happens, and ticket-history.log lists 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.

Running several bootstrap nodes

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

Alternatively, 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.

Files

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.

Manage the service

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 boot

Once a minute the log shows a heartbeat such as:

alive: 12 peers | lobby in 480 | announces 21 ok / 0 failed | joined

Options

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

Without systemd

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.

About

Host a bootstrap node for domegle

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages