Skip to content

Deploying SigNoz (self-host) on Ubuntu 22.04 with a ClickHouse backend

Self-hosted SigNoz on Ubuntu 22.04 — ClickHouse + Zookeeper + SigNoz query, alertmanager, frontend, and OTel collector, end to end.

Your team wants a unified view across traces, metrics, and logs that does not require buying three SaaS subscriptions, and the data-residency clause in the latest enterprise contract just made vendor-hosted observability a non-starter. The candidate is SigNoz — OTLP-native, ClickHouse on the backend, single UI for the three signals, alerting included. The team’s first attempt was the public install.sh on a fresh VM, which works for a demo and falls over within a week on real traffic because the defaults assume “small lab” and the disk fills with high-cardinality logs by Thursday. This is the production-shaped installer for Ubuntu 22.04.

What’s happening

SigNoz is several services that talk to ClickHouse: the OTel collector (signoz-otel-collector) terminates OTLP and writes signals to ClickHouse tables; the query service (signoz-query-service) reads those tables for the UI and the API; the alertmanager triggers and routes alert state; the frontend serves the React app; Zookeeper coordinates a single-node ClickHouse keeper for table-replication metadata. ClickHouse is the heart of the stack — schema is column-oriented, retention is TTL-based per signal (traces, metrics, logs), and disk grows roughly linearly with span ingestion rate.

What goes wrong in the default install: the bundled Docker Compose runs ClickHouse with no resource limits, no separate volume for data, and TTLs that are short enough to mask the disk-growth problem until traffic ramps. The fix is to bind ClickHouse to a dedicated NVMe volume, set explicit MAX_MEMORY_USAGE and max_concurrent_queries, expose Prometheus metrics from each SigNoz component so you can alert on the alerter itself, and partition the OTel collector config so attribute scrubbing happens once on the way in instead of three times per pipeline.

How to verify

After the installer finishes, check the containers are up and healthy:

cd /opt/signoz && docker compose ps
# NAME                          STATE      PORTS
# clickhouse                    healthy    8123, 9000
# query-service                 healthy    8080
# frontend                      healthy    3301
# alertmanager                  healthy    9093
# otel-collector                healthy    4317, 4318
# zookeeper                     healthy    2181

ClickHouse responds to a query:

docker exec -it clickhouse clickhouse-client --query \
  "SELECT name, engine FROM system.tables WHERE database = 'signoz_traces'"

OTLP receiver listening on the collector:

ss -lntp | grep -E ':(4317|4318|3301|8080|9093)\b'
curl -fs http://127.0.0.1:13133/   # collector health

End-to-end: push a synthetic trace from a workstation (otelcol-contrib with debug exporter pointing at the SigNoz collector’s 4317), wait 10 seconds, open http://<host>:3301/ and query SELECT count() FROM signoz_traces.signoz_index_v3 WHERE timestamp > now() - INTERVAL 1 HOUR — the count should match what you sent.

If ingest counts climb but queries are slow, check ClickHouse’s system.processes for long-running merges and the part counts per partition: SELECT count() FROM system.parts WHERE active AND database = 'signoz_traces'. Part counts above a few thousand per table indicate merges aren’t keeping up, which usually means insufficient RAM or too many tiny inserts from the collector.

The fix

Save this as /root/setup-signoz.sh, edit the variables, run as root.

#!/usr/bin/env bash
set -euo pipefail

### Ubuntu 22.04 SigNoz self-host installer
### Stack: ClickHouse + Zookeeper + SigNoz services + OTel collector (Compose-managed)
### Data volume should be a dedicated NVMe — edit DATA_PATH below

if [[ "$(id -u)" -ne 0 ]]; then
  echo "Run as root."
  exit 1
fi

# === EDIT BEFORE RUN ===
SIGNOZ_VERSION="0.51.0"
HOST_PUBLIC_IP="10.30.0.50"
DATA_PATH="/srv/signoz-data"          # dedicated NVMe mount preferred
APP_CIDR="10.30.0.0/16"               # who can push OTLP and reach the UI
CH_MEMORY_LIMIT="16G"                 # ClickHouse memory ceiling
CH_MAX_CONCURRENT="50"                # concurrent query limit
TRACES_TTL_HOURS=168                  # 7 days
LOGS_TTL_HOURS=336                    # 14 days
METRICS_TTL_HOURS=720                 # 30 days
# =======================

echo
echo "========================================"
echo "SigNoz ${SIGNOZ_VERSION} self-host"
echo "Data path: ${DATA_PATH}"
echo "========================================"
echo

echo "==> Base OS"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y upgrade
apt-get -y install curl ca-certificates gnupg lsb-release \
  ufw chrony jq vim tar gzip net-tools dnsutils unattended-upgrades \
  fail2ban auditd

systemctl enable --now chrony auditd fail2ban

cat > /etc/apt/apt.conf.d/20auto-upgrades <<'AUTOUPG'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
AUTOUPG

sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sshd -t && systemctl restart sshd

cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl restart fail2ban

