Skip to content

Commit d0285ea

Browse files
committed
fix(self-hosting): durable uploads, compose overlays, and setup fixes for Docker Compose
1 parent 1cad183 commit d0285ea

34 files changed

Lines changed: 918 additions & 152 deletions

‎apps/docs/content/docs/platform/enterprise/self-hosted.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Set the server flag, then restart the application:
1919
ENTERPRISE_ENABLED=true
2020
```
2121

22-
The server flag controls access and everything the browser shows, including SSO on the login page and the Function block's **Sandbox** selector: the browser reads the server's resolved settings, so there is no `NEXT_PUBLIC_` variable to set. Browser variables left over from older releases do nothing; on a Compose install or source checkout, `bunx sim-setup doctor` reports them. See [Verify your install](/platform/self-hosting/verify).
22+
The server flag controls access and everything the browser shows, including SSO on the login page and the Function block's **Sandbox** selector: the browser reads the server's resolved settings, so there is no `NEXT_PUBLIC_` variable to set. Browser variables left over from older releases do nothing; on a Compose install or source checkout, `npx sim-setup doctor` reports them. See [Verify your install](/platform/self-hosting/verify).
2323

2424
Individual flags override the master switch. For example, to enable the suite with data drains disabled:
2525

@@ -268,7 +268,7 @@ JavaScript without `import`, `require`, a selected sandbox, or a sandbox file-pa
268268
| Symptom | Check |
269269
| --- | --- |
270270
| A settings section is missing | Check its server flag and restart the app after changing environment variables. These values load at boot; a rebuild is not needed. |
271-
| The login page has no SSO option, or Function has no Sandbox selector | Check `SSO_ENABLED` (or `ENTERPRISE_ENABLED`) and Sandbox readiness, then restart the app. Run `bunx sim-setup doctor` to check Sandbox readiness. |
271+
| The login page has no SSO option, or Function has no Sandbox selector | Check `SSO_ENABLED` (or `ENTERPRISE_ENABLED`) and Sandbox readiness, then restart the app. Run `npx sim-setup doctor` to check Sandbox readiness. |
272272
| **Settings → Sandboxes** shows an upgrade notice | Check Sandbox entitlement, provider credentials, and the immutable Function base. |
273273
| An enabled feature has no effect in a workspace | Confirm that the workspace belongs to an organization. Use the backfill or workspace move procedure if needed. |
274274
| Retention deletes nothing | Check `DATA_RETENTION_ENABLED`, explicit windows, scheduler requests, and `CRON_SECRET`. |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The chart can also render the optional `copilot` service, its separate PostgreSQ
7474
| **Secrets** | `ENCRYPTION_KEY`, `API_ENCRYPTION_KEY`, `BETTER_AUTH_SECRET`, `INTERNAL_API_SECRET`, `CRON_SECRET` | Secret manager and separate recovery copies |
7575

7676
<Callout type="error">
77-
Neither the production Compose file nor the Helm chart mounts a volume for local uploads. Without configured cloud storage or your own volume, recreating the app container loses those files. Local files are also invisible to other replicas. Configure [object storage](/platform/self-hosting/object-storage) before storing durable files or scaling.
77+
The production Compose file keeps local uploads in the `sim_uploads` volume on its host; the Helm chart mounts no volume for them, so without cloud storage or your own volume, recreating an app pod loses those files. Local files are also invisible to other replicas. Configure [object storage](/platform/self-hosting/object-storage) before storing durable files or scaling.
7878
</Callout>
7979

8080
<Callout type="error">

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ Install the official Sim desktop app and connect it to your deployment. You do n
3030
From your installation directory:
3131

3232
```bash
33-
bunx sim-setup desktop
33+
npx sim-setup desktop
3434
```
3535

3636
The command reads Compose/Helm configuration, resolves the installer, and prints the download link and server URL. It offers to open the installer in your browser. Use `--no-open` to skip that prompt, or supply the public origin directly:
3737

3838
```bash
39-
bunx sim-setup desktop --url https://sim.example.com --no-open
39+
npx sim-setup desktop --url https://sim.example.com --no-open
4040
```
4141

4242
`--url` skips discovery. Without the CLI, open `https://<your-sim-origin>/api/desktop/update/download` in a browser.

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

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ Use the production Compose stack for a single-node installation. It starts the a
1111

