---
title: "Deploy OpenTelemetry Collector"
description: "OTLP gateway for traces, metrics and logs, with token auth and disk queue"
category: "Observability"
url: https://railway.com/deploy/opentelemetry-coll-1
---

# Deploy OpenTelemetry Collector

OTLP gateway for traces, metrics and logs, with token auth and disk queue

**[Deploy OpenTelemetry Collector on Railway](https://railway.com/template/opentelemetry-coll-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/opentelemetry-coll-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Observability
- **Total deploys:** 2

## Template content

### otel-collector https://raw.githubusercontent.com/open-telemetry/opentelemetry.io/main/static/img/logos/opentelemetry-icon-color.png

- **Source:** https://github.com/aalfath/opentelemetry-collector-railway-template
- **Health check:** /
- **Public domain:** Yes

## Documentation

# Deploy and Host OpenTelemetry Collector on Railway

The OpenTelemetry Collector is the CNCF's vendor-neutral agent and gateway for telemetry. It receives traces, metrics and logs over OTLP from any OpenTelemetry SDK, batches and filters them, and exports them to one or more backends. This template runs the contrib distribution, version 0.165.0.

## About Hosting OpenTelemetry Collector

Hosting the Collector means running one long-lived service that your applications can reach, and deciding where the data goes next. This template builds the official `otel/opentelemetry-collector-contrib` image from a GitHub repo and puts OTLP/HTTP on a public Railway domain and OTLP/gRPC on the private network. Both require a bearer token, which Railway generates at deploy time. Railway's health check probes the collector's health extension. By default everything received is printed to the deploy logs. Set three variables to forward it to Grafana Cloud, Honeycomb, Axiom or any OTLP backend, with a disk-backed retry queue on a volume.

## Common Use Cases

* Give every service in a Railway project one OTLP endpoint for traces, metrics and logs
* Forward telemetry to a SaaS backend while keeping the vendor's API key in one place
* Buffer telemetry on disk so it survives backend outages and collector redeploys

## Dependencies for OpenTelemetry Collector Hosting

* The template's repo, [aalfath/opentelemetry-collector-railway-template](https://github.com/aalfath/opentelemetry-collector-railway-template) (Dockerfile pinned to the official image, plus `config.yaml`)
* A Railway volume at `/var/lib/otelcol` for the persistent export queue

### Deployment Dependencies

* [OpenTelemetry Collector documentation](https://opentelemetry.io/docs/collector/)
* [Collector releases](https://github.com/open-telemetry/opentelemetry-collector-releases/releases)
* [otel/opentelemetry-collector-contrib on Docker Hub](https://hub.docker.com/r/otel/opentelemetry-collector-contrib)

### Implementation Details

Send data from any OpenTelemetry SDK:

```sh
OTEL_EXPORTER_OTLP_ENDPOINT=https://YOUR-DOMAIN
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20YOUR-OTEL_AUTH_TOKEN
```

Services in the same project can use `http://otel-collector.railway.internal:4318` (HTTP) or port `4317` (gRPC), with the same token.

To forward to a backend, set these on the `otel-collector` service:

```sh
OTEL_EXPORTERS=[debug, otlphttp/upstream]
OTLP_UPSTREAM_ENDPOINT=https://YOUR-BACKEND/otlp
OTLP_UPSTREAM_HEADERS={"Authorization":"Basic YOUR-KEY"}
```

Other optional variables: `OTEL_DEBUG_VERBOSITY` (`basic`, `normal` or `detailed`) and `OTEL_MEMORY_LIMIT_MIB` (default 1024). Updates arrive as new commits to the repo, listed in its `CHANGELOG.md`.

## Why Deploy OpenTelemetry Collector 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 OpenTelemetry Collector on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Rootprint](https://railway.com/deploy/rootprint-1) — Open-source logs and traces with full-text search on object-storage.
- [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

Open this page in a browser: https://railway.com/deploy/opentelemetry-coll-1