echo "==> Kernel/sysctl for ClickHouse"
cat > /etc/sysctl.d/99-clickhouse.conf <<'SYSCTL'
vm.max_map_count = 1048575
vm.swappiness = 1
vm.dirty_ratio = 20
vm.dirty_background_ratio = 5
net.core.somaxconn = 4096
fs.file-max = 2097152
SYSCTL
sysctl --system

cat > /etc/security/limits.d/99-clickhouse.conf <<'LIMITS'
* soft nofile 200000
* hard nofile 200000
* soft nproc 32768
* hard nproc 32768
LIMITS

echo "==> UFW"
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow from "${APP_CIDR}" to "${HOST_PUBLIC_IP}" port 4317 proto tcp
ufw allow from "${APP_CIDR}" to "${HOST_PUBLIC_IP}" port 4318 proto tcp
ufw allow from "${APP_CIDR}" to "${HOST_PUBLIC_IP}" port 3301 proto tcp
ufw --force enable

echo "==> Installing Docker"
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" \
  > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

systemctl enable --now docker

echo "==> Preparing data directories"
mkdir -p "${DATA_PATH}"/{clickhouse,zookeeper,alertmanager,signoz-data,otel-collector}
chown -R 101:101 "${DATA_PATH}/clickhouse"          # clickhouse uid
chown -R 1000:1000 "${DATA_PATH}/zookeeper"
chown -R 1000:1000 "${DATA_PATH}/signoz-data"
chmod 750 "${DATA_PATH}"

echo "==> Writing /opt/signoz/compose.yaml"
mkdir -p /opt/signoz
cat > /opt/signoz/compose.yaml <<EOF
name: signoz
services:
  zookeeper:
    image: bitnami/zookeeper:3.7.1
    restart: unless-stopped
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
      - ZOO_AUTOPURGE_INTERVAL=1
    volumes:
      - ${DATA_PATH}/zookeeper:/bitnami/zookeeper
    healthcheck:
      test: ["CMD-SHELL", "echo ruok | nc localhost 2181 | grep -q imok"]
      interval: 30s
      timeout: 5s
      retries: 5

  clickhouse:
    image: clickhouse/clickhouse-server:24.1.2-alpine
    restart: unless-stopped
    depends_on:
      zookeeper:
        condition: service_healthy
    tty: true
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    volumes:
      - ${DATA_PATH}/clickhouse:/var/lib/clickhouse
      - ./clickhouse-config.xml:/etc/clickhouse-server/config.d/zz-signoz.xml:ro
      - ./clickhouse-users.xml:/etc/clickhouse-server/users.d/zz-signoz.xml:ro
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]
      interval: 30s
      timeout: 5s
      retries: 5
    deploy:
      resources:
        limits:
          memory: ${CH_MEMORY_LIMIT}

  alertmanager:
    image: signoz/alertmanager:0.23.5
    restart: unless-stopped
    depends_on:
      query-service:
        condition: service_healthy
    volumes:
      - ${DATA_PATH}/alertmanager:/data
    command:
      - --queryService=http://query-service:8085
      - --storage.path=/data
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9093/-/healthy"]
      interval: 30s
      timeout: 5s
      retries: 5

  query-service:
    image: signoz/query-service:${SIGNOZ_VERSION}
    restart: unless-stopped
    depends_on:
      clickhouse:
        condition: service_healthy
    environment:
      - ClickHouseUrl=tcp://clickhouse:9000
      - ALERTMANAGER_API_PREFIX=http://alertmanager:9093/api/
      - SIGNOZ_LOCAL_DB_PATH=/var/lib/signoz/signoz.db
      - DASHBOARDS_PATH=/root/config/dashboards
      - STORAGE=clickhouse
      - GODEBUG=netdns=go
      - TELEMETRY_ENABLED=false
    volumes:
      - ${DATA_PATH}/signoz-data:/var/lib/signoz
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/v1/health"]
      interval: 30s
      timeout: 5s
      retries: 5

  frontend:
    image: signoz/frontend:${SIGNOZ_VERSION}
    restart: unless-stopped
    depends_on:
      query-service:
        condition: service_healthy
    environment:
      - FRONTEND_API_ENDPOINT=http://query-service:8080
    ports:
      - "${HOST_PUBLIC_IP}:3301:3301"

  otel-collector:
    image: signoz/signoz-otel-collector:${SIGNOZ_VERSION}
    restart: unless-stopped
    depends_on:
      clickhouse:
        condition: service_healthy
    command: ["--config=/etc/otel-collector-config.yaml"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml:ro
    ports:
      - "${HOST_PUBLIC_IP}:4317:4317"
      - "${HOST_PUBLIC_IP}:4318:4318"
      - "127.0.0.1:13133:13133"
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:13133/"]
      interval: 30s
      timeout: 5s
      retries: 5
EOF

echo "==> ClickHouse config overrides"
cat > /opt/signoz/clickhouse-config.xml <<EOF
<clickhouse>
  <max_concurrent_queries>${CH_MAX_CONCURRENT}</max_concurrent_queries>
  <max_server_memory_usage_to_ram_ratio>0.8</max_server_memory_usage_to_ram_ratio>
  <mark_cache_size>2147483648</mark_cache_size>
  <uncompressed_cache_size>2147483648</uncompressed_cache_size>
  <zookeeper>
    <node>
      <host>zookeeper</host>
      <port>2181</port>
    </node>
  </zookeeper>
  <merge_tree>
    <max_suspicious_broken_parts>1000</max_suspicious_broken_parts>
    <max_bytes_to_merge_at_max_space_in_pool>536870912000</max_bytes_to_merge_at_max_space_in_pool>
  </merge_tree>
</clickhouse>
EOF

cat > /opt/signoz/clickhouse-users.xml <<'EOF'
<clickhouse>
  <profiles>
    <default>
      <max_memory_usage>10000000000</max_memory_usage>
      <use_uncompressed_cache>0</use_uncompressed_cache>
      <load_balancing>random</load_balancing>
      <log_queries>1</log_queries>
    </default>
  </profiles>
</clickhouse>
EOF

echo "==> SigNoz OTel collector config"
cat > /opt/signoz/otel-collector-config.yaml <<EOF
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
        max_recv_msg_size_mib: 32
      http:
        endpoint: 0.0.0.0:4318

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 75
    spike_limit_percentage: 20
  batch:
    send_batch_size: 10000
    send_batch_max_size: 11000
    timeout: 10s
  resourcedetection:
    detectors: [env, system]
    timeout: 2s
  attributes/scrub:
    actions:
      - key: http.request.header.authorization
        action: delete
      - key: http.request.header.cookie
        action: delete

extensions:
  health_check:
    endpoint: 0.0.0.0:13133

exporters:
  clickhousetraces:
    datasource: tcp://clickhouse:9000/?database=signoz_traces
    low_cardinal_exception_grouping: true
  clickhousemetricswrite:
    endpoint: tcp://clickhouse:9000/?database=signoz_metrics
    resource_to_telemetry_conversion:
      enabled: true
  clickhouselogsexporter:
    dsn: tcp://clickhouse:9000/?database=signoz_logs
    timeout: 10s

service:
  extensions: [health_check]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, attributes/scrub, batch]
      exporters: [clickhousetraces]
    metrics:
      receivers: [otlp]
      processors: [memory_limiter, resourcedetection, batch]
      exporters: [clickhousemetricswrite]
    logs:
      receivers: [otlp]
      processors: [memory_limiter, attributes/scrub, batch]
      exporters: [clickhouselogsexporter]
  telemetry:
    logs:
      level: info
    metrics:
      address: 0.0.0.0:8888