1212
- Docker Engine or Docker Desktop, running.
1313
- Docker Compose 2.24.0 or later. The file uses optional `env_file` entries introduced in that version.
14-
- Bun for `bunx`, and Node.js 20 or later for the published `sim-setup` executable.
14+
- Node.js 20 or later, which provides `npx` for the `sim-setup` CLI.
1515
- Available host ports 3000 and 3002, with enough resources for your workload. See [resource examples](/platform/self-hosting#requirements).
1616
- A public domain and TLS proxy for remote access.
1717

1818
## Quick start
1919

2020
```bash
21-
bunx sim-setup
21+
npx sim-setup
2222
```
2323

24-
The wizard creates `./sim` with a generated `.env` and production Compose file, then starts published container images. Pass `--dir <path>` for another directory. Open [http://localhost:3000](http://localhost:3000).
24+
The wizard creates `./sim` with a generated `.env` and production Compose file, then starts published container images. Pass `--dir <path>` for another directory, and `--url https://sim.yourdomain.com` to set the public URL (Custom setup also asks for it). Open [http://localhost:3000](http://localhost:3000), or your public URL. `bunx sim-setup` works too if you use Bun.
2525

2626
For a manual installation, obtain the Compose file from a source checkout:
2727

@@ -69,11 +69,20 @@ Set `CRON_SECRET` for scheduled work. Without it, the cron service prints instru
6969

7070
### 2. Configure durable uploads
7171

72-
<Callout type="warn">
73-
The production Compose file persists PostgreSQL but does not mount `/app/apps/sim/uploads`. Recreating the app container loses uploads stored there. Configure object storage or a persistent mount before saving files you need to retain.
74-
</Callout>
72+
Without object storage, the app stores uploads in `/app/apps/sim/uploads`. The production Compose file mounts the `sim_uploads` volume there, so files survive container recreation and updates. The volume is still local to this host: it is not shared across hosts or app replicas, and it needs its own backup. A one-shot `uploads-init` service makes the volume writable by the app user before the app starts.
73+
74+
Follow [Object storage](/platform/self-hosting/object-storage) for AWS S3, Azure Blob, or Google Cloud Storage.
75+
76+
#### Existing installs: keep uploads from before the volume
7577

76-
Follow [Object storage](/platform/self-hosting/object-storage) for AWS S3, Azure Blob, Google Cloud Storage, or local-volume configuration. Local disk is not shared across app replicas.
78+
Compose files from before `sim_uploads` stored local uploads inside the app container, and recreating it discards them. Copy them out before you switch to the new Compose file or run `npx sim-setup update`, then copy them into the volume:
79+
80+
```bash
81+
docker compose -f docker-compose.prod.yml cp simstudio:/app/apps/sim/uploads ./uploads-backup
82+
# switch to the new docker-compose.prod.yml (or run npx sim-setup update), then:
83+
docker compose -f docker-compose.prod.yml cp ./uploads-backup/. simstudio:/app/apps/sim/uploads
84+
docker compose -f docker-compose.prod.yml exec -u 0 simstudio chown -R nextjs:nodejs /app/apps/sim/uploads
85+
```
7786

7887
### 3. Start and verify services
7988

@@ -92,8 +101,9 @@ curl -fsS http://localhost:3000/api/health
92101
| `redis` | Not published | Required. Rate limits, shared coordination, pub/sub, and caches. |
93102
| `cron` | None | Calls background job endpoints. |
94103
| `migrations` | None | Applies migrations once, then exits. |
104+
| `uploads-init` | None | Hands the uploads volume to the app user once, then exits. |
95105

96-
Expect five services running and `migrations` exited successfully. The migrator has no healthcheck because it is a one-shot job.
106+
Expect five services running, and `migrations` and `uploads-init` exited successfully. The migrator has no healthcheck because it is a one-shot job.
97107

98108
```bash
99109
docker compose -f docker-compose.prod.yml logs -f cron
@@ -123,6 +133,8 @@ sim.yourdomain.com {
123133

124134
Route `/socket.io` to realtime on 3002 and other requests to the app on 3000. The 250 MB decimal Caddy limit clears the configured 220 MiB deployed-chat cap, but the app's current Next.js proxy buffer still limits matching requests to 10 MiB. See [Request size limits](/platform/self-hosting/networking#request-size-limits) before increasing payload sizes. `flush_interval -1` explicitly disables response buffering; Caddy already flushes SSE immediately. It also keeps the upstream request running if the client disconnects. See [Caddy streaming behavior](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#streaming).
125135

136+
When the proxy runs on the same host, set `SIM_APP_PUBLISH=127.0.0.1:3000` and `SIM_REALTIME_PUBLISH=127.0.0.1:3002` in `.env` so the app and realtime are reachable only through it. Change only the bind address, not the ports: `sim-setup` checks the app on 3000 and realtime on 3002.
137+
126138
This example assumes Caddy runs on the Docker host. A containerized proxy needs reachable Compose service addresses instead of its own `localhost`. For Nginx, Traefik, cloud load balancers, or separate socket hosts, see [Networking](/platform/self-hosting/networking).
127139

128140
## Ollama
@@ -225,11 +237,11 @@ docker compose -f "$COMPOSE_FILE" up -d --force-recreate simstudio
225237

226238
## The `sim-setup` CLI
227239

228-
Invoke commands as `bunx sim-setup <command>` unless the package is installed globally. Run `doctor`, `config`, and the wizard from the configuration directory. Lifecycle commands discover running production/local Compose stacks, source checkouts, and Helm releases. A stack started with the Ollama overlay is managed as a production install, through `docker-compose.prod.yml` alone: the CLI acts on the Sim services and leaves the Ollama container untouched.
240+
Invoke commands as `npx sim-setup <command>` unless the package is installed globally. Run `doctor`, `config`, and the wizard from the configuration directory. Lifecycle commands discover running production/local Compose stacks, source checkouts, and Helm releases. Compose commands apply every file the stack was started with, such as the Ollama overlay. For a stopped stack they use `COMPOSE_FILE` from its `.env`, else `docker-compose.prod.yml` plus `docker-compose.override.yml` when that file exists. `update` prints the files it applies. Compose does not record profiles, so set `COMPOSE_PROFILES` in `.env` (for example `COMPOSE_PROFILES=cpu`) for a stack that uses them.
229241

230242
| Command | Behavior |
231243
| --- | --- |
232-
| `sim-setup` | Wizard. `--quick` uses defaults and asks essential questions; `--mode compose\|dev\|k8s` chooses the target. Dev and Kubernetes modes require a source checkout. |
244+
| `sim-setup` | Wizard. `--quick` uses defaults and asks essential questions; `--mode compose\|dev\|k8s` chooses the target; `--url <origin>` sets a Compose install's public URL. Dev and Kubernetes modes require a source checkout. |
233245
| `status` | Reports detected installations and health. |
234246
| `logs` | Follows Compose logs or the Kubernetes app deployment. In dev mode, prints container log commands; the app runs in your terminal. |
235247
| `start` / `stop` / `restart` | Starts, stops, or restarts Compose services. In dev mode, manages only PostgreSQL and Redis; start/stop the dev server yourself. For Kubernetes, prints port-forward or scale commands without applying them. |
@@ -261,12 +273,12 @@ Restore only to the intended database:
261273
docker compose -f docker-compose.prod.yml exec -T db psql -U postgres simstudio < backup.sql
262274
```
263275

264-
Use your configured role/database if you changed `POSTGRES_*`. `-T` disables TTY allocation for redirected input/output. Compose stores database data in the `postgres_data` volume; file uploads and encryption keys need separate backups.
276+
Use your configured role/database if you changed `POSTGRES_*`. `-T` disables TTY allocation for redirected input/output. Compose stores database data in the `postgres_data` volume and local uploads in the `sim_uploads` volume; back up uploads and encryption keys separately.
265277

266278
For an image update, change the pinned `SIM_VERSION` in `.env`, then:
267279

268280
```bash
269-
bunx sim-setup update
281+
npx sim-setup update
270282
```
271283

272284
Read [Upgrades](/platform/self-hosting/upgrades) before updating or restoring an existing installation.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ For hosted models, Sim checks catalog-supported widths and falls back to the mod
146146
| `1536` | `text-embedding-3-small`, `text-embedding-3-large`, `gemini-embedding-001` |
147147
| `3072` | `text-embedding-3-large`, `gemini-embedding-001` |
148148

149-
For Compose or a source checkout, run `bunx sim-setup add knowledge-embeddings` to choose OpenAI, Azure OpenAI, OpenRouter, Gemini, or Ollama and write its configuration. The three OpenAI-family transports share model/width choices. `bunx sim-setup config` reports the family selected by `KB_EMBEDDING_MODEL`. For Helm, set the variables through chart values or your secret strategy. Run Ollama yourself; the setup command configures a connection, not an Ollama installation.
149+
For Compose or a source checkout, run `npx sim-setup add knowledge-embeddings` to choose OpenAI, Azure OpenAI, OpenRouter, Gemini, or Ollama and write its configuration. The three OpenAI-family transports share model/width choices. `npx sim-setup config` reports the family selected by `KB_EMBEDDING_MODEL`. For Helm, set the variables through chart values or your secret strategy. Run Ollama yourself; the setup command configures a connection, not an Ollama installation.
150150

151151
The Embeddings block reads the same `OLLAMA_URL`. It lists the models on that server that report an
152152
embedding capability, with the width each one emits where Ollama reports it, so a workflow can embed
@@ -214,7 +214,7 @@ Plain JavaScript without imports runs in isolated-vm within Node child workers i
214214
| `COPILOT_API_KEY` | API key for the Chat service (the Mothership). Required for Chat, the Sim Chat workflow block, and Inbox operations that use that service. See [Chat service](/platform/self-hosting/chat) |
215215
| `SIM_AGENT_API_URL` | Mothership origin the Sim server calls. Defaults to `https://www.copilot.sim.ai`, the Sim-hosted service |
216216
| `MOTHERSHIP_SIM_TRANSPORT` | `direct` (the Mothership calls Sim) or `checkpoint` (Sim polls the Mothership for workspace tool calls over outbound HTTPS). Self-hosted Sim defaults to `checkpoint` |
217-
| `NEXT_PUBLIC_CHAT_DISABLED` | Set to `true` to hide the Chat module: the workspace lands on your first workflow, with no chats list or editor Chat panel. Chat is shown when unset; `bunx sim-setup` sets it for you if you skip the chat key |
217+
| `NEXT_PUBLIC_CHAT_DISABLED` | Set to `true` to hide the Chat module: the workspace lands on your first workflow, with no chats list or editor Chat panel. Chat is shown when unset; `npx sim-setup` sets it for you if you skip the chat key |
218218
| `PII_URL` | Base URL of the Presidio service backing PII detection and redaction. The Helm chart wires it to its own `pii` Service when `pii.enabled`; on Compose point it at the PII service on your network. Local development and the Helm fallback use `http://localhost:5001`; that address works only when the service is reachable there. Point production at a running service to use redaction |
219219
| `ADMIN_API_KEY` | Admin API key for GitOps operations and organization provisioning |
220220

@@ -236,7 +236,7 @@ Most enterprise features read their settings from the organization that owns a w
236236

237237
## File storage
238238

239-
By default Sim writes uploads to local disk. Neither stock production Compose nor the default Helm chart mounts the upload directory, so configure cloud storage or a persistent local layout before retaining files. See [Object storage](/platform/self-hosting/object-storage) for the full setup, bucket layout, and IAM policy.
239+
By default Sim writes uploads to local disk. Production Compose keeps them in the `sim_uploads` volume on its host; the default Helm chart mounts no upload directory, so configure cloud storage or a persistent local layout there before retaining files. See [Object storage](/platform/self-hosting/object-storage) for the full setup, bucket layout, and IAM policy.
240240

241241
| Variable | Description |
242242
|----------|-------------|

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Compose bundles PostgreSQL, Redis, and a scheduler. The Helm chart bundles Postg
1919

2020
## Quick start
2121

22-
Install Bun, Node.js 20 or newer, Docker, and Docker Compose 2.24.0 or later, then run:
22+
Install Node.js 20 or newer, Docker, and Docker Compose 2.24.0 or later, then run:
2323

2424
```bash
25-
bunx sim-setup
25+
npx sim-setup
2626
```
2727

2828
The wizard creates a `./sim` directory with a production Compose file and generated `.env`, including `POSTGRES_PASSWORD`. It starts published container images. Open [http://localhost:3000](http://localhost:3000).
@@ -50,7 +50,7 @@ These are sizing suggestions, not enforced minimums or capacity guarantees. The
5050
- Verify [background jobs](/platform/self-hosting/background-jobs), including the scheduler's `CRON_SECRET`.
5151

5252
<Callout type="warn">
53-
Recreating an app container with unmounted local uploads loses those files. Losing an encryption key makes the data encrypted with it unreadable. A database backup does not replace file storage or key backups.
53+
Local uploads live on the Docker host (the `sim_uploads` volume on Compose) and are not shared across hosts; on Kubernetes without object storage, recreating an app pod loses them. Losing an encryption key makes the data encrypted with it unreadable. A database backup does not replace file storage or key backups.
5454
</Callout>
5555

5656
Run [Verify your install](/platform/self-hosting/verify) before opening the deployment to your team and after upgrades or restores.

‎apps/docs/content/docs/platform/self-hosting/object-storage.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Configure file storage before uploading durable files or adding app replicas. Si
1717
| **[Google Cloud Storage](https://cloud.google.com/storage)** | Production on GCP |
1818

1919
<Callout type="warn">
20-
Local disk writes to `/app/apps/sim/uploads` inside the container. Neither `docker-compose.prod.yml` nor the Helm chart mounts a volume there, so every uploaded file is lost the moment the container is recreated — and files are **not** shared across replicas. Mount your own volume at that path if you must stay on local disk; for any multi-replica or production deployment, use S3, Azure Blob, or Google Cloud Storage.
20+
Local disk writes to `/app/apps/sim/uploads` inside the container. `docker-compose.prod.yml` mounts the `sim_uploads` volume there, so files survive container recreation, but they stay on that one host and are **not** shared across replicas. The Helm chart mounts no volume there, so recreating a pod loses them. For any multi-replica or production deployment, use S3, Azure Blob, or Google Cloud Storage.
2121
</Callout>
2222

2323
## How the backend is selected

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ The Compose files do not publish `db` on a host port. `simstudio`, `realtime`, a
340340
- **You set `POSTGRES_PASSWORD` before the first start.** Nothing else to do — updating the file closes the port.
341341
- **You never set it.** Postgres applies `POSTGRES_PASSWORD` only when it creates the data volume, so the database still uses `postgres`. Set `POSTGRES_PASSWORD=postgres` in `.env` so the stack starts, then rotate it: run `docker compose -f docker-compose.prod.yml exec db psql -U postgres -c "ALTER ROLE CURRENT_USER PASSWORD '<new password>'"` (with your `POSTGRES_USER` in place of `postgres` if you set one), set `POSTGRES_PASSWORD` to the same value, and run `docker compose -f docker-compose.prod.yml up -d`. Setting a new value in `.env` alone does not change the database's password and locks the app out.
342342

343-
`bunx sim-setup start` and `bunx sim-setup update` write the right value for you and print the rotation steps.
343+
`npx sim-setup start` and `npx sim-setup update` write the right value for you and print the rotation steps.
344344
</Callout>
345345

346346
To reach the database from the host — `psql`, a desktop client, a backup job — use `docker compose -f docker-compose.prod.yml exec db psql -U postgres simstudio`, or pass a second Compose file that publishes it on loopback only and connect over an SSH tunnel:

0 commit comments

Comments
 (0)