Langtrace self-hosting: what are the deployment options and what infra do I need to run it privately?
LLM Observability & Evaluation

Langtrace self-hosting: what are the deployment options and what infra do I need to run it privately?

9 min read

Self-hosting Langtrace is a great fit if you need tighter control over data, stricter security boundaries, or want to run observability for LLM apps entirely inside your own VPC. This guide walks through the typical deployment options, what infrastructure you’ll need, and how to think about sizing and architecture for a private Langtrace setup.

Note: This article is based on Langtrace’s positioning as an observability platform for LLM apps and the available product context. For exact installation commands and version‑specific details, always refer to the official Langtrace documentation.


Why self-host Langtrace?

Before you decide on deployment details, it’s useful to be clear about why you’re self‑hosting, because that influences infra choices:

  • Data residency and compliance – Keep traces, prompts, and user data entirely within your own cloud region/VPC.
  • Network isolation – Run everything behind your internal network, with no inbound public endpoints if desired.
  • Cost predictability and control – Use your own infrastructure and scaling policies.
  • Integration with internal tools – Connect Langtrace directly to your internal LLM gateways, vector databases, and logging stack.

Langtrace already supports a wide range of LLM frameworks (CrewAI, DSPy, LlamaIndex, LangChain) and multiple LLM providers and vector databases, so a self-hosted deployment is mostly about where the backend runs and how you connect your SDKs to it.


High-level architecture of a self-hosted Langtrace deployment

A typical private Langtrace deployment usually contains the following components:

  1. Langtrace API / ingestion service

    • Receives traces and telemetry from your apps via the Langtrace SDK.
    • Exposed via HTTPS inside your network or via a private load balancer.
  2. Web UI / dashboard

    • Web app your team uses to explore traces, latency, costs, and model performance.
    • Often served by the same backend service or as a separate frontend container.
  3. Database

    • Stores projects, traces, spans, metadata, and configuration.
    • Common choices: PostgreSQL for transactional data; optionally a search or analytics engine for trace queries, depending on the deployment flavor.
  4. Background workers / schedulers (optional but common)

    • For async tasks such as aggregation, cleanup, and longer‑running evaluations.
  5. Authentication and access control

    • Either Langtrace’s built-in auth (if provided in your chosen deployment) or integration with your SSO/IdP (OAuth/OIDC/SAML).
  6. Observability stack

    • Logs, metrics, and traces for Langtrace itself (e.g., via Prometheus/Grafana, OpenTelemetry collectors, or your existing logging platform).

The exact topology depends on which deployment option you choose.


Deployment options for running Langtrace privately

Even though implementation details may differ, most teams end up in one of these categories:

1. Single-node Docker deployment (for evaluation & small teams)

Best for:

  • Quick internal trials or POCs.
  • Small teams with moderate traffic.
  • Simpler infra with minimal moving parts.

Typical setup:

  • One VM (e.g., EC2, GCE, Azure VM, or on‑prem server).
  • Docker or Docker Compose running:
    • Langtrace backend (API + UI).
    • PostgreSQL (or another supported DB).
    • Optional reverse proxy (Nginx, Traefik) for TLS termination.

Pros:

  • Fastest way to get private Langtrace running.
  • Simple backup/restore if DB is on the same node.
  • Minimal infra knowledge needed.

Cons:

  • Single point of failure.
  • Scaling is vertical (bigger machine) rather than horizontal.
  • Not ideal for strict HA or large production workloads.

Example infra baseline:

  • 4 vCPUs, 8–16 GB RAM, 100–200 GB SSD.
  • Private IP range in your VPC.
  • Security group allowing:
    • HTTPS from your app servers,
    • SSH/RDP for admin (or better: use SSM/bastion).

2. Kubernetes / container orchestration (for production at scale)

Best for:

  • Production workloads with multiple teams and apps.
  • Need for autoscaling, rolling upgrades, and high availability.
  • Existing Kubernetes or container orchestration maturity.

