Skip to content

Commit 5288a0e

Browse files
committed
chore(redis): remove the remaining no-Redis paths across the app, realtime, setup and deploy config
1 parent 811dd52 commit 5288a0e

215 files changed

Lines changed: 1896 additions & 3900 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/rules/sim-testing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ contracts, and demonstrated regressions.
3434
| Suffix | Needs | Run with | In CI |
3535
|--------|-------|----------|-------|
3636
| `*.test.ts(x)` | nothing; global mocks from `vitest.setup.ts` | `bun run --cwd <workspace> test` | `test` jobs |
37-
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), Redis (`TEST_REDIS_URL`; optional locally, required in CI) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
37+
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), Redis (`TEST_REDIS_URL`, required) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
3838
| `*.live.test.ts` | provider APIs, hosted sandboxes, local runtimes, or sibling checkouts | `bun run --cwd apps/sim test --mode live <file>` | never |
3939
| `apps/desktop/e2e/*.spec.ts` | the packaged Electron app | Playwright | desktop E2E workflow |
4040
| `apps/sim/scripts/test-*-e2e.ts` | a running app over HTTP | its `package.json` script when one exists (`bun run test:scim:e2e`; `test:workflow-version-compare:e2e` adds `--no-env-file`), else `bun scripts/test-<suite>-e2e.ts` from apps/sim | `e2e` jobs (`.github/scripts/http-e2e.sh`) |

‎.cursor/rules/sim-testing.mdc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ contracts, and demonstrated regressions.
3131
| Suffix | Needs | Run with | In CI |
3232
|--------|-------|----------|-------|
3333
| `*.test.ts(x)` | nothing; global mocks from `vitest.setup.ts` | `bun run --cwd <workspace> test` | `test` jobs |
34-
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), Redis (`TEST_REDIS_URL`; optional locally, required in CI) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
34+
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), Redis (`TEST_REDIS_URL`, required) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
3535
| `*.live.test.ts` | provider APIs, hosted sandboxes, local runtimes, or sibling checkouts | `bun run --cwd apps/sim test --mode live <file>` | never |
3636
| `apps/desktop/e2e/*.spec.ts` | the packaged Electron app | Playwright | desktop E2E workflow |
3737
| `apps/sim/scripts/test-*-e2e.ts` | a running app over HTTP | its `package.json` script when one exists (`bun run test:scim:e2e`; `test:workflow-version-compare:e2e` adds `--no-env-file`), else `bun scripts/test-<suite>-e2e.ts` from apps/sim | `e2e` jobs (`.github/scripts/http-e2e.sh`) |

‎.github/scripts/http-e2e.sh‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#
66
# Usage: http-e2e.sh <scim|cli|stop-after|desktop-inbox|assistant-actions|organization-search|search-permissions|browser-extension|browser-extension-native|browser-extension-navigation|browser-extension-composer|browser-extension-access|project-files|markdown-viewer|workflow-code-ui|mobile|seo> (run from apps/sim)
77
#
8-
# The job provides DATABASE_URL, BETTER_AUTH_SECRET and ENCRYPTION_KEY; each group sets the rest of
8+
# The job provides DATABASE_URL, BETTER_AUTH_SECRET, ENCRYPTION_KEY and a Redis on 127.0.0.1:6379
9+
# (Redis is required, so every app and realtime server gets REDIS_URL); each group sets the rest of
910
# its app's environment here. Reports and server logs land in $RUNNER_TEMP/e2e.
1011
#
1112
# Under `next dev` the first request cold-compiles the app under Turbopack, which takes 60-185s on
@@ -23,6 +24,7 @@ set -euo pipefail
2324
group=${1:?usage: http-e2e.sh <scim|cli|stop-after|desktop-inbox|assistant-actions|organization-search|search-permissions|browser-extension|browser-extension-native|browser-extension-navigation|browser-extension-composer|browser-extension-access|project-files|markdown-viewer|workflow-code-ui|mobile|seo>}
2425
report_dir="$RUNNER_TEMP/e2e"
2526
ready_timeout_seconds=600
27+
export REDIS_URL=${REDIS_URL:-redis://127.0.0.1:6379}
2628
mkdir -p "$report_dir"
2729

2830
server_pid=''
@@ -204,6 +206,7 @@ case "$group" in
204206
export PEOPLE_E2E_SCREENSHOT_DIR="$report_dir/people-ui-report.json.artifacts"
205207
SCIM_E2E_BASE_URL="$local_app_url" \
206208
SCIM_E2E_DATABASE_URL="$DATABASE_URL" \
209+
SCIM_E2E_REDIS_URL="$REDIS_URL" \
207210
SCIM_E2E_AUTH_SECRET="$BETTER_AUTH_SECRET" \
208211
SCIM_E2E_REPORT_PATH="$report_dir/scim-e2e-report.json" \
209212
bun run test:scim:e2e
@@ -238,8 +241,7 @@ case "$group" in
238241
;;
239242

240243
# The search suites serve their own fixtures in-process and need no app. They share this group
241-
# because they finish in seconds. Self-hosted without billing: hosted billing admits runs through
242-
# Redis, which the CLI app is not given.
244+
# because they finish in seconds. Self-hosted, so runs are not admitted through hosted billing.
243245
cli)
244246
for search in google-content lucid zoom google-meet; do
245247
report_var="SEARCH_$(echo "$search" | tr 'a-z-' 'A-Z_')_REPORT_PATH"
@@ -262,7 +264,7 @@ case "$group" in
262264
bun run test:cli-run-latency:e2e
263265
;;
264266

