Meshly Docs
Features

Self-Hosting

Run your own meshly-core-server — server.toml, groups and tokens, heartbeats, relay rate limiting, and a systemd unit.

The server owns the control plane (the service registry) and a fallback data-plane relay for clients that cannot establish a direct P2P path. Running your own means you own the registry, the relay and the tokens.

server.toml

[common]
identity_path = "./keys/server.key"

[common.logging]
level = "info"

[[group]]
name        = "homelab"
group_token = "long-random-string-shared-with-clients"

[heartbeat]
interval_secs = 60
timeout_secs  = 600
  • [[group]] declares a group and its token. Clients must present the matching group_token to register or to subscribe.
  • [heartbeat].timeout_secs is how long a client may go silent before it is declared offline and its services are garbage-collected. The client heartbeats every 60s; keep the timeout comfortably higher (≥ 600s) so a relay change mid-session does not drop a live provider.
  • [common].identity_path must differ from every other meshly process on the machine, or they share <config_dir>/meshly-core/identity.key and end up with the same NodeID — which shows up as confusing subscription: service not found errors.

Print the NodeID clients need:

meshly-core-client id

Relay rate limiting

The relay caps the reply direction (provider → consumer) per active connection with a token bucket. It is off by default.

[relay]
enabled       = false      # master switch
bytes_per_sec = 102400     # 100 KiB/s default cap when enabled

# per-consumer overrides, keyed by the consumer's EndpointID
# (canonical z-base32 or 64-char hex)
[[relay.rate_override]]
node_id       = "abcdef…"
bytes_per_sec = 1048576    # 1 MiB/s for this consumer

[[relay.rate_override]]
node_id       = "0123456789abcdef…"
bytes_per_sec = 0          # unlimited for this consumer
  • With enabled = false the relay forwards as fast as QUIC allows; overrides are parsed but not applied.
  • With enabled = true, consumers not listed fall back to bytes_per_sec. 0 means unlimited for that consumer — the master switch still governs whether throttling runs at all.
  • The DataOpen frame carries the consumer's own NodeID; if it does not match the QUIC connection's peer, the server rejects the open. A consumer cannot claim someone else's override.
  • Each connection's cap lives in a handle registered by stream_id, so a control-plane message can retune an individual connection at runtime; the next refill picks up the new value.

systemd

# /etc/systemd/system/meshly-core-server.service
[Unit]
Description=meshly-core server
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=meshly
Group=meshly
WorkingDirectory=/opt/meshly
ExecStart=/usr/local/bin/meshly-core-server -c /etc/meshly/server.toml
Restart=on-failure
RestartSec=2
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now meshly-core-server
sudo journalctl -u meshly-core-server -f

Keep the identity key readable only by the service user (chmod 600), and back it up: losing it changes the server's NodeID and every client must be reconfigured.

Operational notes

  • The provider's service registration lives only as long as its control-plane connection. A dropped session means the service disappears from the registry until the client reconnects (it reconnects automatically, with backoff from [reconnect]).
  • The server needs no inbound ports beyond what Iroh needs for QUIC; if direct P2P is unavailable, clients fall back to the relay, so a relay-capable deployment should stay reachable.
  • TCP only: there is no UDP forwarding, HTTP virtual hosting or ACL layer yet.

On this page