Typical setup:

  • Langtrace deployed as a set of Kubernetes workloads:
    • langtrace-api (Deployment + Service).
    • langtrace-ui (if split from the API).
    • langtrace-worker / cron (for background jobs).
  • Managed database:
    • Amazon RDS, Cloud SQL, Azure Database for PostgreSQL, or self-managed Postgres in the cluster (for smaller setups).
  • Optional managed cache or message bus (e.g., Redis) if required by your chosen deployment.

Pros:

  • Horizontal scaling via replicas.
  • Rolling deployments and easy rollback.
  • Pod-level resource isolation and quotas.

Cons:

  • Higher operational complexity.
  • Requires Kubernetes knowledge and observability practices.

Example infra baseline:

  • Cluster with at least 3 worker nodes (to tolerate node failures).
  • Node size: 2–4 vCPUs, 8–16 GB RAM each for initial setups.
  • Managed Postgres with:
    • 2–4 vCPUs, 16+ GB RAM,
    • SSD storage tuned for expected write volume (traces can be write-heavy).

Networking:

  • Internal load balancer exposing langtrace-api via HTTPS, accessible only from your app subnets or via internal DNS.
  • Optionally a separate internal endpoint for the UI for your users.

3. Private cloud deployment with managed DB (for teams without K8s)

Best for:

  • Teams that don’t want Kubernetes but do need HA.
  • Multi-node, production deployments using VMs and managed services.

Typical setup:

  • 2–3 application VMs behind an internal load balancer:
    • Docker-installed Langtrace backend on each VM.
  • Managed database (PostgreSQL) in the same VPC/region.
  • Optional managed cache (Redis) or message queue.

Pros:

  • High availability with simpler tooling than K8s.
  • Easier to reason about than a full cluster.

Cons:

  • Manual scaling and rolling deployments unless automated via scripts/CI.
  • You maintain more of the app lifecycle yourself.

Example infra baseline:

  • 2–3 x VM (4 vCPUs, 8–16 GB RAM, 100 GB SSD).
  • Managed Postgres as above.
  • Internal L4/L7 load balancer distributing both API and UI traffic.

4. On‑premises / air‑gapped deployment

Best for:

  • Highly regulated environments with no outbound Internet.
  • On‑prem data centers or private clouds.

Typical setup:

  • Similar to single‑node or multi‑VM deployment, but:
    • All images and dependencies mirrored into your local registry.
    • OS packages and TLS handled via your internal PKI.
    • No external telemetry calls.

Infra considerations:

  • Local artifact registry (Harbor, Nexus, Artifactory, etc.).
  • Internal DNS and certificate management.
  • Strict firewall rules; you may choose to allow only outbound traffic for OS updates or none at all.

Infrastructure requirements for self-hosting Langtrace

Exact sizing depends heavily on:

  • Number of LLM calls per day.
  • Number of applications and environments (dev/staging/prod).
  • Retention period for traces.
  • Whether you run evaluations or advanced analytics.

Below is a general checklist to plan your infra.

1. Compute

For small to medium teams:

  • CPU: Start with 2–4 vCPUs for the app, scale as ingestion grows.
  • RAM: 8–16 GB for the app node(s).
  • Autoscaling: In K8s, configure HPA on CPU and/or request queue metrics.

For larger deployments:

  • Multiple app replicas across nodes.
  • Potential separation of:
    • Ingestion/API pods,
    • UI pods,
    • Background workers.

2. Storage and database

Langtrace needs a durable store for:

  • Project metadata.
  • Traces, spans, and events.
  • User accounts and configuration.

Database recommendations:

  • Use PostgreSQL (or another supported DB if documented).
  • Start with:
    • 2–4 vCPUs,
    • 16–32 GB RAM,
    • 200+ GB SSD, autoscaling enabled.
  • Enable:
    • Regular backups,
    • Point-in-time recovery,
    • Monitoring for CPU/IOps and connection count.