265-
# Self-hosted: hosted billing admits a run only through a Redis usage reservation.
267+
# Self-hosted, so runs are not admitted through hosted billing's usage reservation.
266268
stop-after)
267269
export NEXT_PUBLIC_FORCE_HOSTED=false
268270
export CRON_SECRET=stop-after-e2e-local-cron-secret
@@ -278,7 +280,6 @@ case "$group" in
278280
;;
279281

280282
desktop-inbox|assistant-actions|organization-search|search-permissions)
281-
export REDIS_URL=redis://127.0.0.1:6379
282283
export NEXT_PUBLIC_FORCE_HOSTED=false
283284
export COPILOT_TOOL_PERMISSIONS_ENABLED=true
284285
export KNOWLEDGE_MEMBER_ACCESS=true CREDENTIAL_GROUPS=true ACCESS_CONTROL_ENABLED=true
@@ -331,7 +332,6 @@ case "$group" in
331332
browser-extension-composer) extension_group=composer ;;
332333
browser-extension-access) extension_group=access ;;
333334
esac
334-
export REDIS_URL=redis://127.0.0.1:6379
335335
export NEXT_PUBLIC_FORCE_HOSTED=false
336336
export KNOWLEDGE_MEMBER_ACCESS=true CREDENTIAL_GROUPS=true ACCESS_CONTROL_ENABLED=true
337337
export SIM_LINKS=true
@@ -360,7 +360,7 @@ JS
360360

361361
project-files)
362362
PROJECT_FILES_E2E_ADMIN_DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/postgres \
363-
PROJECT_FILES_E2E_REDIS_URL=redis://127.0.0.1:6379 \
363+
PROJECT_FILES_E2E_REDIS_URL="$REDIS_URL" \
364364
PROJECT_FILES_E2E_BASE_URL=http://127.0.0.1:3050 \
365365
PROJECT_FILES_E2E_RELAY_URL=http://127.0.0.1:3052 \
366366
PROJECT_FILES_E2E_REPORT_PATH="$report_dir/project-files/orchestration.json" \

‎.github/workflows/checks.yml‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ jobs:
236236
--health-interval 5s
237237
--health-timeout 5s
238238
--health-retries 10
239-
# Desktop inbox, browser extension, and Project Files use Redis.
239+
# Redis is required: every app server the suites start connects to it.
240240
redis:
241-
image: ${{ (matrix.group == 'desktop-inbox' || matrix.group == 'assistant-actions' || matrix.group == 'organization-search' || matrix.group == 'search-permissions' || startsWith(matrix.group, 'browser-extension-') || matrix.group == 'project-files') && 'redis:8.2-alpine' || '' }}
241+
image: redis:8.2-alpine
242242
ports:
243243
- 6379:6379
244244
options: >-
@@ -408,6 +408,16 @@ jobs:
408408
--health-interval 5s
409409
--health-timeout 5s
410410
--health-retries 10
411+
# Redis is required: the app server refuses to start without it.
412+
redis:
413+
image: redis:8.2-alpine
414+
ports:
415+
- 6379:6379
416+
options: >-
417+
--health-cmd "redis-cli ping"
418+
--health-interval 5s
419+
--health-timeout 5s
420+
--health-retries 10
411421
env:
412422
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_test
413423
BETTER_AUTH_SECRET: http-e2e-ci-secret-at-least-32-characters

