7 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 215750cb7a fix(install): harden prereq/DNS paths against set -euo pipefail aborts
Found by running the previously-untested Docker-not-installed path in a
clean, no-dig container:

- resolve the current user with $(id -un), not $USER: under `set -u`
  an unset $USER aborted the script with 'USER: unbound variable' right
  after Docker was installed ($USER is not guaranteed set under sudo,
  `su` without -l, cron, or docker exec)
- make the Docker-install prompt EOF-safe (read ... || yn="") so a
  non-interactive / piped stdin falls through to the [Y/n] default
  instead of tripping `set -e`
- swallow getent's exit-2 on an unresolved domain (... || true): with
  `set -o pipefail` it aborted the DNS check before the graceful
  'Could not resolve' warning, breaking installs on minimal hosts (no
  dig) that run before DNS is pointed — an explicitly supported flow
- guard the LAN-IP and disk-space pipelines the same way so a no-match
  grep / missing `ip` can't abort the summary or prereq checks
2026-07-01 18:35:20 +02:00
Jannis Braun 20ba7b42f9 feat(install): production-hardening for public self-hosting
- inject the git commit at build time so /api/instance/info advertises
  the exact source version on the public clone->install.sh path (AGPL
  \xc2\xa713), passed as --build-arg so it survives the sudo/non-sudo split
- pass INSTANCE_NAME through the container env instead of interpolating
  it into node -e source; names with quotes/spaces/$ are stored verbatim
  and can't break or inject into the program
- add a post-install, NAT-hairpin-safe HTTPS reachability check (curl
  --resolve to the local Caddy with full cert verification) and report
  an honest 'Live' vs 'Not live yet' status instead of always claiming
  success
- list ALL required ports in the summary (80/443 + voice) with explicit
  host-firewall vs router port-forwarding guidance and the auto-detected
  LAN IP as the forward target; note 7880 must NOT be forwarded
- document the non-interactive env vars (DOMAIN/ENABLE_VOICE/INSTANCE_NAME)
2026-07-01 18:14:38 +02:00
Jannis Braun c0a6477059 fix(install): post-install message reflects first-user-becomes-admin (no seeded admin/admin123) 2026-06-20 03:14:16 +02:00
Jannis Braun 9ae9a0f3dc fix: prevent install.sh crash when .env exists without expected keys
The env_val() function uses grep which returns exit code 1 when no
match is found. Under set -euo pipefail, this kills the script.
Adding || true prevents this on upgrade installs with older .env files.
2026-03-03 23:32:28 +01:00
Jannis Braun fd175023c1 fix: use correct working directory for pnpm module resolution in install.sh
The node -e command to set instance name needs to run from
/app/packages/server where pnpm's symlinked node_modules resolve
better-sqlite3, not from /app root.
2026-03-03 19:57:32 +01:00
Jannis Braun 617999500b feat: all-in-one production deployment with install script
Redesign deployment as a single docker-compose with Backspace, Caddy
(auto-HTTPS), and LiveKit (voice/video) using hybrid networking:
Backspace+Caddy on isolated bridge, LiveKit on host mode for WebRTC.

- Add install.sh: interactive installer that handles Docker setup,
  domain/DNS verification, secret generation, LiveKit config, and
  deployment with health-check wait
- Add Caddyfile: static reverse proxy config using Caddy env vars,
  routes /livekit/* to host-mode LiveKit via host.docker.internal
- Rewrite docker-compose.yml: all-in-one with profiles (voice),
  no external volumes/networks, bind mount ./data for visibility
- Fix livekit.ts: use LIVEKIT_URL env var directly instead of
  Host-header derivation that made the env var dead code
- Fix Dockerfile: health check reads $PORT dynamically
- Update .env.example: add DOMAIN, COMPOSE_PROFILES documentation
- Update .gitignore: add livekit.yaml (contains secrets)
2026-03-03 19:51:51 +01:00