2 Deployment
Jean edited this page 2026-07-21 14:49:20 +00:00

Deployment

Running echo in production. echo is the account and channel authority for a network, so the two things that matter most are durability and backups. Both are covered below.

Build

git clone https://git.devtronic.pro/fedserv/echo.git
cd echo
cargo build --release        # protoc is vendored; no system protobuf needed

The binary is target/release/echo.

Install

Run echo as a dedicated unprivileged user, with config.toml and the event log in one data directory.

useradd --system --home-dir /opt/echo --shell /usr/sbin/nologin echo
install -d -o echo -g echo /opt/echo
install -o echo -g echo target/release/echo   /opt/echo/echo
install -o echo -g echo config.example.toml   /opt/echo/config.toml   # then edit it
install -m0644 scripts/echo.service /etc/systemd/system/echo.service  # edit the paths and User
systemctl daemon-reload
systemctl enable --now echo

scripts/echo.service is a hardened unit (no new privileges, read-only system, private tmp, restart on failure). Relax ProtectSystem=strict if you use a network mail relay rather than a local sendmail.

On the InspIRCd uplink, add a <link> block matching [uplink] and [server] in config.toml: the same name, SID, password, and port. echo links as its [server] name. The full reference is on the Configuration page. For a TLS link, set [uplink] tls = true and pin the server's SPKI fingerprint.

Durability

Every committed change (registration, password, access, ban) is fsync'd to the event log before its command reports success, so a crash or power loss cannot lose it. Compaction rewrites the log to a temp file, fsyncs, and renames atomically, so a crash during compaction leaves the previous log intact. The log tolerates a truncated final line on load (it is skipped), which is what makes a plain file copy a safe backup.

Back up

The event log is the whole database. Back it up on a schedule with scripts/backup.sh, which gzips a timestamped snapshot and prunes old ones:

# /etc/systemd/system/echo-backup.service
[Service]
Type=oneshot
User=echo
Environment=ECHO_DATA_DIR=/opt/echo ECHO_BACKUP_DIR=/opt/echo/backups
ExecStart=/opt/echo/scripts/backup.sh
# /etc/systemd/system/echo-backup.timer
[Timer]
OnCalendar=hourly
Persistent=true
[Install]
WantedBy=timers.target

systemctl enable --now echo-backup.timer, and copy backups off-box as well.

Restore

systemctl stop echo
gunzip -c /opt/echo/backups/echo.db.<stamp>.jsonl.gz > /opt/echo/echo.db.jsonl
systemctl start echo

Upgrade

git pull
cargo build --release
install -o echo -g echo target/release/echo /opt/echo/echo
systemctl restart echo

The on-disk format is an append-only event log: new event kinds are additive, and old logs replay unchanged. Take a backup before upgrading regardless.

Monitor

  • systemctl status echo and journalctl -u echo -f. The log records write failures, compaction, and the account-store load at startup.
  • The optional [health] endpoint serves /health for a liveness probe and /metrics for a Prometheus scrape.
  • Systemd Restart=on-failure brings it back after a crash.

Running more than one node

Optional; start with a single node. If you scale out, give each node a [gossip] bind and shared secret and a [[peer]] for the others, over mutually-authenticated TLS. Account identity replicates to every node; channel state stays local to the node that owns it. See Federation.

Caveats

echo is pre-1.0. It is memory-safe, does not panic on malformed protocol input, and is durable, but it has not accumulated a long production track record yet. Run it on your own network first, keep backups off-box, and watch the logs.