‎.github/workflows/docs-negotiation.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,17 @@ jobs:
334334
--health-interval 5s
335335
--health-timeout 5s
336336
--health-retries 10
337+
# The platform consumer runs the app's docs search in-process, and its provider admission
338+
# needs Redis.
339+
search-redis:
340+
image: ${{ (matrix.group == 'http' || matrix.group == 'platform') && 'redis:8.2-alpine' || '' }}
341+
ports:
342+
- 6379:6379
343+
options: >-
344+
--health-cmd "redis-cli ping"
345+
--health-interval 5s
346+
--health-timeout 5s
347+
--health-retries 10
337348
env:
338349
DATABASE_URL: postgresql://docs_test:docs_test@127.0.0.1:1/docs_test
339350
DOCS_E2E_BASE_URL: http://127.0.0.1:3001
@@ -348,6 +359,7 @@ jobs:
348359
DOCS_SAMPLES_SYNTAX_LANGUAGES: javascript,python,bash,go,java,csharp
349360
DOCS_SAMPLES_HTTP_BASE_URL: http://127.0.0.1:3001
350361
DOCS_PROVIDER_E2E_DATABASE_URL: postgresql://docs_test:docs_test@127.0.0.1:5432/docs_search_test
362+
DOCS_PROVIDER_E2E_REDIS_URL: redis://127.0.0.1:6379
351363
DOCS_PROVIDER_E2E_BASE_URL: http://127.0.0.1:3001
352364
DOCS_PROVIDER_E2E_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/platform-consumer/report.json
353365
steps:

‎README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ npx sim-setup add email
112112
npx sim-setup add storage
113113
npx sim-setup add sandbox
114114
npx sim-setup add jobs
115-
npx sim-setup add cache
116115
npx sim-setup add knowledge
117116
npx sim-setup add chat
118117
npx sim-setup add llm

‎apps/docs/MACHINE_ACCESS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The suite exercises real HTTP and the official MCP client, including discovery p
7979

8080
The PostgreSQL suite uses a new, empty, loopback database and no embedding key. It verifies real keyword search, citation freshness, graceful database failure, repeated index publication, retirement and failed-publication preservation. It refuses databases containing existing tables. CI provisions its own `pgvector/pgvector:pg17` service and uploads the report with the other docs checks.
8181

82-
The platform consumer harness also uses an empty loopback database and the running docs build. From `apps/sim`, run `bun --no-env-file scripts/test-docs-search-provider-e2e.ts` with `DOCS_PROVIDER_E2E_DATABASE_URL`, `DOCS_PROVIDER_E2E_BASE_URL` and `DOCS_PROVIDER_E2E_REPORT_PATH`. Its default mode uses the existing Azure endpoint configuration with a local HTTP fixture, deterministic vectors and the real PostgreSQL provider-admission store. It verifies the platform's direct-table search, scope exclusions, VFS reads and public citations, with no paid requests. This verifies the transport and consumer contract, not semantic relevance.
82+
The platform consumer harness also uses an empty loopback database and the running docs build. From `apps/sim`, run `bun --no-env-file scripts/test-docs-search-provider-e2e.ts` with `DOCS_PROVIDER_E2E_DATABASE_URL`, `DOCS_PROVIDER_E2E_REDIS_URL` (a loopback Redis), `DOCS_PROVIDER_E2E_BASE_URL` and `DOCS_PROVIDER_E2E_REPORT_PATH`. Its default mode uses the existing Azure endpoint configuration with a local HTTP fixture, deterministic vectors and the real Redis provider-admission store. It verifies the platform's direct-table search, scope exclusions, VFS reads and public citations, with no paid requests. This verifies the transport and consumer contract, not semantic relevance.
8383

8484
Live provider verification is opt-in: set `DOCS_PROVIDER_E2E_ALLOW_LIVE=1` and supply `OPENAI_API_KEY`, using a fresh database named `docs_search_provider_test`. The harness limits publication to the introduction page, rejects plans above 15 chunks, and sends at most one batch with up to three attempts. The consumer makes at most one query embedding request, for a total cap of four provider requests. Provider failure stops the run and remains a failed report. The default fixture mode also accepts the empty `docs_search_test` database used by the PostgreSQL suite. Both modes remove their tables when finished.
8585