EOF

echo "==> Pulling images and bringing the stack up"
cd /opt/signoz
docker compose pull
docker compose up -d

echo "==> Waiting for frontend"
for i in {1..60}; do
  if curl -fs http://127.0.0.1:3301/ >/dev/null 2>&1; then break; fi
  sleep 5
done

echo "==> Setting TTLs (post-startup, idempotent)"
sleep 30
docker exec clickhouse clickhouse-client --query \
  "ALTER TABLE signoz_traces.signoz_index_v3 MODIFY TTL toDateTime(timestamp) + INTERVAL ${TRACES_TTL_HOURS} HOUR;" || true
docker exec clickhouse clickhouse-client --query \
  "ALTER TABLE signoz_logs.logs MODIFY TTL toDateTime(timestamp/1000000000) + INTERVAL ${LOGS_TTL_HOURS} HOUR;" || true
docker exec clickhouse clickhouse-client --query \
  "ALTER TABLE signoz_metrics.samples_v4 MODIFY TTL toDateTime(unix_milli/1000) + INTERVAL ${METRICS_TTL_HOURS} HOUR;" || true

echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Containers:"
docker compose -f /opt/signoz/compose.yaml ps
echo
echo "UI: http://${HOST_PUBLIC_IP}:3301/"
echo "OTLP endpoint (gRPC): ${HOST_PUBLIC_IP}:4317"
echo "OTLP endpoint (HTTP): ${HOST_PUBLIC_IP}:4318"
echo
echo "Push a test trace:"
echo "  OTEL_EXPORTER_OTLP_ENDPOINT=http://${HOST_PUBLIC_IP}:4318 ./your-instrumented-app"
echo

Make it executable and run it:

chmod 700 /root/setup-signoz.sh
/root/setup-signoz.sh

After first start, browse to http://<host>:3301/, create the initial admin user (the SigNoz onboarding flow handles this on first visit), and point one application’s OTLP exporter at port 4317. Watch the UI’s traces tab populate within 30-60 seconds. Set up alerts from the UI itself once you have traffic flowing — alertmanager is already wired. The TTL ALTER TABLE statements at the bottom of the installer are idempotent and run on every boot; if you need to tighten retention later, edit the variables and re-run just that block. For real production at over a few thousand spans per second, plan to split ClickHouse onto its own host with replication enabled — the single-node default is fine for under that.

Stack Harbor operates SigNoz self-host as part of monitoring and support under Managed Cloud Ops, with ClickHouse capacity planning and 24/7 alert-routing. Talk to us about your observability stack.