Skip to main content

Steps

Make sure Docker and Docker compose versions are newer. To verify the versions, run the following commands: For docker docker --version and for docker compose docker compose --version

Step 1: Clone the repository

Clone the repository using the following command:
git clone https://github.com/Scale3-Labs/langtrace
cd langtrace

Step 2: Configure environment variables

Repo already has .env file for common usecases, modify this file to suit your needs.

Authentication Configuration

Langtrace supports multiple authentication methods. Make sure to configure the necessary environment variables for your chosen authentication method(s) in the .env file. For detailed instructions, refer to our Authentication guide.

Step 3: Start the services

docker compose up -d
The application will be available at http://localhost:3000.
if you wish to build the docker image locally and use it, run the docker compose up command with the --build flag.

Step 4: Stop the services

To delete containers and volumes
Bash
docker compose down -v
-v flag is used to delete volumes.
Deleting the volumes also wipes out the data stored in postgres and clickhouse.

Useful Ops Commands

To connect to the postgres db, run the following command:
docker exec -it langtrace-postgres psql --dbname=langtrace --username=ltuser --password
To connect to the clickhouse db, run the following command:
docker exec -it langtrace-clickhouse clickhouse-client
To view the logs of the Next JS app, run the following command:
docker logs langtrace
If you want to follow the logs, run the following command:
docker logs -f langtrace
To create tables manually
docker exec -it langtrace npm run create-tables

Troubleshooting

The following are some common issues that you may face while setting up langtrace using docker compose
Its likely that schema is not applied to the database or the schema is not in sync with the database. To fix this, run the following command:
docker exec -it langtrace npm run create-tables
If you have made changes to the prisma schema and want to apply the changes to the database, run the following command:
docker exec -it langtrace npm run create-tables
Its likely that you are using an older version of docker-compose. Update docker-compose to the latest version. Certain docker compose schema used in this project are only supported in newer versions of docker-compose. Either you update the docker compose version OR remove the depends_on property that maybe causing the error.
If clickhouse server is not starting, it is likely that the port 8123 is already in use. You can change the port in the docker-compose file.

Next Steps

After setting up Langtrace using Docker Compose, ensure that you’ve properly configured your chosen authentication method(s) and created the necessary user accounts. Refer to the Authentication guide for detailed instructions on setting up and managing authentication.
I