‎apps/docs/content/docs/platform/self-hosting/architecture.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Sim runs an app, a realtime server, PostgreSQL, Redis, and a scheduler. This pag
1515
| **realtime** | `ghcr.io/simstudioai/realtime` | 3002 | In-flight collaboration state | Yes |
1616
| **migrations** | `ghcr.io/simstudioai/migrations` | — | One-shot schema and data migrations | Yes |
1717
| **postgresql** | `pgvector/pgvector:pg17` | 5432 | Durable application data | Yes |
18-
| **redis** | `redis:7-alpine` | 6379 | Cache, coordination, and live events | Bundled by default; required across replicas |
18+
| **redis** | `redis:7-alpine` | 6379 | Rate limits, coordination, and live events | Yes (bundled by default) |
1919
| **cron** | `ghcr.io/simstudioai/cron` (Compose) / `curlimages/curl` (Kubernetes) | — | None | Required for scheduled work |
2020
| **pii** | `ghcr.io/simstudioai/pii` | 5001 | None | Optional |
2121
| **ollama** | `ollama/ollama` | 11434 | Model cache | Optional |
@@ -36,7 +36,7 @@ The Bun Socket.IO server carries collaborative editing, live execution updates,
3636
Realtime shares PostgreSQL and `BETTER_AUTH_SECRET` with the app, using Better Auth's shared-database-session pattern. It authenticates the same accounts without a separate login.
3737

3838
<Callout type="warn">
39-
More than one realtime replica requires `REDIS_URL`. The Socket.IO Redis adapter carries events between replicas; without it, members connected to different pods do not see each other's edits.
39+
Realtime requires `REDIS_URL`, pointing at the same Redis as the app. The Socket.IO Redis adapter carries events between replicas, so members connected to different pods see each other's edits.
4040
</Callout>
4141

4242
A realtime server must exist for editing and live updates. Set `realtime.enabled: false` in Helm only when `app.env.SOCKET_SERVER_URL` points to a realtime instance you run separately.
@@ -55,7 +55,7 @@ PostgreSQL holds workflows, runs, logs, accounts, organizations, credentials, kn
5555

5656
### Redis
5757

58-
Redis carries live events and stores shared coordination state. Some stores fall back to PostgreSQL or process-local state, but cross-pod collaboration has no local fallback. CLI API-key pairing also requires Redis, even with one replica; OAuth login uses a separate path. See [Redis](/platform/self-hosting/redis) for the full fallback matrix.
58+
Redis is required, even with one replica. It holds rate-limit buckets, one-time passcodes, and shared coordination state, and carries live events between processes. There is no PostgreSQL or process-local fallback, and the app refuses to start without `REDIS_URL`. See [Redis](/platform/self-hosting/redis) for everything it backs.
5959

6060
### Scheduler
6161

‎apps/docs/content/docs/platform/self-hosting/docker.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ curl -fsS http://localhost:3000/api/health
8989
| `simstudio` | 3000 | App; 8G memory limit. |
9090
| `realtime` | 3002 | WebSocket service; 1G memory limit. |
9191
| `db` | Not published | PostgreSQL 17 with pgvector. |
92-
| `redis` | Not published | Shared coordination, pub/sub, and caches. |
92+
| `redis` | Not published | Required. Rate limits, shared coordination, pub/sub, and caches. |
9393
| `cron` | None | Calls background job endpoints. |
9494
| `migrations` | None | Applies migrations once, then exits. |
9595

@@ -203,14 +203,14 @@ Invoke commands as `bunx sim-setup <command>` unless the package is installed gl
203203
| `reset` | Confirms before archiving env files and removing managed Compose/dev data. On Helm it uninstalls the release; PostgreSQL StatefulSet PVCs remain and must be deleted separately to erase data. |
204204
| `config` | Reports configured capabilities and integrations. |
205205
| `doctor` | Checks env files and reachable services. `--fix` writes supported repairs; `--json` emits structured findings. |
206-
| `add <feature>` | Configures `email`, `storage`, `sandbox`, `jobs`, `cache`, `knowledge`, `knowledge-embeddings`, `chat`, `llm`, or `integration <slug>`. Requires one writable configuration; refuses ambiguous destinations and Helm releases. |
206+
| `add <feature>` | Configures `email`, `storage`, `sandbox`, `jobs`, `knowledge`, `knowledge-embeddings`, `chat`, `llm`, or `integration <slug>`. Requires one writable configuration; refuses ambiguous destinations and Helm releases. |
207207
| `desktop` | Prints this deployment's installer/server links. `--url <url>` skips discovery; `--no-open` skips the browser-opening prompt. |
208208

209209
`--dir <path>` works with every command and scopes standalone lifecycle commands to that installation.
210210

