---
title: "Deploy Sim Agent Workflows + pgvector + Realtime"
description: "Sim AI agent workflow builder with pgvector, Redis, realtime and cron"
category: "AI/ML"
url: https://railway.com/deploy/sim-agent-workflows-pgvector-realtime
---

# Deploy Sim Agent Workflows + pgvector + Realtime

Sim AI agent workflow builder with pgvector, Redis, realtime and cron

**[Deploy Sim Agent Workflows + pgvector + Realtime on Railway](https://railway.com/template/sim-agent-workflows-pgvector-realtime)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/sim-agent-workflows-pgvector-realtime/manifest.json

- **Creator:** Protemplate
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### Postgres https://avatars.githubusercontent.com/u/98363230?v=4

- **Image:** pgvector/pgvector:pg17
- **Start command:** `docker-entrypoint.sh postgres -c "listen_addresses=*"`

### Realtime https://avatars.githubusercontent.com/u/199344406?v=4

- **Image:** ghcr.io/simstudioai/realtime:v0.9.53
- **Start command:** `sh -c 'until curl -fsS -o /dev/null "$MIGRATIONS_URL"; do echo "waiting for the Migrations service to apply the schema"; sleep 3; done; exec bun apps/realtime/src/bootstrap.ts'`
- **Health check:** /health
- **Public domain:** Yes

### Sim https://avatars.githubusercontent.com/u/199344406?v=4

- **Image:** ghcr.io/simstudioai/simstudio:v0.9.53
- **Start command:** `sh -c 'until curl -fsS -o /dev/null "$MIGRATIONS_URL"; do echo "waiting for the Migrations service to apply the schema"; sleep 3; done; exec bun apps/sim/bootstrap.js'`
- **Health check:** /api/health
- **Public domain:** Yes

### Cron https://avatars.githubusercontent.com/u/199344406?v=4

- **Image:** ghcr.io/simstudioai/cron:v0.9.53

### Migrations https://avatars.githubusercontent.com/u/199344406?v=4

- **Image:** ghcr.io/simstudioai/migrations:v0.9.53
- **Start command:** `sh -c 'until bun run db:migrate; do echo "migration attempt failed, retrying in 5s"; sleep 5; done; echo "migrations applied, serving the ready gate"; exec bun -e "Bun.serve({port:process.env.PORT,hostname:process.env.GATE_HOST,fetch:()=>new Response()})"'`
- **Health check:** /

### Redis https://avatars.githubusercontent.com/u/1529926?v=4

- **Image:** redis:7.4.6-alpine
- **Start command:** `sh -c 'exec docker-entrypoint.sh redis-server --requirepass "$REDIS_PASSWORD" --save "" --appendonly no --port 6379 --bind :: 0.0.0.0'`

## Documentation

# Deploy and Host Sim on Railway

Sim is an open source workspace for building, deploying and monitoring AI agents and workflows on a visual canvas. This template runs the complete upstream production stack, pinned to one release, with signup closed to everyone except the addresses you allow.

## About Hosting Sim

Hosting Sim means running six services that share one database schema: the app, a realtime server, a migration runner, a scheduler, Postgres with pgvector and Redis. This template wires them together with private networking and generated secrets, and orders startup so the app waits for migrations.

## What's Included

- **Sim**: the Next.js app, API and workflow executor, with a volume for uploaded files
- **Realtime**: the Socket.IO server behind collaborative editing, on its own domain
- **Migrations**: applies the database schema, then signals the app that it is safe to start
- **Cron**: the scheduler for scheduled workflows, polling triggers and connector syncs
- **Postgres**: PostgreSQL 17 with pgvector for knowledge bases, on a volume
- **Redis**: live chat and table events plus shared caches

Every secret is generated for you and shared between the services that need it.

## Why this template

- All three Sim images are pinned to the same release. They share one schema, and a floating tag breaks the stack on the next restart.
- The app and Realtime wait for migrations to finish, so the first deploy does not race.
- Redis and the scheduler are included. Without them live updates and scheduled workflows do not run.
- Signup is restricted from the first minute.

## First steps after deploy

1. Enter your email address in `ALLOWED_LOGIN_EMAILS` when you deploy. Only listed addresses can sign up or sign in.
2. Wait for all six services to turn green. The first boot runs every migration and can take several minutes.
3. Open the Sim domain and sign up with the address you allowed.
4. Add a model provider key in the workspace settings, or set `OPENAI_API_KEY` on the Sim service.
5. Build a workflow and run it.

## Key environment variables

| Variable | Service | Notes |
|----------|---------|-------|
| `ALLOWED_LOGIN_EMAILS` | Sim | Required. Comma separated addresses allowed to register and log in. |
| `DISABLE_REGISTRATION` | Sim | Optional. Set to `true` once your accounts exist. |
| `ENCRYPTION_KEY`, `API_ENCRYPTION_KEY` | Sim | Generated. Back them up and never change them. |
| `NEXT_PUBLIC_APP_URL`, `BETTER_AUTH_URL` | Sim, Realtime | Update both services when you add a custom domain. |
| `NEXT_PUBLIC_SOCKET_URL` | Sim | Public address of Realtime. |
| `OPENAI_API_KEY`, `ANTHROPIC_API_KEY_1` | Sim | Optional provider keys for every workspace. |

## Common Use Cases

- Build AI agents and multi step workflows on a visual canvas
- Run scheduled or webhook triggered automations that call LLMs and tools
- Give a team a shared, self-hosted workspace with knowledge bases on pgvector

## Requirements

Use the Hobby plan or higher. Sim is a large application: upstream suggests 12 GiB of RAM in total for an evaluation install, and the app alone can use several gigabytes.

## Upgrading

Back up Postgres, change the image tag on Migrations and wait for it to become healthy, then set the same tag on Sim and Realtime.

## Dependencies for Sim Hosting

- PostgreSQL with pgvector (included)
- Redis (included)
- An LLM provider key such as OpenAI or Anthropic (optional at boot, needed to run agents)
- A mail provider such as Resend (optional, for invitations and password resets)

### Deployment Dependencies

- [Sim on GitHub](https://github.com/simstudioai/sim)
- [Sim self hosting docs](https://docs.sim.ai/platform/self-hosting)

## Why Deploy Sim on Railway?

Railway runs the whole stack in one project with private networking between services, generated secrets, volumes for the database and uploads, and one place to change image tags when you upgrade.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/sim-agent-workflows-pgvector-realtime
