Langsmith now uses Clickhouse to power analytics/handle runs. This means that you will need to migrate your old runs to the new database. See the Clickhouse section in values.yaml for more information.
If you don't have the repo added, run the following command to add it:
helm repo add langchain https://langchain-ai.github.io/helm/
Update your local helm repo
helm repo update
Certain versions of 0.1.x may require you to delete old deployments and statefulsets due to label changes. This will not delete any of your data
kubectl delete deployment langsmith-backend langsmith-frontend langsmith-hub-backend langsmith-playground langsmith-queue
kubectl delete statefulset langsmith-postgres langsmith-redis
Run the following command to upgrade the chart(replace x with latest patch version):
helm upgrade <release-name> langchain/langsmith --version 0.2.x --values <path-to-values-file>
Verify that the upgrade was successful:
helm status <release-name>
All pods should be in the Running
state. Verify that clickhouse is running and that both backend-migrations containers have completed.
kubectl get pods
NAME READY STATUS RESTARTS AGE
langsmith-backend-95b6d54f5-gz48b 1/1 Running 0 15h
langsmith-backend-migrations-d2z6k 0/2 Completed 0 5h48m
langsmith-clickhouse-0 1/1 Running 0 26h
langsmith-frontend-84687d9d45-6cg4r 1/1 Running 0 15h
langsmith-hub-backend-66ffb75fb4-qg6kl 1/1 Running 0 15h
langsmith-playground-85b444d8f7-pl589 1/1 Running 0 15h
langsmith-queue-d58cb64f7-87d68 1/1 Running 0 15h
-
Run
kubectl get services
Output should look something like:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE langsmith-backend ClusterIP 172.20.140.77 <none> 1984/TCP 35h langsmith-frontend LoadBalancer 172.20.253.251 <external ip> 80:31591/TCP 35h langsmith-hub-backend ClusterIP 172.20.112.234 <none> 1985/TCP 35h langsmith-playground ClusterIP 172.20.153.194 <none> 3001/TCP 9h langsmith-postgres ClusterIP 172.20.244.82 <none> 5432/TCP 35h langsmith-redis ClusterIP 172.20.81.217 <none> 6379/TCP 35h
-
Curl the external ip of the
langsmith-frontend
service:curl <external ip>/api/tenants [{"id":"00000000-0000-0000-0000-000000000000","has_waitlist_access":true,"created_at":"2023-09-13T18:25:10.488407","display_name":"Personal","config":{"is_personal":true,"max_identities":1},"tenant_handle":"default"}]%
-
Visit the external ip for the
langsmith-frontend
service on your browserThe Langsmith UI should be visible/operational
Note that old runs will not be visibile in the UI unless you migrate them. See Migrating old runs for more information. This step is only required if you need access to run data from before the upgrade to Langsmith 0.2.x. If you are unsure or need assistance, please reach out to support@langchain.dev and we'd be happy to help.
We have provided a migration script to migrate old runs from the old database to the new database. The script is located in the scripts
directory of this repository.
There is also a docker image that has the script pre-installed. You can run the script using the docker image if you don't want to install the dependencies on your local machine/need to run in your cluster.
We recommend running the migration script in docker unless you are comfortable with the prerequisites and have the required tools installed.
Ensure you have the following tools/items ready.
- Kubectl
- PostgreSQL database connection information:
- Host
- Port
- Username
- If using the bundled version, this is
postgres
- If using the bundled version, this is
- Password
- If using the bundled version, this is
postgres
- If using the bundled version, this is
- Database name
- If using the bundled version, this is
postgres
- If using the bundled version, this is
- Clickhouse database credential information
- Host
- Port
- Username
- If using the bundled version, this is
default
- If using the bundled version, this is
- Password
- If using the bundled version, this is
password
- If using the bundled version, this is
- Database name
- If using the bundled version, this is
default
- If using the bundled version, this is
Edit run_script_kubernetes.yaml and replace the command arguments with your database connection information.
Then run the following command to run the migration script:
kubectl apply -f run_script_kubernetes.yaml
Verify that the migration script has completed by running the following command. The output should show the migration script pod in the Completed
state.
kubectl get pods
NAME READY STATUS RESTARTS AGE
langsmith-backend-5497cc488-lfc9g 1/1 Running 1 (82s ago) 2m22s
langsmith-clickhouse-0 1/1 Running 0 2m20s
langsmith-frontend-5bd956c4b4-dsglq 1/1 Running 0 2m22s
langsmith-hub-backend-6956c8c9f-r9cnv 1/1 Running 2 (2m4s ago) 2m22s
langsmith-playground-77f9447db5-glf7q 1/1 Running 0 2m21s
langsmith-postgres-0 1/1 Running 0 2m20s
langsmith-queue-96cbbbfdd-s4qb7 1/1 Running 1 (2m12s ago) 2m21s
langsmith-queue-96cbbbfdd-w7kt9 1/1 Running 1 (2m10s ago) 2m21s
langsmith-queue-96cbbbfdd-zp4sq 1/1 Running 1 (2m10s ago) 2m21s
langsmith-redis-0 1/1 Running 0 2m20s
run-script-job-7bg6t 0/1 Completed 0 47s
Verify that the logs of the migration script pod show that the migration was successful.
kubectl logs run-script-job-7bg6t
ClickHouse runs insertion completed.
No feedback to migrate. No data inserted into ClickHouse.
If you visit the Langsmith UI, you should now see your old runs.
Ensure you have the following tools/items ready.
-
PostgreSQL client
-
Clickhouse client
-
PostgreSQL database connection:
- Host
- Port
- Username
- If using the bundled version, this is
postgres
- If using the bundled version, this is
- Password
- If using the bundled version, this is
postgres
- If using the bundled version, this is
- Database name
- If using the bundled version, this is
postgres
- If using the bundled version, this is
-
Clickhouse database credentials
- Host
- Port
- Username
- If using the bundled version, this is
default
- If using the bundled version, this is
- Password
- If using the bundled version, this is
password
- If using the bundled version, this is
- Database name
- If using the bundled version, this is
default
- If using the bundled version, this is
-
Connectivity to the PostgreSQL database from the machine you will be running the migration script on.
- If you are using the bundled version, you may need to port forward the postgresql service to your local machine.
- Run
kubectl port-forward svc/langsmith-postgres 5432:5432
to port forward the postgresql service to your local machine.
-
Connectivity to the Clickhouse database from the machine you will be running the migration script on.
- If you are using the bundled version, you may need to port forward the clickhouse service to your local machine.
- Run
kubectl port-forward svc/langsmith-clickhouse 9000:9000
to port forward the clickhouse service to your local machine.
Run the following command to run the migration script:
sh backfill_clickhouse.sh <postgres connection url> <clickhouse connection url>
For example, if you are using the bundled version with port-forwarding, the command would look like:
sh backfill_clickhouse.sh "postgres://postgres:postgres@localhost:5432/postgres" "clickhouse://default:password@localhost:9000/default"
If you visit the Langsmith UI, you should now see your old runs.