211211
For Compose, `reset` archives `.env` beside the Compose file. For dev, Kubernetes, or no detected install, it archives `apps/sim/.env`, `apps/realtime/.env`, `packages/db/.env`, and root `.env`. Preserve any backups before intentionally removing volumes.
212212

213-
`add` writes beside the Compose file or to `apps/sim/.env` on a source checkout. Recreate containers that read the change: `cache` changes `REDIS_URL` for both app and realtime. For a source checkout, mirror shared values into `apps/realtime/.env`. `restart` alone does not apply changed container environment. Desktop discovery refuses configurations naming different origins; pass `--url` to choose.
213+
`add` writes beside the Compose file or to `apps/sim/.env` on a source checkout. Recreate containers that read the change. To point both app and realtime at a different Redis, set `REDIS_URL` in `.env` and recreate both containers. For a source checkout, mirror shared values into `apps/realtime/.env`. `restart` alone does not apply changed container environment. Desktop discovery refuses configurations naming different origins; pass `--url` to choose.
214214

215215
## Back up and update [#commands]
216216

‎apps/docs/content/docs/platform/self-hosting/environment-variables.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Production Compose derives `DATABASE_URL` and `BETTER_AUTH_URL` on its service d
1919
| `ENCRYPTION_KEY` | Encryption key, exactly 64 hex characters (32 bytes): `openssl rand -hex 32`. A key in any other format leaves [account token sealing](/platform/self-hosting/security#account-token-sealing) off |
2020
| `INTERNAL_API_SECRET` | Internal API secret, at least 32 characters: `openssl rand -hex 32` |
2121
| `NEXT_PUBLIC_APP_URL` | Public app URL |
22+
| `REDIS_URL` | Redis connection string (`redis://` or `rediss://`), shared by the app and realtime services. The app refuses to start without it; there is no PostgreSQL or in-memory fallback. See [Redis](/platform/self-hosting/redis) |
2223

2324
`openssl rand -hex 32` prints 64 hex characters. Encryption keys require that format. The app skips its env schema validation; individual consumers can reject invalid values when first used. Realtime validates `BETTER_AUTH_SECRET` and `INTERNAL_API_SECRET` at boot and rejects values shorter than 32 characters.
2425

@@ -32,8 +33,7 @@ Production Compose derives `DATABASE_URL` and `BETTER_AUTH_URL` on its service d
3233
|----------|-------------|
3334
| `API_ENCRYPTION_KEY` | Encrypts stored Sim API-key material; use exactly 64 hex characters (`openssl rand -hex 32`). When unset, legacy API keys can be stored in plain text; the key getter logs a warning when called |
3435
| `CRON_SECRET` | Bearer token for the background job endpoints: `openssl rand -hex 32`. **Required whenever background jobs are enabled** — the Helm chart's default, and the chart will not render without it, unless it comes from `app.secrets.existingSecret` or External Secrets. See [Background jobs](/platform/self-hosting/background-jobs) |
35-
| `REDIS_URL` | Redis connection string. Required for cross-replica events and features with no fallback, such as CLI pairing approval. Some single-process storage paths can fall back to PostgreSQL or local state; see [Redis](/platform/self-hosting/redis) |
36-
| `REDIS_TLS_SERVERNAME` | TLS SNI override. Required when `REDIS_URL` uses `rediss://` with a bare IP, or the app throws the first time it opens a Redis connection |
36+
| `REDIS_TLS_SERVERNAME` | TLS SNI override. Required when `REDIS_URL` uses `rediss://` with a bare IP, or the app refuses to start |
3737
| `NEXT_PUBLIC_SOCKET_URL` | Public WebSocket URL. Proxied deployments default to the page origin; a localhost page uses port 3002. Set it for a separate realtime host. |
3838
| `TRUSTED_ORIGINS` | Comma-separated additional origins to trust for auth (apex + `www`, alias domains) |
3939
| `AUTH_TRUSTED_PROXIES` | Comma-separated reverse-proxy IPs/CIDRs so the client IP cannot be forged through `X-Forwarded-For` |
@@ -340,7 +340,7 @@ INTERNAL_API_SECRET=<openssl rand -hex 32>
340340
API_ENCRYPTION_KEY=<openssl rand -hex 32>
341341
CRON_SECRET=<openssl rand -hex 32>
342342

343-
# Coordination (required past one replica)
343+
# Redis (required)
344344
REDIS_URL=redis://redis:6379
345345

346346
# Models — OPENAI_API_KEY also powers knowledge base embeddings

0 commit comments

Comments
 (0)