---
title: "Deploy Centrifugo | (Just Updated) Realtime WebSocket Server, API Key and Secrets Generated"
description: "Realtime WebSocket server with API key and secrets generated"
category: "Queues"
url: https://railway.com/deploy/centrifugo-or-just-updated-realtime-webs
---

# Deploy Centrifugo | (Just Updated) Realtime WebSocket Server, API Key and Secrets Generated

Realtime WebSocket server with API key and secrets generated

**[Deploy Centrifugo | (Just Updated) Realtime WebSocket Server, API Key and Secrets Generated on Railway](https://railway.com/template/centrifugo-or-just-updated-realtime-webs)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/centrifugo-or-just-updated-realtime-webs/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Queues

## Template content

### centrifugo

- **Image:** centrifugo/centrifugo:v6.9.7@sha256:d014d3e99e0e9e58c45e656a7ea4ab97c3f79f96c82a3614ea0f810b4dd0e461
- **Start command:** `/bin/sh -c 'export CENTRIFUGO_HTTP_SERVER_PORT=$PORT CENTRIFUGO_HTTP_SERVER_ADDRESS=:: CENTRIFUGO_ADMIN_ENABLED=true CENTRIFUGO_HEALTH_ENABLED=true CENTRIFUGO_CLIENT_ALLOWED_ORIGINS="*" CENTRIFUGO_CHANNEL_WITHOUT_NAMESPACE_ALLOW_SUBSCRIBE_FOR_CLIENT=true CENTRIFUGO_CHANNEL_WITHOUT_NAMESPACE_ALLOW_PUBLISH_FOR_CLIENT=true CENTRIFUGO_CHANNEL_WITHOUT_NAMESPACE_ALLOW_HISTORY_FOR_CLIENT=true CENTRIFUGO_CHANNEL_WITHOUT_NAMESPACE_HISTORY_SIZE=50 CENTRIFUGO_CHANNEL_WITHOUT_NAMESPACE_HISTORY_TTL=300s; exec centrifugo'`
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Centrifugo on Railway

Centrifugo is an open-source realtime messaging server. Your backend publishes over a simple HTTP API, and browsers, mobile apps and agents receive the messages over WebSocket (or SSE / HTTP streaming) with channel subscriptions, presence and a short message history. This template deploys the official `centrifugo/centrifugo` image, pinned by digest, with every secret generated for you and nothing to fill in.

## About Hosting Centrifugo

Centrifugo runs as a single stateless Go process using its in-memory engine. The template starts it with the HMAC secret for client JWTs, the HTTP API key, and the admin UI credentials all generated at deploy time. The public domain, the `/health` check and a permissive default channel configuration (clients may subscribe, publish and read history on channels that have no namespace) are preconfigured, so the service is usable the moment it is healthy. Redeploys are safe: the secrets are stored as service variables and do not rotate.

## Why Deploy Centrifugo on Railway?

- No manual step: secrets are generated, the port and health path are wired up.
- Official image pinned by digest, so a redeploy never changes what runs.
- Public HTTPS and WSS endpoint out of the box.
- Cheap to run: one small Go process, no database.

## Common Use Cases

- Live notifications and activity feeds for web and mobile apps.
- Chat, presence and collaborative features without running your own WebSocket layer.
- Streaming results of long jobs or LLM agents to a browser.
- Replacing Pusher, Ably or PubNub with a self-hosted server.

## Dependencies for Centrifugo Hosting

### Deployment Dependencies

- Image: [centrifugo/centrifugo](https://hub.docker.com/r/centrifugo/centrifugo) (v6.9.7)
- Docs: https://centrifugal.dev/docs/getting-started/introduction
- No database or volume needed (memory engine; history lasts 5 minutes and is lost on restart).

## Machine-readable contract

```
service: centrifugo
base_url: https://
health: GET /health -&gt; 200
websocket: wss:///connection/websocket
http_api: POST /api/   header X-API-Key = value of CENTRIFUGO_HTTP_API_KEY
admin_ui: https:///    login secret = value of CENTRIFUGO_ADMIN_PASSWORD
credential_variables:
  CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEY  (signs client JWTs, HS256)
  CENTRIFUGO_HTTP_API_KEY                  (server API key)
  CENTRIFUGO_ADMIN_PASSWORD
  CENTRIFUGO_ADMIN_SECRET
```

Publish a message:

```
curl -X POST https:///api/publish \
  -H "X-API-Key: $CENTRIFUGO_HTTP_API_KEY" -H "Content-Type: application/json" \
  -d '{"channel":"news","data":{"hello":"world"}}'
```

Connect a client with a JWT (HS256, signed with `CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEY`, claim `sub` = user id) to `wss:///connection/websocket`.

Defaults are open for convenience: allowed origins are `*`. Restrict `CENTRIFUGO_CLIENT_ALLOWED_ORIGINS` and the channel permissions before production use.


## Similar templates

- [Celery | Web, Worker and Scheduler as Three Services](https://railway.com/deploy/celery-or-web-work-1) — Web, worker and scheduler wired up: Celery on Redis, outcomes in Postgres.
- [Redpanda](https://railway.com/deploy/redpanda-1) — Redpanda 26.2: Kafka-compatible streaming, single node, with Kafbat UI.
- [smoothmq](https://railway.com/deploy/AJv-64) — A drop-in replacement for AWS SQS

Open this page in a browser: https://railway.com/deploy/centrifugo-or-just-updated-realtime-webs
