langfuse v3(docker compose安装)安装部署

环境:
OS:Centos 7
langfuse:v3

1.下载docker compose配置文件
https://github.com/langfuse/langfuse/blob/v3.5.3/docker-compose.yml


[root@host135 home]# mkdir -p /home/middle/langfuse/langfuse
上传配置文件到该目录
[root@host135 langfuse]# ls
docker-compose.yml
[root@host135 langfuse]# pwd
/home/middle/langfuse/langfuse

注意官网的配置文件配置外挂目录有问题,特别是minio
配置文件中是把 /data 外挂出来,实际是/minio_data,好像有些时候是/data,同时注意pg使用不同的镜像,数据目录外挂的目录也不一样
pg官网制作的镜像数据目录是:/var/lib/postgresql/data,其他的镜像有可能不是这个目录,会导致外挂出来的目录是空的.


2.修改配置文件
修改为自己的镜像

clickhouse:需要24.3以上版本
redis:需要redis 7以上版本
minio:使用最新版本,RELEASE.2023-03-20T20-16-18Z 不适用了
postgresql:需要pg12以上版本

 

最后的配置文件如下:

 配置文件尽量从项目文档下载后进行修改,不要复制粘贴,避免不必要的错误

资源清单文件下载地址:

https://github.com/langfuse/langfuse/blob/v3.6.0/docker-compose.yml

 

复制代码
[root@host135 langfuse]# more v3_docker-compose.yml 
services:
  langfuse-worker:
    image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/langfuse-worker:3.6.0
    restart: always
    depends_on: &langfuse-depends-on
      postgres:
        condition: service_healthy
      minio:
        condition: service_healthy
      redis:
        condition: service_healthy
      clickhouse:
        condition: service_healthy
    ports:
      - "3030:3030"
    environment: &langfuse-worker-env
      DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres
      SALT: "mysalt"
      ENCRYPTION_KEY: "0000000000000000000000000000000000000000000000000000000000000000" # generate via `openssl ran
