Skip to content

feat(deploy): support external Redis and Valkey installations - #674

Merged
pikann merged 1 commit into
Paca-AI:masterfrom
Yushu-Li:feat/external-valkey-478
Oct 31, 2026
Merged

pikann merged 1 commit into
Paca-AI:masterfrom
Yushu-Li:feat/external-valkey-478

Conversation

@Yushu-Li

Copy link
Copy Markdown
Contributor

Summary

Allow production installs to use an external Redis-compatible server for cache, pub/sub, and event streams without keeping the bundled Valkey container running. This implements the Redis/Valkey slice of #478; external gateway support and the rest of that request remain out of scope.

Refs #478.

Changes

  • install.sh offers bundled or external Redis/Valkey. A supplied REDIS_URL selects external by default; external URLs require a non-empty redis:// or rediss:// form. Connection strings are not printed by the installer. Single-quoted dotenv serialization preserves literal dollars and quotes in credentials.
  • Installation and upgrade infer --scale valkey=0 from the saved .env. Empty, quoted-empty, and absent values retain bundled Valkey. Keeping an existing .env respects that file, and both scripts remove a shell-only REDIS_URL input before invoking Compose so runtime routing agrees with persisted scaling.
  • Make the API, realtime, and agent-runner Valkey dependencies optional, matching the existing external-Postgres pattern. Their connection-variable wiring is unchanged.
  • Document external setup, container reachability, saved configuration precedence, and the fact that this does not migrate cache/stream data.
  • Add a standalone standard-library Python regression suite and a small job in the existing scripts CI workflow.

Validation

  • Before the fix, the external-URL regression fails against unmodified master: all three URL fixtures are lost from the generated .env.
  • python3 scripts/tests/test_external_valkey.py: 9 tests passed. Covers bundled defaults; plain/TLS URLs; literal dollar and quote preservation; no-start output; invalid input; retained configuration; repeated upgrades; existing unquoted URLs; and missing/blank/quoted-blank values.
  • Replayed all 20 existing install-smoke and upgrade-smoke shell steps locally, including their migration and scaling assertions, with release downloads served from checkout fixtures and container operations stubbed: passed.
  • bash -n, ShellCheck 0.11.0, actionlint 1.7.7 (including ShellCheck), Python Ruff checks/formatting, and git diff --check: passed.

These tests execute the actual installer/upgrader and real Docker Compose v2 configuration parsing, but stub image pulls, container startup, and release downloads. No live Redis service or full container stack was started; runtime connectivity, TLS handshakes, and existing-data migration are not claimed as verified. The frontend/application suites were not rerun for this deployment-only change.

Type of Change

  • Other: deployment feature

Checklist

  • The change is focused and scoped.
  • Related documentation is updated.
  • New structure or direction is explained clearly.
  • I avoided unnecessary detail or premature abstraction.

AI-assisted implementation; the stated checks were run locally.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • External Redis/Valkey installer path — install.sh adds a cache prompt, validates redis:///rediss:// input, single-quotes the dotenv value (escaping ' so $ and quotes in credentials survive), and derives --scale valkey=0 from the effective .env.
  • Upgrade inference — upgrade.sh reads REDIS_URL from .env (blank/''/"" → bundled) and re-applies --scale valkey=0, unsets any shell override so the saved file wins.
  • Compose dependency relaxation — required: false added to the valkey healthcheck dependency for all three dependents (api, realtime, agent-runner) so scaling valkey to 0 resolves cleanly.
  • Docs — external Redis setup, reachability, saved-config precedence, and no-data-migration caveat.
  • Tests/CI — new stdlib suite exercising the real scripts against real docker compose config, wired into a scripts-pr-ci job.

I ran the new suite locally against Compose v5.1.3 (no daemon): all 9 tests pass. I also confirmed every service that depends on valkey was patched (no missed dependent), and that single-quoted dotenv values with \' and literal $ round-trip through compose config correctly. Per the Compose spec, required: false only downgrades an absent dependency to a warning, so the bundled default still waits on Valkey health — no regression there.

One non-blocking note, consistent with the existing DATABASE_URL inference: an .env where REDIS_URL points at the bundled valkey (redis://valkey:6379/0) would make upgrade.sh scale Valkey to 0. That is only reachable by hand-editing .env (the installer writes it blank for bundled), so it is not worth a change here — just documenting the behavior.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pikann pikann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution! 🚀

@pikann
pikann merged commit b90ac98 into Paca-AI:master Oct 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] First-class support for installing against existing/external infrastructure (BYO Postgres, Valkey, object storage, reverse proxy)

2 participants