Storage growth planning:

  • Estimate data volume as:
    (# LLM calls per day) x (average trace size) x (retention days)
  • Add headroom (e.g., 2–3x) for indexing and future features.

3. Networking & security

Key requirements:

  • Langtrace API endpoint available to:
    • Your app servers (where Langtrace SDK runs).
    • Internal tools or services that need to query traces.

Security best practices:

  • TLS for all traffic (use internal CA or managed certificates).
  • Private networking:
    • Deploy inside your VPC or private subnet.
    • Use internal load balancers, not public, unless you explicitly need remote access.
  • Firewall/Security groups:
    • Restrict Langtrace ingress to trusted subnets or service accounts.
  • Auth & SSO:
    • Integrate with your IdP if Langtrace supports OIDC/SAML.
    • Enforce RBAC so only appropriate teams see certain projects.

4. Identity and access management

For a private deployment, decide:

  • How you want users to sign in:
    • Internal SSO (Okta, Azure AD, Google Workspace, etc.).
    • Local accounts managed within Langtrace.
  • How you want to segment access:
    • Per-project permissions,
    • Environment-based (dev/staging/prod) separation.

Implement this early to avoid mixing sensitive production traces with open access.


Connecting your apps to a self-hosted Langtrace

Regardless of the deployment option, wiring your applications is similar:

  1. Create a project and API key

    • In your self-hosted Langtrace UI, create a new project.
    • Generate an API key scoped to that project.
  2. Install the Langtrace SDK

    • Add the appropriate SDK to your application (Python, JS, or language/framework of choice).
    • Langtrace supports popular frameworks like CrewAI, DSPy, LlamaIndex, and LangChain; follow the framework-specific instructions in the docs.
  3. Configure the endpoint and key

    • Point the SDK to your private Langtrace URL, e.g.:
      https://langtrace.internal.yourcompany.com
    • Pass the API key securely via environment variables or your secret manager.
  4. Deploy and verify traces

    • Roll out to dev or staging first.
    • Use the UI to confirm traces, latencies, and spans appear as expected.

Security and compliance considerations

When running Langtrace privately, you control the security perimeter. Some additional practices to consider:

  • Data classification

    • Decide which environments send traces to Langtrace (dev/staging/prod).
    • Mask or omit extremely sensitive fields (PII, PHI) at the SDK or application level if necessary.
  • Audit logging

    • Route Langtrace’s own logs to your centralized logging system.
    • Monitor admin actions, configuration changes, and project access.
  • Backups and disaster recovery

    • Ensure your database and configuration are regularly backed up.
    • Test restore procedures periodically.
  • Version and patch management

    • Track Langtrace releases and changelog.
    • Regularly update containers or packages to include security patches.

Choosing the right deployment option for your team

You can use this quick decision guide:

  • Just getting started / POC
    • Single-node Docker or docker-compose on a small VM.
  • Stable internal tool for a few teams
    • Multi-VM deployment with managed DB, internal LB.
  • Mission‑critical, organization‑wide observability
    • Kubernetes deployment, managed Postgres, dedicated observability stack.
  • Highly regulated, no Internet
    • On‑prem / air‑gapped variant of Docker or K8s with internal registries.

Regardless of choice, the main infra building blocks stay consistent: compute for the API/UI, durable storage for traces, secure networking, and integration with your existing auth and monitoring tools.


Next steps

To move from planning to implementation:

  1. Decide on your deployment flavor (Docker, VMs, K8s, or on‑prem).
  2. Allocate initial infra based on expected LLM call volume.
  3. Set up Langtrace using the official installation docs for your chosen environment.
  4. Create a project and API key and integrate the SDK into a non‑prod app.
  5. Iterate on scaling, retention, and security as usage grows.

If you need specifics like Docker images, Helm charts, or reference Terraform modules, check the Langtrace documentation and GitHub repository for the latest self-hosting instructions and sample configurations.