Commit Graph
1643 Commits
Author SHA1 Message Date
Jannis Braun 531b496618 feat(deploy): three deployment modes + prebuilt multi-arch image for robust self-hosting
Make Backspace self-hostable in any homelab environment, not just a clean host
that owns ports 80/443.

install.sh is now mode-aware and auto-detects which fits:
  - allinone (default): bundled Caddy + auto-HTTPS — unchanged behavior
  - proxy: behind your own reverse proxy (nginx / Traefik / Caddy / Nginx Proxy
    Manager / SWAG) — app published on 127.0.0.1:APP_PORT, no bundled Caddy,
    prints paste-ready proxy snippets
  - tunnel: behind a tunnel (Cloudflare / Tailscale) — same, plus a 90MB upload
    cap (under Cloudflare's 100MB body limit) and voice force-disabled (WebRTC
    over UDP can't traverse a tunnel)

Port detection is Docker-aware (consults `docker ps` published ports, not just
`ss`), so a host whose proxy already owns 80/443 via iptables DNAT — with no
listening socket for `ss` to see — is correctly detected as "taken" instead of
dead-ending.

docker-compose.proxy.yml is a small overlay, layered via COMPOSE_FILE (written
into .env so no `-f` flags are ever needed), that publishes the loopback port and
parks Caddy in an inert profile. The base compose file is untouched, so All-in-One
behaves exactly as before.

Prebuilt image: .github/workflows/docker-publish.yml builds and pushes a
multi-arch (linux/amd64 + linux/arm64) image to ghcr.io/thezwiss/backspace on
release tags (and manual dispatch), so weak/ARM hosts skip the ~1.6GB local build
(the Vite build OOMs small ARM boxes). install.sh and docker-compose.yml default
to pulling it, fall back to an image already present on the host, and finally to a
from-source build — AGPL §13 commit stamping preserved on every path. Kept
deliberately separate from the desktop-installer workflow (release.yml).

Docs: README gains a "Deployment modes" section (all three modes, nginx / Caddy /
Traefik snippets, GUI-proxy field-by-field, cloudflared ingress, the update path,
and voice-per-mode caveats); docs/systems/deployment.md updated to match.

Verified live on a throwaway VM: proxy + all-in-one end-to-end through install.sh
(with a real Let's Encrypt cert), tunnel config generation, loopback-only binding,
and the local-image fallback path.
2026-07-06 13:36:29 +02:00
Jannis Braun e7f41b5609 fix(desktop): don't let uiohook-napi rebuild abort the whole workspace install
The @backspace/desktop postinstall runs `electron-rebuild -f -w uiohook-napi`,
which compiles a native module from source and needs a C++ toolchain
(make/g++/python3). On a bare host without those — a typical VPS a self-hoster
clones onto — that failure took the ENTIRE `pnpm install` down (exit 255), so the
server never installed either, even though uiohook-napi is desktop-only and
irrelevant to hosting.

Make the rebuild non-fatal: on failure it now prints a clear one-line warning and
continues. Machines with build tools (CI, desktop devs) are byte-identical — the
fallback never fires; only toolless boxes (which aren't building the desktop app
anyway) skip it. Verified on a bare x86 box: full `pnpm install` now exits 0 and
the server builds and boots from source. Docs note the build-tool requirement for
desktop work and point self-hosters at the Docker installer.
2026-07-06 01:52:06 +02:00
Jannis Braun 24accc3647 docs(env): make the JWT_SECRET requirement explicit in .env.example
Spell out that JWT_SECRET is required and must be a strong 32+ char value, and
that the empty default is intentional (docker compose fails fast rather than the
server boot-looping). Pairs with the compose-level guard added in 028005d.
2026-07-06 01:20:08 +02:00
Jannis Braun 028005d487 fix(compose): fail fast on missing JWT_SECRET instead of a silent restart loop
Without JWT_SECRET the server throws at boot (config.ts) and `restart:
unless-stopped` turns that into an endless crash loop that is invisible unless
you run `docker compose logs backspace`. Guard it exactly like DOMAIN already is,
so `docker compose up` stops immediately with an actionable message. install.sh
generates the secret before bringing the stack up, so this only affects the
manual `cp .env.example .env && docker compose up` path.
2026-07-06 01:12:14 +02:00
Jannis Braun 9d3f72be75 chore: pin Node 20 (LTS) and pnpm 10.34.3
Unpinned `pnpm@latest` in the Dockerfile made fresh builds non-reproducible:
`latest` now resolves to pnpm 11, but the committed lockfile targets pnpm 10, so
`pnpm install --frozen-lockfile` fails with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH on
a clean host. Pin pnpm to 10.34.3 across the Dockerfile, the `packageManager`
field, and the release workflow; pin Node to 20 (LTS) via `.nvmrc` and `engines`
so Docker, CI, and from-source builds all use the same tested toolchain.

Also corrects the docs: the lockfile is v9.0 (requires pnpm 10, not "pnpm 8+"),
and "Node 20+" implied untested newer majors were supported.
2026-07-06 01:04:59 +02:00
Jannis Braun ef020601eb ci(release): build arm64 .deb with host-native fpm (USE_SYSTEM_FPM)
Release Desktop / build (--linux --arm64, ubuntu-24.04-arm) (push) Waiting to run
Release Desktop / build (--linux --x64, ubuntu-latest) (push) Waiting to run
Release Desktop / build (--mac --arm64 --x64, macos-latest) (push) Waiting to run
Release Desktop / build (--win --x64 --arm64, windows-2022) (push) Waiting to run
CI run 2: mac/win/linux-x64 green, but linux-arm64 failed packaging .deb —
electron-builder's bundled fpm is x86_64-only and can't execute on the arm64
runner (Exec format error). The arm64 AppImage built fine; only fpm/.deb broke.
Install fpm natively on the Linux runners and set USE_SYSTEM_FPM=true so both
arches package .deb with a host-native fpm. Preserves arm64 .deb (the reason
the arm64 runner was added — Raspberry Pi users).
v1.0.0
2026-07-03 13:54:56 +02:00
Jannis Braun 9c293b9731 ci(release): fix native uiohook-napi build on Windows + Linux
First real CI run failed on 3 of 4 platforms in postinstall (electron-rebuild
of uiohook-napi):
- Linux (x64+arm64): missing X11 dev headers — 'Xrandr.h: No such file'. Add the
  full libuiohook header set (libxrandr-dev, libxinerama-dev, libx11-xcb-dev,
  libxkbfile-dev, libxkbcommon-x11-dev) derived from its #include list.
- Windows: node-gyp on the windows-latest image can't detect VS 18
  ('unknown version undefined'). Pin to windows-2022 (VS 2022 / v17).
macOS built cleanly and is unaffected.
2026-07-03 13:47:29 +02:00
Jannis Braun 90fe262676 docs(desktop): document unsigned-build auto-update status and CI release pipeline 2026-07-03 13:28:37 +02:00
Jannis Braun 45cee93e7d docs(readme): add desktop download section with per-platform install notes 2026-07-03 13:28:37 +02:00
Jannis Braun 70a648d209 ci(release): build Linux arm64 on native arm runner; pin unsigned mac builds 2026-07-03 13:17:13 +02:00
Jannis Braun 28b6fb677b Merge federation orphaned-account detach + sync-filtering + re-attach + DM reconciliation
Detach semantics for accounts whose home instance was reset (sovereign local
account, self-heal disabled, S2S guards exclude detached rows), plus three
follow-ups proven by two-instance e2e on the live boxes:
- dead-incarnation sync filtering (receiver self-homed guard, requester-scoped
  DM/friend sync, deleted-snapshot flag, startup junk sweep)
- owner-initiated re-attach (proof-gated re-bind + stub merge; automatic on
  connect when username+password match, AccountPanel fallback)
- 1-on-1 DM federatedId reconciliation on re-attach (re-key/merge) + startup
  drift heal

Server 1335 tests + web 456 green; e2e verified: reset->re-register->connect
yields zero self-homed junk, correct re-bind, single merged conversation.
2026-07-03 13:11:23 +02:00
Jannis Braun acde64a642 docs(federation/dm): re-attach 1-on-1 federatedId reconciliation + drift sweep 2026-07-03 12:46:12 +02:00
Jannis Braun 21c8731f3a feat(web): refetch DM list after re-attach so reconciled conversation replaces the split (reattach-dm-reconcile spec §3.4) 2026-07-03 12:44:00 +02:00
Jannis Braun 011a9be92a feat(federation): startup sweep reconciles drifted 1-on-1 DM federatedIds — heals pre-fix re-attaches (reattach-dm-reconcile spec §3.3) 2026-07-03 12:36:17 +02:00
Jannis Braun 0bb4ef8cad feat(federation): re-attach reconciles the account's 1-on-1 DM federatedIds inline (reattach-dm-reconcile spec §3.2) 2026-07-03 12:34:18 +02:00
Jannis Braun 1da44c8d6b feat(federation): reconcileDmChannelFederatedId — re-key/merge 1-on-1 DM channels on identity change (reattach-dm-reconcile spec §3.1) 2026-07-03 12:28:21 +02:00
Jannis Braun d3af4f2170 fix(federation): close re-attach final-review findings — client/server domain normalization, merge attachment repoint, empty-domain guard, test hardening 2026-07-03 02:43:45 +02:00
Jannis Braun 521aff6e52 docs(federation/auth/api/db/client): detached-account re-attach flow; reset-cleanup panel mentions re-attach 2026-07-03 02:28:35 +02:00
Jannis Braun 344a429e98 feat(web): automatic re-attach on connect + AccountPanel fallback action (re-attach spec §3.4) 2026-07-03 02:19:51 +02:00
Jannis Braun d45366c4ff feat(federation): owner-initiated detached-account re-attach — proof-gated re-bind with stub merge (re-attach spec §3.2, §3.3) 2026-07-03 02:06:00 +02:00
Jannis Braun 7bff6c1a1b feat(federation): outbound attach-proof verification + home-profile fetch helpers (re-attach spec §3.1) 2026-07-03 01:54:50 +02:00
Jannis Braun 093d5f3f26 docs(federation): document S2S verify-attach-proof endpoint (re-attach spec §3.1) 2026-07-03 01:49:27 +02:00
Jannis Braun af94f12389 feat(federation): S2S verify-attach-proof endpoint — single-use, peer-domain-bound, signed response (re-attach spec §3.1) 2026-07-03 01:49:20 +02:00
Jannis Braun 1c962ded12 feat(auth): attach-proof mint endpoint for detached-account re-attach (re-attach spec §3.1) 2026-07-03 01:41:08 +02:00
Jannis Braun 669d80d7c7 feat(federation): federation_attach_proofs table (re-attach spec §3.1) 2026-07-03 01:36:30 +02:00
Jannis Braun 70a68ebe1e docs(federation): sync relevance scoping, self-homed guard, deleted-snapshot flag, dead-incarnation sweep 2026-07-03 01:13:33 +02:00
Jannis Braun a0238eabc2 feat(federation): startup sweep removes dead-incarnation channels and self-homed stubs (dead-incarnation spec §3.4) 2026-07-03 01:05:26 +02:00
Jannis Braun 3591773a4c feat(federation): deleted flag on wire profile snapshots — tombstone markers never leave the instance (dead-incarnation spec §3.3) 2026-07-03 00:59:37 +02:00
Jannis Braun 5ffc7c565e feat(federation): sync endpoint scopes friend events to the requesting peer, pagination-safe (dead-incarnation spec §3.2) 2026-07-03 00:50:31 +02:00
Jannis Braun bd40058613 feat(federation): sync endpoint scopes DM channels to the requesting peer (dead-incarnation spec §3.2) 2026-07-03 00:42:02 +02:00
Jannis Braun 99c8361b75 feat(federation): receiver guard — never create replicated stubs homed at our own domain (dead-incarnation spec §3.1) 2026-07-03 00:37:27 +02:00
Jannis Braun 54ab660204 feat(federation): near-instant reset detection — probe epoch at the auth-failure transition + on worker startup
A reset peer reaches needs_attention via the auth-failure path (HMAC desynced by
the new incarnation) without passing through unreachable, so the 5s recovery
probe never saw it — detection waited up to a full 15-min health-check cycle
before 'Re-peer & heal' surfaced. Extract detectResetForPeer() and fire it
event-driven at the transition, plus a startup sweep for already-stuck peers.
15-min tick remains the backstop.
2026-07-02 20:10:35 +02:00
Jannis Braun 13d050c1bb fix(federation): close detached-account gaps from final review — presence/hydrate guards, ack re-detect clear, self-delete password (detach spec §4.3/§4.4/§4.6) 2026-07-02 19:34:32 +02:00
Jannis Braun 172398171a docs(systems): finish detach consolidation — federation.md §6.3b, database.md, stale comments (detach spec §8) 2026-07-02 19:15:24 +02:00
Jannis Braun 9e917d5117 feat(federation): account-settings notice for detached accounts (detach spec §4.7) 2026-07-02 19:10:35 +02:00
Jannis Braun 5ad8aefaff feat(federation): reset-cleanup panel — informational detach copy, real server-side Dismiss, Keep removed (detach spec §4.6) 2026-07-02 19:06:21 +02:00
Jannis Braun 42ad5e141d feat(federation): server-side acknowledge for reset events (acknowledged_at + admin endpoint) (detach spec §4.6) 2026-07-02 18:59:33 +02:00
Jannis Braun 7e1e32de69 feat(federation): detached accounts get local profile+password self-service; self-view flag (detach spec §4.4, §4.7) 2026-07-02 18:54:37 +02:00
Jannis Braun ea66ec5dbd test(federation): pin registration 409 + suffixed stub creation against detached accounts (detach spec §4.3.5)
Also add the positive companion assertion (folded in from a Task 3 review
Minor): findFederatedUser tier-2 STILL returns a NON-detached (orphaned=0)
same-name federated row, locking that the eq(federation_home_orphaned, 0)
clause discriminates on the flag alone and never over-filters legitimate
replicated identities.

All three behaviors pass against the shipped Task 1-3 code; no product-code
change was required.
2026-07-02 18:47:29 +02:00
Jannis Braun 68be2e26b1 feat(federation): S2S surfaces exclude detached accounts — tier-2, profile_update, identity delete (detach spec §4.3) 2026-07-02 18:39:54 +02:00
Jannis Braun d37919b5a0 feat(federation): reset heal detaches real accounts instead of freeze+rename (detach spec §4.2) 2026-07-02 18:33:47 +02:00
Jannis Braun 79c1138813 feat(federation): detached accounts keep local-password login; self-heal permanently disabled (detach spec §4.1) 2026-07-02 18:28:55 +02:00
Jannis Braun 1629f8fbe1 fix(dm): enforce read-only guard on DM reactions (WS) + harden purge/ownership tests
Finding 1: handleReactionAdd/Remove now drop reactions on a dead 1-on-1
(isDeadOneOnOne) — previously a survivor could react on a Deleted-User
thread and the relay fanned out to all peers via undefined target-origins.
Client Message.tsx withdraws add/toggle reaction affordances for dead DMs
(existing reactions still display read-only).

Finding 2: dmMembership purge test now runs with foreign_keys=ON (matches
prod) and asserts dm_members/dm_messages cascade cleanup on channel purge.

Finding 3: tombstone group-DM ownership transfer filters isDeleted=0 so
ownership can never move to a tombstoned member; covered by a new test.
2026-07-02 16:45:44 +02:00
Jannis Braun e4e83eb3fb docs(dm): document Deleted-User DM tombstone semantics + heal broadcast 2026-07-02 16:26:30 +02:00
Jannis Braun 3da18bc87c test(dm): cover zero-other and mixed-others branches of isDeletedPartnerDm 2026-07-02 16:22:44 +02:00
Jannis Braun ae07ae66e4 feat(dm): read-only composer notice for Deleted-User 1-on-1 threads (C2) 2026-07-02 16:20:38 +02:00
Jannis Braun 2a0574ee6c test(dm): lock Deleted-User name resolution + updateUserEverywhere DM patch (C1) 2026-07-02 16:02:44 +02:00
Jannis Braun a380927e72 test(dm): assert JOIN users guard drops orphan author in DM membership backfill (S5 review) 2026-07-02 16:00:19 +02:00
Jannis Braun 3470bb1914 fix(dm): idempotent backfill restores pre-existing broken Deleted-User 1-on-1 threads (S5) 2026-07-02 15:54:46 +02:00
Jannis Braun d03f8e4f77 fix(federation): heal path broadcasts user_updated so tombstoned-stub DMs update live (S4) 2026-07-02 15:50:08 +02:00