d -hex 32`
      TELEMETRY_ENABLED: ${TELEMETRY_ENABLED:-true}
      LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES: ${LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES:-true}
      CLICKHOUSE_MIGRATION_URL: ${CLICKHOUSE_MIGRATION_URL:-clickhouse://clickhouse:9000}
      CLICKHOUSE_URL: ${CLICKHOUSE_URL:-http://clickhouse:8123}
      CLICKHOUSE_USER: ${CLICKHOUSE_USER:-clickhouse}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-clickhouse}
      CLICKHOUSE_CLUSTER_ENABLED: ${CLICKHOUSE_CLUSTER_ENABLED:-false}
      LANGFUSE_S3_EVENT_UPLOAD_BUCKET: ${LANGFUSE_S3_EVENT_UPLOAD_BUCKET:-langfuse}
      LANGFUSE_S3_EVENT_UPLOAD_REGION: ${LANGFUSE_S3_EVENT_UPLOAD_REGION:-auto}
      LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID: ${LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID:-minio}
      LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY: ${LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY:-miniosecret}
      LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT: ${LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT:-http://minio:9000}
      LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE: ${LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE:-true}
      LANGFUSE_S3_EVENT_UPLOAD_PREFIX: ${LANGFUSE_S3_EVENT_UPLOAD_PREFIX:-events/}
      LANGFUSE_S3_MEDIA_UPLOAD_BUCKET: ${LANGFUSE_S3_MEDIA_UPLOAD_BUCKET:-langfuse}
      LANGFUSE_S3_MEDIA_UPLOAD_REGION: ${LANGFUSE_S3_MEDIA_UPLOAD_REGION:-auto}
      LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID: ${LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID:-minio}
      LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY: ${LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY:-miniosecret}
      LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT: ${LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT:-http://minio:9000}
      LANGFUSE_S3_MEDIA_UPLOAD_FORCE_PATH_STYLE: ${LANGFUSE_S3_MEDIA_UPLOAD_FORCE_PATH_STYLE:-true}
      LANGFUSE_S3_MEDIA_UPLOAD_PREFIX: ${LANGFUSE_S3_MEDIA_UPLOAD_PREFIX:-media/}
      REDIS_HOST: ${REDIS_HOST:-redis}
      REDIS_PORT: ${REDIS_PORT:-6379}
      REDIS_AUTH: ${REDIS_AUTH:-myredissecret}

  langfuse-web:
    image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/langfuse:3.6.0
    restart: always
    depends_on: *langfuse-depends-on
    ports:
      - "3000:3000"
    environment:
      <<: *langfuse-worker-env
      NEXTAUTH_URL: http://localhost:3000
      NEXTAUTH_SECRET: mysecret
      LANGFUSE_INIT_ORG_ID: ${LANGFUSE_INIT_ORG_ID:-}
      LANGFUSE_INIT_ORG_NAME: ${LANGFUSE_INIT_ORG_NAME:-}
      LANGFUSE_INIT_PROJECT_ID: ${LANGFUSE_INIT_PROJECT_ID:-}
      LANGFUSE_INIT_PROJECT_NAME: ${LANGFUSE_INIT_PROJECT_NAME:-}
      LANGFUSE_INIT_PROJECT_PUBLIC_KEY: ${LANGFUSE_INIT_PROJECT_PUBLIC_KEY:-}
      LANGFUSE_INIT_PROJECT_SECRET_KEY: ${LANGFUSE_INIT_PROJECT_SECRET_KEY:-}
      LANGFUSE_INIT_USER_EMAIL: ${LANGFUSE_INIT_USER_EMAIL:-}
      LANGFUSE_INIT_USER_NAME: ${LANGFUSE_INIT_USER_NAME:-}
      LANGFUSE_INIT_USER_PASSWORD: ${LANGFUSE_INIT_USER_PASSWORD:-}
      LANGFUSE_SDK_CI_SYNC_PROCESSING_ENABLED: ${LANGFUSE_SDK_CI_SYNC_PROCESSING_ENABLED:-false}
      LANGFUSE_READ_FROM_POSTGRES_ONLY: ${LANGFUSE_READ_FROM_POSTGRES_ONLY:-false}
      LANGFUSE_READ_FROM_CLICKHOUSE_ONLY: ${LANGFUSE_READ_FROM_CLICKHOUSE_ONLY:-true}
      LANGFUSE_RETURN_FROM_CLICKHOUSE: ${LANGFUSE_RETURN_FROM_CLICKHOUSE:-true}

  clickhouse:
    image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/clickhouse-server:24.8
    restart: always
    container_name: clickhouse
    hostname: clickhouse
    environment:
      CLICKHOUSE_DB: default
      CLICKHOUSE_USER: clickhouse
      CLICKHOUSE_PASSWORD: clickhouse
    volumes:
      - /home/middle/langfuse/clickhouse_data:/var/lib/clickhouse
      - /home/middle/langfuse/clickhouse_logs:/var/log/clickhouse-server
    ports:
      - "8123:8123"
      - "9000:9000"
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1
      interval: 5s
      timeout: 5s
      retries: 10
      start_period: 1s

  minio:
    image: minio:RELEASE.2024-12-18T13-15-44Z
    restart: always
    container_name: minio
    entrypoint: sh
    # create the 'langfuse' bucket before starting the service
    command: -c 'mkdir -p /data/langfuse && minio server --address ":9000" --console-address ":9001" /data'
    environment:
      MINIO_ROOT_USER: minio
      MINIO_ROOT_PASSWORD: miniosecret
    ports:
      - "9090:9000"
      - "9091:9001"
    volumes:
      - /home/middle/langfuse/minio_data:/minio_data
    healthcheck:
      test: ["CMD", "mc", "ready", "local"]
      interval: 1s
      timeout: 5s
      retries: 5
      start_period: 1s

  redis:
    image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/redis:7.4
    restart: always
    command: >
      --requirepass ${REDIS_AUTH:-myredissecret}
    ports:
      - 6379:6379
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 3s
      timeout: 10s
      retries: 10

  postgres:
    image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/postgresql:16.4.0
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 3s
      timeout: 3s
      retries: 10
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
    ports:
      - 5432:5432
    volumes:
      - /home/middle/langfuse/pgdata:/var/lib/postgresql/data 
复制代码

 

 

 

3.创建clickhousehe外挂数据和日志目录,minio,postgresql的外挂数据目录

mkdir -p /home/middle/langfuse/clickhouse_data
mkdir -p /home/middle/langfuse/clickhouse_logs
mkdir -p /home/middle/langfuse/minio_data
mkdir -p /home/middle/langfuse/pgdata

 

4.再次修改配置文件
将相应的外挂目录修改为刚才创建的

 

5.启动
[root@host135 langfuse]# pwd
/home/middle/langfuse/langfuse
[root@host135 langfuse]# docker compose up -d

 

6.查看运行情况

复制代码
[root@host135 langfuse]# docker compose ps
NAME                         IMAGE                                                             COMMAND                  SERVICE           CREATED         STATUS                   PORTS
clickhouse                   registry.cn-shenzhen.aliyuncs.com/hxlk8s/clickhouse-server:24.8   "/entrypoint.sh"         clickhouse        4 minutes ago   Up 4 minutes (healthy)   0.0.0.0:8123->8123/tcp, :::8123->8123/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 9009/tcp
langfuse-langfuse-web-1      registry.cn-shenzhen.aliyuncs.com/hxlk8s/langfuse:3               "dumb-init -- ./web/…"   langfuse-web      4 minutes ago   Up 4 minutes             0.0.0.0:3000->3000/tcp, :::3000->3000/tcp
langfuse-langfuse-worker-1   registry.cn-shenzhen.aliyuncs.com/hxlk8s/langfuse-worker:3        "dumb-init -- ./work…"   langfuse-worker   4 minutes ago   Up 4 minutes             0.0.0.0:3030->3030/tcp, :::3030->3030/tcp
langfuse-postgres-1          registry.cn-shenzhen.aliyuncs.com/hxlk8s/postgresql:16.4.0        "/opt/bitnami/script…"   postgres          4 minutes ago   Up 4 minutes (healthy)   0.0.0.0:5432->5432/tcp, :::5432->5432/tcp
langfuse-redis-1             registry.cn-shenzhen.aliyuncs.com/hxlk8s/redis:7.4                "docker-entrypoint.s…"   redis             4 minutes ago   Up 4 minutes (healthy)   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp
minio                        minio:latest                                                      "sh -c 'mkdir -p /da…"   minio             4 minutes ago   Up 4 minutes (healthy)   0.0.0.0:9090->9000/tcp, :::9090->9000/tcp, 0.0.0.0:9091->9001/tcp, :::9091->9001/tcp
复制代码

 

7.浏览器访问
http://192.168.1.135:3000

 

 

 

 

8.登录各组件

redis

(找一台安装了redis客户端的机器上即可执行)
/usr/local/services/redis/bin/redis-cli -h 192.168.1.135 -p 6379 -a myredissecret
这里的-a 密码是在yaml文件里定义的

发现docker 运行的是没有配置文件的
192.168.1.135:6379> config set maxmemory-policy allkeys-lfu
OK
192.168.1.135:6379> config rewrite
(error) ERR The server is running without a config file

 

clickhouse:

复制代码
clickhouse-client -h 192.168.1.135 -m -u clickhouse --password clickhouse --port=9000

clickhouse :) use default;

USE default

Query id: d564b17a-985e-4ed7-95a3-d866bd008be0

Ok.

0 rows in set. Elapsed: 0.003 sec. 

clickhouse :) show tables;

SHOW TABLES

Query id: 06c99406-d3ee-4006-8983-98f187a1fac5

┌─name──────────────┐
│ observations      │
│ schema_migrations │
│ scores            │
│ traces            │
└───────────────────┘

4 rows in set. Elapsed: 0.008 sec. 
复制代码

 

postgresql:

复制代码
密码也是:postgresql
[root@host135 bin]# /opt/pg16/bin/psql -h 192.168.1.135 -U postgres -p5432
Password for user postgres: 
psql (16.4)
Type "help" for help.

postgres=# \dt
                  List of relations
 Schema |           Name           | Type  |  Owner   
--------+--------------------------+-------+----------
 public | Account                  | table | postgres
 public | Session                  | table | postgres
 public | _prisma_migrations       | table | postgres
 public | annotation_queue_items   | table | postgres
 public | annotation_queues        | table | postgres
 public | api_keys                 | table | postgres
 public | audit_logs               | table | postgres
 public | background_migrations    | table | postgres
 public | batch_exports            | table | postgres
 public | comments                 | table | postgres
 public | cron_jobs                | table | postgres
 public | dataset_items            | table | postgres
 public | dataset_run_items        | table | postgres
 public | dataset_runs             | table | postgres
 public | datasets                 | table | postgres
 public | eval_templates           | table | postgres
 public | events                   | table | postgres
 public | job_configurations       | table | postgres
 public | job_executions           | table | postgres
 public | llm_api_keys             | table | postgres
 public | media                    | table | postgres
 public | membership_invitations   | table | postgres
 public | models                   | table | postgres
 public | observation_media        | table | postgres
 public | observations             | table | postgres
 public | organization_memberships | table | postgres
 public | organizations            | table | postgres
 public | posthog_integrations     | table | postgres
 public | prices                   | table | postgres
 public | project_memberships      | table | postgres
 public | projects                 | table | postgres
 public | prompts                  | table | postgres
 public | score_configs            | table | postgres
 public | scores                   | table | postgres
 public | sso_configs              | table | postgres
 public | trace_media              | table | postgres
 public | trace_sessions           | table | postgres
 public | traces                   | table | postgres
 public | users                    | table | postgres
 public | verification_tokens      | table | postgres
复制代码

 

minio:

http://192.168.1.135:9091/login

这里的端口是9091,不是默认的9001

 

 

用户名和密码是:minio/miniosecret

 

 

posted @   slnngk  阅读(167)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2023-01-09 配置ssh等效连接(ssh-copy-id)
2019-01-09 rman备份例子
点击右上角即可分享
微信分享提示