---
title: "Deploy Opik LLM Evals Full Stack"
description: "Opik LLM evals and tracing, full 7-service stack with basic auth on"
category: "Observability"
url: https://railway.com/deploy/opik-llm-evals-full-stack
---

# Deploy Opik LLM Evals Full Stack

Opik LLM evals and tracing, full 7-service stack with basic auth on

**[Deploy Opik LLM Evals Full Stack on Railway](https://railway.com/template/opik-llm-evals-full-stack)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/opik-llm-evals-full-stack/manifest.json

- **Creator:** Protemplate
- **Category:** Observability
- **Total deploys:** 2

## Template content

### Redis https://devicons.railway.app/i/redis.svg

- **Image:** redis:7.2.4-alpine3.19
- **Start command:** `sh -c 'docker-entrypoint.sh redis-server --requirepass "$REDIS_PASSWORD" --save 60 1 --dir /data --bind :: 0.0.0.0'`

### opik-python-backend https://avatars.githubusercontent.com/u/31487821?v=4

- **Image:** ghcr.io/comet-ml/opik/opik-python-backend:2.2.59
- **Start command:** `sh -c 'cd /opt/opik-python-backend && exec gunicorn --access-logfile - --workers 1 --threads "$PYTHON_CODE_EXECUTOR_PARALLEL_NUM" --worker-class gthread --bind "[::]:$PYTHON_BACKEND_PORT" --chdir ./src "opik_backend:create_app()"'`
- **Health check:** /healthcheck

### opik-backend https://avatars.githubusercontent.com/u/31487821?v=4

- **Image:** ghcr.io/comet-ml/opik/opik-backend:2.2.59
- **Start command:** `bash -c 'for t in "$MYSQL_HOST:3306" "$ANALYTICS_DB_HOST:8123" "$REDIS_HOST:6379"; do n=0; until (exec 3<>"/dev/tcp/${t%:*}/${t##*:}") 2>/dev/null; do n=$((n+1)); if [ "$n" -ge 150 ]; then echo "gave up waiting for $t"; break; fi; echo "waiting for $t"; sleep 2; done; done; ./run_db_migrations.sh && ./provision_agent_insights_readonly_user.sh && exec ./entrypoint.sh'`
- **Health check:** /health-check

### MinIO https://devicons.railway.app/i/minio.svg

- **Image:** quay.io/minio/minio:RELEASE.2025-03-12T18-04-18Z
- **Start command:** `sh -c "mkdir -p /data/public && exec minio server /data --address :9000 --console-address :9001"`

### ClickHouse https://devicons.railway.app/i/clickhouse.svg

- **Image:** clickhouse/clickhouse-server:26.3.16.16
- **Start command:** `bash -c "mkdir -p /etc/clickhouse-server/config.d /etc/clickhouse-server/users.d && echo '<clickhouse><listen_host>::</listen_host></clickhouse>' > /etc/clickhouse-server/config.d/listen.xml && echo '<clickhouse><custom_settings_prefixes>SQL_</custom_settings_prefixes><macros><shard>1</shard><replica>clickhouse</replica><cluster>cluster</cluster></macros><keeper_server><tcp_port>9181</tcp_port><server_id>1</server_id><log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path><snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path><raft_configuration><server><id>1</id><hostname>localhost</hostname><port>9234</port></server></raft_configuration></keeper_server><zookeeper><node><host>localhost</host><port>9181</port></node></zookeeper><distributed_ddl><path>/clickhouse/task_queue/ddl</path></distributed_ddl><remote_servers><cluster><shard><internal_replication>true</internal_replication><replica><host>localhost</host><port>9000</port></replica></shard></cluster></remote_servers></clickhouse>' > /etc/clickhouse-server/config.d/opik.xml && echo '<clickhouse><profiles><default><enable_time_time64_type>1</enable_time_time64_type><distributed_background_insert_batch>1</distributed_background_insert_batch><distributed_background_insert_split_batch_on_failure>1</distributed_background_insert_split_batch_on_failure></default></profiles></clickhouse>' > /etc/clickhouse-server/users.d/opik.xml && exec /entrypoint.sh"`

### MySQL https://devicons.railway.app/i/mysql.svg

- **Image:** mysql:8.4.2
- **Start command:** `docker-entrypoint.sh mysqld --datadir=/var/lib/mysql/data --bind-address=::`

### Opik https://avatars.githubusercontent.com/u/31487821?v=4

- **Image:** ghcr.io/comet-ml/opik/opik-frontend:2.2.59
- **Start command:** `sh -c 'echo IyEvYmluL3NoCnNldCAtZXUKUE9SVD0iJHtQT1JUOi01MTczfSIKZXhwb3J0IE5HSU5YX1BPUlQ9IiRQT1JUIgpCQUNLRU5EPSIke09QSUtfQkFDS0VORF9IT1NUOj9PUElLX0JBQ0tFTkRf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waSAtPiBodHRwOi8vJEJBQ0tFTkQgdmlhIHJlc29sdmVyICROUyIKZXhlYyAvZG9ja2VyLWVudHJ5cG9pbnQuc2ggbmdpbnggLWcgImRhZW1vbiBvZmY7Igo= | base64 -d > /tmp/railway-start.sh && exec sh /tmp/railway-start.sh'`
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Opik on Railway

Opik is Comet's open source platform for LLM evaluation and observability. It records traces and spans from your LLM applications, scores them with LLM-as-a-judge and custom Python metrics, manages prompts and datasets, and runs experiments so you can compare model and prompt versions from one UI.

## About Hosting Opik

Hosting Opik means running the full upstream stack: an nginx frontend that serves the React UI and proxies `/api` to the Java backend, a Python backend for custom metrics and the optimizer, MySQL for state (projects, prompts, datasets), ClickHouse for traces and spans, Redis for locks and queues, and MinIO for attachments. This template uses the official `ghcr.io/comet-ml/opik/*` images pinned to `2.2.59`, replaces the upstream ZooKeeper container with ClickHouse Keeper embedded in the ClickHouse service (the analytics migrations use `ON CLUSTER` and `ReplicatedMergeTree`, so coordination is mandatory even on one node), and renders the nginx config at boot so the frontend reaches the backend over Railway's private network. Opik open source ships without authentication, so the template adds HTTP basic auth with a generated password in front of the UI and API.

## Common Use Cases

- **LLM tracing**: log every prompt, completion, tool call and cost from Python or TypeScript apps, LangChain, LlamaIndex, OpenAI, Anthropic and more
- **Evaluation**: score traces with built in heuristics, LLM-as-a-judge or your own Python metrics
- **Experiments**: run a dataset through a prompt or agent and compare versions side by side
- **Prompt management**: version prompts in the Prompt Library and pull them from the SDK
- **Self hosted observability**: keep production traces inside your own Railway project

## Dependencies for Opik Hosting

- **MySQL 8.4**: state database (included)
- **ClickHouse 26.3 with embedded Keeper**: analytics database for traces, spans and scores (included)
- **Redis 7.2**: distributed locks, streams and the optimizer queue (included)
- **MinIO**: S3 compatible attachment storage, private only (included)
- **LLM provider keys**: optional, added later in the UI under AI Providers for LLM-as-a-judge and the playground

### Deployment Dependencies

- [Opik self hosting guide](https://www.comet.com/docs/opik/self-host/overview)
- [Opik docker-compose deployment](https://github.com/comet-ml/opik/tree/main/deployment/docker-compose)
- [Opik SDK configuration](https://www.comet.com/docs/opik/tracing/sdk_configuration)
- [Opik GitHub repository](https://github.com/comet-ml/opik)

### Implementation Details

The public `Opik` service is nginx on port 5173 with `/health` open and everything else behind basic auth (user `OPIK_AUTH_USER`, password `OPIK_AUTH_PASSWORD`). The `/api` proxy also accepts the same password as a raw `Authorization` header, which is how the Opik SDK sends `OPIK_API_KEY`. The backend start command waits for MySQL, ClickHouse and Redis, runs the Liquibase migrations for both databases, then starts the API. Nothing external is required at boot.

```env
# Opik (frontend)
PORT=5173
OPIK_BACKEND_HOST=${{opik-backend.RAILWAY_PRIVATE_DOMAIN}}:8080
OPIK_AUTH_PASSWORD=${{secret(32)}}
# opik-backend
STATE_DB_URL=${{MySQL.RAILWAY_PRIVATE_DOMAIN}}:3306/opik?createDatabaseIfNotExist=true&amp;...
ANALYTICS_DB_HOST=${{ClickHouse.RAILWAY_PRIVATE_DOMAIN}}
REDIS_URL=${{Redis.REDIS_URL}}
S3_URL=http://${{MinIO.RAILWAY_PRIVATE_DOMAIN}}:9000
OPIK_USAGE_REPORT_ENABLED=false
```

After deploy, open the `Opik` service domain, sign in with the basic auth user and password from the `Opik` service variables, and point the SDK at it:

```bash
export OPIK_URL_OVERRIDE=https:///api
export OPIK_API_KEY=
export OPIK_WORKSPACE=default
```

## Why Deploy Opik on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Opik on Railway, you get the complete seven service stack with generated secrets, persistent volumes for every database, health checks on every application service, managed SSL on the UI, and private networking between the frontend, backends and data stores.


## Similar templates

- [Pyroscope profiling](https://railway.com/deploy/pyroscope-profiling) — Protected continuous profiling with durable Pyroscope storage.
- [SigOnly](https://railway.com/deploy/sigonly) — Deploy SigNoz with a working demo app & config in one click
- [Unwrapped Spotify Music Stats](https://railway.com/deploy/wide-bold) — Unwrapped Spotify Music Stats, Estatísticas de músicas disponíveis

Open this page in a browser: https://railway.com/deploy/opik-llm-evals-full-stack
