> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langtrace.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Langtrace on Railway

> Running Langtrace Client on Railway

<iframe width="560" height="315" src="https://www.youtube.com/embed/btlHaZgJOuY?utm_source=langtrace-docs&utm_medium=azure-hosting&utm_campaign=langtrace" title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen />

## Requirements

1. [Railway](https://railway.app/) account

## Resources Created

| Resource Type      | Comments                            |
| ------------------ | ----------------------------------- |
| Clickhouse Service | To store traces.                    |
| Postgres Service   | For login and dataset related info. |
| Langtrace Client   | Langtrace app with frontend.        |

## Setup

Setting up Langtrace on Railway is now effortless. Just follow these simple steps:

### Step 1: Open the Railway Template

* Navigate to the Langtrace GitHub repository and locate the “***Deploy on Railway***” button within the [README file](https://github.com/Scale3-Labs/langtrace?tab=readme-ov-file).
  [<img src="https://mintcdn.com/langtraceai-2/m7BVnnhK3Cx2yRxS/images/hosting-deploy-on-railway-button.png?fit=max&auto=format&n=m7BVnnhK3Cx2yRxS&q=85&s=c6ea0f411aa135f911b67c98e830eb43" alt="railway button" width="436" height="108" data-path="images/hosting-deploy-on-railway-button.png" />](https://railway.app/template/8dNq1c?referralCode=MA2S9H)
* Clicking on this button will direct you to the Langtrace Railway template deployment page.
  <img src="https://mintcdn.com/langtraceai-2/m7BVnnhK3Cx2yRxS/images/hosting-railway-template.png?fit=max&auto=format&n=m7BVnnhK3Cx2yRxS&q=85&s=a39dc1b761c44afbbfaef2b58b72023c" alt="railway template" width="2000" height="1154" data-path="images/hosting-railway-template.png" />

### Step 2: Configure Authentication

When deploying the template, you'll need to set up authentication for your Langtrace instance:

* Click "*Configure*" on the `langtrace-client` service.
* Add the following authentication-related environment variables:
  * `ADMIN_EMAIL`: Your desired admin email
  * `ADMIN_PASSWORD`: Your desired admin password
* For additional authentication methods (e.g., Google OAuth, Azure AD), you can add the necessary environment variables here as well. Refer to our [Authentication](/hosting/auth) guide for detailed instructions on configuring other authentication methods.
* Click "*Save Config*" **→** "*Deploy*".

### Step 3. Deploy the Template

* Click on the “*Deploy Now*” button.
* Click “*Configure*” on `langtrace-client` service and add admin email and admin password and click “*Save Config*” **→** “*Deploy*”.
  <img src="https://mintcdn.com/langtraceai-2/m7BVnnhK3Cx2yRxS/images/hosting-railway-inputs.png?fit=max&auto=format&n=m7BVnnhK3Cx2yRxS&q=85&s=8071947b1bc9b5aa0853aed5ab6344f6" alt="railway inputs" width="2860" height="1456" data-path="images/hosting-railway-inputs.png" />

### Step 4. Access Langtrace

* Once you start the deployment process, it may take around two minutes for Railway to bring up the services.

  > If you want you can check the deploy logs of a particular service by clicking on the service and click “*View Logs*” under the Deployments tab.
  >
  > <img src="https://mintcdn.com/langtraceai-2/m7BVnnhK3Cx2yRxS/images/hosting-railway-view-logs.png?fit=max&auto=format&n=m7BVnnhK3Cx2yRxS&q=85&s=bfeaa3dba7ce53b2dbeabf71f01d0f89" alt="railway logs" width="2000" height="980" data-path="images/hosting-railway-view-logs.png" />

* Once all services are healthy, click on ‘langtrace-client’ service and open the URL to access the self-hosted Langtrace application.
  <img src="https://mintcdn.com/langtraceai-2/m7BVnnhK3Cx2yRxS/images/hosting-railway-url-instruction.png?fit=max&auto=format&n=m7BVnnhK3Cx2yRxS&q=85&s=a0598f46e6934df7ded4c432fd6309fe" alt="railway url" width="2868" height="1442" data-path="images/hosting-railway-url-instruction.png" />

Login to Langtrace using the previously supplied Admin email and password, and begin your journey for monitoring LLM apps by following the [quickstart guide](/quickstart).

## Cleanup

To cleanup the resources, click on *Settings* --> *Danger Zone* --> *Delete Project*.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Clickhouse service keeps restarting or crashing ">
    This generally occurs due to low memory allocated to the clickhouse service.
    You can increase the memory allocated to the clickhouse service. This may
    require you to upgrade your Railway plan from the free tier.
  </Accordion>

  <Accordion title="Update Langtrace version">
    Click on the `langtrace-client` service --> you should be in Deployments tab --> Select Redeploy in the option of the active deployment to allow Railway to pull the latest version of the Docker image.

    **OR**

    Click on the `langtrace-client` service --> go to Settings tab -->
    disconnect --> connect image --> change [source image](https://hub.docker.com/r/scale3labs/langtrace-client/tags) to any version of your choice --> Click Deploy
    For example: `scale3labs/langtrace-client:1.3.1`

    <img src="https://mintcdn.com/langtraceai-2/m7BVnnhK3Cx2yRxS/images/hosting-railway-update-langtrace.png?fit=max&auto=format&n=m7BVnnhK3Cx2yRxS&q=85&s=19730069f135c76fc05c53e7099434d6" alt="railway update langtrace" width="1444" height="468" data-path="images/hosting-railway-update-langtrace.png" />
  </Accordion>
</AccordionGroup>
