Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/sim-api-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Placement: the annotation must immediately precede the call or cast; up to three

```ts
// boundary-raw-fetch: streaming SSE chunks must be processed as they arrive
const response = await fetch(`/api/copilot/chat/stream?chatId=${chatId}`, { signal })
const response = await fetch(`/api/mothership/chat/stream?streamId=${streamId}`, { signal })
```

```ts
Expand Down
2 changes: 1 addition & 1 deletion .cursor/rules/sim-api-contracts.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Placement: the annotation must immediately precede the call or cast; up to three

```ts
// boundary-raw-fetch: streaming SSE chunks must be processed as they arrive
const response = await fetch(`/api/copilot/chat/stream?chatId=${chatId}`, { signal })
const response = await fetch(`/api/mothership/chat/stream?streamId=${streamId}`, { signal })
```

```ts
Expand Down
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/apps/sim/app/api/mothership/chat/ @simstudioai/mothership
/apps/sim/app/api/mothership/chats/ @simstudioai/mothership
/apps/sim/app/api/mothership/execute/ @simstudioai/mothership
/apps/sim/app/api/v1/copilot/chat/ @simstudioai/mothership

# Server-side stream orchestration, persistence, and protocol.
/apps/sim/lib/copilot/chat/ @simstudioai/mothership
Expand Down
39 changes: 21 additions & 18 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,31 +179,34 @@ Access the application at [http://localhost:3000/](http://localhost:3000/)

#### Using Local Models

To use local models with Sim:
To use local models with Sim, either point it at an Ollama server you already run or start one alongside the stack.

1. Install Ollama and pull models:
- **Ollama on your machine**: install it, pull a model, and point the app at the host:

```bash
# Install Ollama (if not already installed)
curl -fsSL https://ollama.ai/install.sh | sh
```bash
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull gemma3:4b

# Pull a model (e.g., gemma3:4b)
ollama pull gemma3:4b
```
echo 'OLLAMA_URL=http://host.docker.internal:11434' >> .env
Comment thread
waleedlatif1 marked this conversation as resolved.
Resolved
docker compose -f docker-compose.prod.yml up -d
```

2. Start Sim with local model support:
Ollama must listen on an interface the container can reach (`OLLAMA_HOST=0.0.0.0:11434`). For an Ollama server elsewhere, set `OLLAMA_URL` to its address instead.

```bash
# With NVIDIA GPU support
docker compose --profile local-gpu -f docker-compose.ollama.yml up -d
- **Bundled Ollama**: layer `docker-compose.ollama.yml` on the production file, with exactly one of the `gpu` or `cpu` profiles, then pull the starter model once:

# Without GPU (CPU only)
docker compose --profile local-cpu -f docker-compose.ollama.yml up -d
```bash
echo 'OLLAMA_URL=http://ollama:11434' >> .env

# If hosting on a server, update the environment variables in the docker-compose.prod.yml file
# to include the server's public IP then start again (OLLAMA_URL to i.e. http://1.1.1.1:11434)
docker compose -f docker-compose.prod.yml up -d
```
# With NVIDIA GPU support
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu up -d

# Without GPU (CPU only)
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile cpu up -d

# Pull gemma3:4b into the running server
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile setup run --rm model-setup
```

### Option 3: Manual Setup

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<p align="center">
<a href="https://deepwiki.com/simstudioai/sim" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/Ask-DeepWiki-E6E6E6?labelColor=C3C3C3&color=E6E6E6" alt="Ask DeepWiki"></a>
<a href="https://cursor.com/link/prompt?text=Help%20me%20set%20up%20Sim%20locally.%20Follow%20these%20steps%3A%0A%0A1.%20First%2C%20verify%20Docker%20is%20installed%20and%20running%3A%0A%20%20%20docker%20--version%0A%20%20%20docker%20info%0A%0A2.%20Clone%20the%20repository%3A%0A%20%20%20git%20clone%20https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim.git%0A%20%20%20cd%20sim%0A%0A3.%20Generate%20required%20secrets%20%28the%20stack%20will%20not%20start%20without%20them%29%3A%0A%20%20%20cat%20%3E%20.env%20%3C%3C%20EOF%0A%20%20%20BETTER_AUTH_SECRET%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20ENCRYPTION_KEY%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20INTERNAL_API_SECRET%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20CRON_SECRET%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20POSTGRES_PASSWORD%3D%24%28openssl%20rand%20-hex%2024%29%0A%20%20%20EOF%0A%0A4.%20Start%20the%20services%20with%20Docker%20Compose%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20up%20-d%0A%0A5.%20Wait%20for%20all%20containers%20to%20be%20healthy%20%28this%20may%20take%201-2%20minutes%29%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20ps%0A%0A6.%20Verify%20the%20app%20is%20accessible%20at%20http%3A%2F%2Flocalhost%3A3000%0A%0AIf%20there%20are%20any%20errors%2C%20help%20me%20troubleshoot%20them.%20Common%20issues%3A%0A-%20Port%203000%20or%203002%20already%20in%20use%0A-%20Docker%20not%20running%0A-%20Insufficient%20memory%20%28needs%2012GB%2B%20RAM%29%0A%0AFor%20local%20AI%20models%20with%20Ollama%2C%20use%20one%20of%20these%20instead%20of%20step%204%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.ollama.yml%20--profile%20gpu%20--profile%20setup%20up%20-d%0A%20%20%20docker%20compose%20-f%20docker-compose.ollama.yml%20--profile%20cpu%20--profile%20setup%20up%20-d%0AThen%20check%20status%20in%20step%205%20with%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.ollama.yml%20ps"><img src="https://img.shields.io/badge/Set%20Up%20with-Cursor-E6E6E6?logo=cursor&logoColor=1A1A1A&labelColor=C3C3C3&color=E6E6E6" alt="Set Up with Cursor"></a>
<a href="https://cursor.com/link/prompt?text=Help%20me%20set%20up%20Sim%20locally.%20Follow%20these%20steps%3A%0A%0A1.%20First%2C%20verify%20Docker%20is%20installed%20and%20running%3A%0A%20%20%20docker%20--version%0A%20%20%20docker%20info%0A%0A2.%20Clone%20the%20repository%3A%0A%20%20%20git%20clone%20https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim.git%0A%20%20%20cd%20sim%0A%0A3.%20Generate%20required%20secrets%20%28the%20stack%20will%20not%20start%20without%20them%29%3A%0A%20%20%20cat%20%3E%20.env%20%3C%3C%20EOF%0A%20%20%20BETTER_AUTH_SECRET%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20ENCRYPTION_KEY%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20INTERNAL_API_SECRET%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20CRON_SECRET%3D%24%28openssl%20rand%20-hex%2032%29%0A%20%20%20POSTGRES_PASSWORD%3D%24%28openssl%20rand%20-hex%2024%29%0A%20%20%20EOF%0A%0A4.%20Start%20the%20services%20with%20Docker%20Compose%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20up%20-d%0A%0A5.%20Wait%20for%20all%20containers%20to%20be%20healthy%20%28this%20may%20take%201-2%20minutes%29%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20ps%0A%0A6.%20Verify%20the%20app%20is%20accessible%20at%20http%3A%2F%2Flocalhost%3A3000%0A%0AIf%20there%20are%20any%20errors%2C%20help%20me%20troubleshoot%20them.%20Common%20issues%3A%0A-%20Port%203000%20or%203002%20already%20in%20use%0A-%20Docker%20not%20running%0A-%20Insufficient%20memory%20%28needs%2012GB%2B%20RAM%29%0A%0AFor%20local%20AI%20models%20with%20bundled%20Ollama%2C%20add%20OLLAMA_URL%3Dhttp%3A%2F%2Follama%3A11434%20to%20.env%2C%20then%20use%20one%20of%20these%20instead%20of%20step%204%20%28gpu%20needs%20an%20NVIDIA%20GPU%29%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20-f%20docker-compose.ollama.yml%20--profile%20gpu%20up%20-d%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20-f%20docker-compose.ollama.yml%20--profile%20cpu%20up%20-d%0APull%20the%20starter%20model%20once%20Ollama%20is%20running%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20-f%20docker-compose.ollama.yml%20--profile%20setup%20run%20--rm%20model-setup%0AThen%20check%20status%20in%20step%205%20with%20the%20profile%20you%20started%3A%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20-f%20docker-compose.ollama.yml%20--profile%20gpu%20ps%0A%20%20%20docker%20compose%20-f%20docker-compose.prod.yml%20-f%20docker-compose.ollama.yml%20--profile%20cpu%20ps"><img src="https://img.shields.io/badge/Set%20Up%20with-Cursor-E6E6E6?logo=cursor&logoColor=1A1A1A&labelColor=C3C3C3&color=E6E6E6" alt="Set Up with Cursor"></a>
</p>

<p align="center">
Expand Down
57 changes: 46 additions & 11 deletions apps/docs/content/docs/platform/self-hosting/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,30 +145,64 @@ docker compose -f docker-compose.prod.yml up -d
Container `localhost` is the container itself. The default `http://localhost:11434` does not reach an Ollama server on the host.
</Callout>

### Development Ollama stack
### Bundled Ollama

`docker-compose.ollama.yml` builds the app, realtime, and migrations from source. It does not bundle Redis or cron. Without Redis, pub/sub is process-local and CLI pairing approval has no fallback; idempotency and execution-progress storage can fall back to PostgreSQL. Without a scheduler, background jobs do not run.
`docker-compose.ollama.yml` is an overlay on `docker-compose.prod.yml`: it adds an Ollama server to the production stack and points the app at it, so the stack keeps the published images, the required secrets, Redis, and cron. Ollama is reachable only inside the Compose network, as `ollama:11434`.

Use a server profile together with `setup`; `setup` alone starts no Ollama server and the model setup waits:
Add the address to `.env` first. The overlay refuses to start without it, and keeping it in `.env` means a later run of `docker-compose.prod.yml` alone still reaches Ollama:

```bash
# NVIDIA GPU
docker compose -f docker-compose.ollama.yml --profile gpu --profile setup up -d
OLLAMA_URL=http://ollama:11434
```

Start the stack with exactly one server profile:

```bash
# NVIDIA GPU (requires the NVIDIA Container Toolkit)
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu up -d

# CPU only
docker compose -f docker-compose.ollama.yml --profile cpu --profile setup up -d
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile cpu up -d
```

Pull the starter model, `gemma3:4b`, once the server is running:

```bash
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile setup run --rm model-setup
```

Setup pulls `gemma3:4b`. To pull another model:
To pull another model, exec into the server for your profile:

```bash
# GPU profile
docker compose -f docker-compose.ollama.yml exec ollama ollama pull llama3.2
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu exec ollama ollama pull llama3.2

# CPU profile
docker compose -f docker-compose.ollama.yml exec ollama-cpu ollama pull llama3.2
docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile cpu exec ollama-cpu ollama pull llama3.2
```

#### Migrating from the previous Ollama stack

The previous `docker-compose.ollama.yml` was a standalone stack with the fixed project name `sim-with-ollama`, so its database and models live in the `sim-with-ollama_postgres_data` and `sim-with-ollama_ollama_data` volumes. The overlay takes its project name from `docker-compose.prod.yml`, and started as-is it creates empty volumes instead. To keep your data:

1. From the repository directory, stop the old stack without `-v`, so its volumes are kept. The old file is gone, so name the project instead:

```bash
docker compose -p sim-with-ollama down
Comment thread
waleedlatif1 marked this conversation as resolved.
Resolved
```

2. Add the old project name and database password to `.env`, so the overlay and the `sim-setup` CLI both resolve the same project and volumes. The old stack's password defaulted to `postgres` unless you set one:

```bash
COMPOSE_PROJECT_NAME=sim-with-ollama
POSTGRES_PASSWORD=postgres
OLLAMA_URL=http://ollama:11434
```

3. Start the stack with the overlay and your profile, as above.

Ollama is no longer published on host port `11434`. Reach it with `docker compose exec`, as in the model pull commands above.

## LM Studio

Start [LM Studio's local server](https://lmstudio.ai/docs/developer/core/server), load a model, enable **Serve on Local Network**, and [configure API authentication](https://lmstudio.ai/docs/developer/core/authentication). Save these values beside your Compose file:
Expand All @@ -184,13 +218,14 @@ Recreate the app using the file that started your installation:

```bash
COMPOSE_FILE=docker-compose.prod.yml
# For a source-built stack, use docker-compose.local.yml or docker-compose.ollama.yml.
# For a source-built stack, use docker-compose.local.yml. With bundled Ollama,
# add the overlay: -f docker-compose.prod.yml -f docker-compose.ollama.yml
docker compose -f "$COMPOSE_FILE" up -d --force-recreate simstudio
```

## The `sim-setup` CLI

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; Ollama-stack installs are not managed.
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.

| Command | Behavior |
| --- | --- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Configure at least one. Every configured provider stays active and is tried in o
| `RESUME_EXECUTION_CONCURRENCY_LIMIT` | `50` | Trigger.dev resume task concurrency |
| `EGRESS_ALLOWED_HOSTS` | unset | Comma-separated hostnames outbound requests may reach on a private network. Leading wildcard allowed, e.g. `host.docker.internal,*.svc.cluster.local`. Not honored for URLs harvested from content or a third-party response, nor for an HTTP block's `proxyUrl` |
| `EGRESS_ALLOWED_IP_RANGES` | unset | Comma-separated CIDRs or IPs outbound requests may reach on a private network, e.g. `10.0.0.0/8`. Same exclusions |
| `ALLOW_PRIVATE_DATABASE_HOSTS` | unset | **Deprecated.** Vouches for the entire private address space, for database, cache, and mail connector hosts only. Replace it with the two settings above naming specific destinations |
| `ALLOW_PRIVATE_DATABASE_HOSTS` | unset | **Removed.** Has no effect; the app logs an error at startup if it is still set. Name each database, cache, or mail host in `EGRESS_ALLOWED_HOSTS` instead; a host reached by IP address, including any IPv6 literal (which `EGRESS_ALLOWED_HOSTS` rejects), takes a single-address entry such as `10.0.0.5/32` in `EGRESS_ALLOWED_IP_RANGES`. Do not allowlist whole private ranges, which would widen what workflow HTTP blocks can reach, or `localhost`, where Sim's own database and Redis listen |
| `DOMAIN_VERIFICATION_NAMESERVERS` | `1.1.1.1,8.8.8.8` | Comma-separated nameserver IPs that SSO domain verification sends its TXT lookup to. Set it when the network only allows DNS to an internal resolver. Entries that are not IP addresses are ignored |

A malformed entry in either allowlist stops the app at startup with a message naming the setting. See [the SSRF boundary](/platform/self-hosting/security#the-ssrf-boundary) for the accepted syntax and for what the allowlist does and does not reach.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Deploy the PII service, configure its internal network path, and enable the stor
## Metrics

<Callout type="warn">
The default app and realtime images **do not expose a `/metrics` endpoint**. The chart's `monitoring.serviceMonitor` option exists for builds that do — enabling it against the stock images produces a ServiceMonitor that scrapes nothing.
The app and realtime images **do not expose a `/metrics` endpoint**, and the Helm chart ships no ServiceMonitor. There is nothing for Prometheus to scrape from the Sim pods directly.
</Callout>

Until an application metrics endpoint ships, build alerting from the signals that do exist:
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/platform/self-hosting/security.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ EGRESS_ALLOWED_HOSTS=host.docker.internal

Review these compatibility cases when upgrading:

- **`ALLOW_PRIVATE_DATABASE_HOSTS`** still works, but it is deprecated and logs a warning at startup. It vouches for the whole private address space, loopback included, for database, cache, and mail connector hosts. Replace it with `EGRESS_ALLOWED_HOSTS` or `EGRESS_ALLOWED_IP_RANGES` naming the hosts you actually use.
- **`ALLOW_PRIVATE_DATABASE_HOSTS`** has been removed and no longer has any effect; the app logs an error at startup if it is still set. Name the specific database, cache, and mail hosts you use in `EGRESS_ALLOWED_HOSTS`. A host you reach by IP address needs a single-address entry in `EGRESS_ALLOWED_IP_RANGES` instead (for example `10.0.0.5/32`, or `fd00::5/128`); IPv6 literals in particular must go there, since `EGRESS_ALLOWED_HOSTS` rejects them. Do not allowlist whole private ranges in its place, since the allowlist also applies to workflow HTTP blocks and that would widen what every workflow author can reach, and do not allowlist `localhost`, where Sim's own database and Redis listen.
- **1Password Connect** on a private, non-loopback address, and an **MCP server** on a private address or reached through a DNS name that points at loopback, are no longer reachable implicitly. Name them.
- **`ALLOWED_MCP_DOMAINS`** governs which domains may be used; it no longer disables the address check, so an MCP server on a private address needs the allowlist too.
- **Content fetches** — an image URL, a file imported by URL, an MCP OAuth endpoint on a different origin than the MCP server itself — never use the allowlist. Those destinations have to be publicly routable. (An SSO OIDC *discovery* URL is a configured endpoint and does use the allowlist; the endpoints named *inside* the discovery document are validated as content when Sim registers the provider, so an internal IdP endpoint is refused there and cannot be allowlisted — provide the endpoints explicitly to have them validated as configured endpoints instead.)
Expand Down
Loading
Loading