설치 과정
github에서 하위 파일 3개를 원하는 위치에 복사하여 가져옵니다.
- docker-compose.yaml
- users.xml
- .env.example
* .env.example 파일은 .env로 이름을 변경하여 사용
* user.xml 파일은 그대로 사용 했습니다.
본 포스팅에서는 /data001/langsmith 경로에서 생성 및 진행했습니다.
# docker-compose.yaml
services:
langchain-playground:
image: langchain/langsmith-playground:${_LANGSMITH_IMAGE_VERSION}
ports:
- 3001:3001
langchain-frontend:
image: langchain/langsmith-frontend:${_LANGSMITH_IMAGE_VERSION}
environment:
- VITE_BACKEND_AUTH_TYPE=${AUTH_TYPE}
- VITE_OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID}
- VITE_OAUTH_ISSUER_URL=${OAUTH_ISSUER_URL}
ports:
- 1980:1980
depends_on:
- langchain-backend
- langchain-playground
langchain-backend:
image: langchain/langsmith-backend:${_LANGSMITH_IMAGE_VERSION}
environment:
- PORT=1984
- LANGCHAIN_ENV=local_docker
- GO_ENDPOINT=http://langchain-platform-backend:1986
- SMITH_BACKEND_ENDPOINT=http://langchain-backend:1984
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
- LOG_LEVEL=${LOG_LEVEL}
- AUTH_TYPE=${AUTH_TYPE}
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID}
- OAUTH_ISSUER_URL=${OAUTH_ISSUER_URL}
- API_KEY_SALT=${API_KEY_SALT}
- X_SERVICE_AUTH_JWT_SECRET=${API_KEY_SALT}
- POSTGRES_DATABASE_URI=${POSTGRES_DATABASE_URI}
- REDIS_DATABASE_URI=${REDIS_DATABASE_URI}
- CLICKHOUSE_HOST=${CLICKHOUSE_HOST}
- CLICKHOUSE_USER=${CLICKHOUSE_USER}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD}
- CLICKHOUSE_DB=${CLICKHOUSE_DB}
- CLICKHOUSE_PORT=${CLICKHOUSE_PORT}
- CLICKHOUSE_TLS=${CLICKHOUSE_TLS}
- FF_ORG_CREATION_DISABLED=${ORG_CREATION_DISABLED}
- FF_TRACE_TIERS_ENABLED=${TTL_ENABLED}
- FF_UPGRADE_TRACE_TIER_ENABLED=${TTL_ENABLED}
- FF_S3_STORAGE_ENABLED=${BLOB_STORAGE_ENABLED}
- S3_BUCKET_NAME=${BLOB_STORAGE_BUCKET_NAME}
- S3_RUN_MANIFEST_BUCKET_NAME=${BLOB_STORAGE_BUCKET_NAME}
- S3_API_URL=${BLOB_STORAGE_API_URL}
- S3_ACCESS_KEY=${BLOB_STORAGE_ACCESS_KEY}
- S3_ACCESS_KEY_SECRET=${BLOB_STORAGE_ACCESS_KEY_SECRET}
- FF_CH_SEARCH_ENABLED=${CH_SEARCH_ENABLED}
- BASIC_AUTH_ENABLED=${BASIC_AUTH_ENABLED}
- BASIC_AUTH_JWT_SECRET=${BASIC_AUTH_JWT_SECRET}
- INITIAL_ORG_ADMIN_EMAIL=${INITIAL_ORG_ADMIN_EMAIL}
- INITIAL_ORG_ADMIN_PASSWORD=${INITIAL_ORG_ADMIN_PASSWORD}
ports:
- 1984:1984
depends_on:
langchain-db:
condition: service_healthy
langchain-redis:
condition: service_healthy
clickhouse-setup:
condition: service_completed_successfully
postgres-setup:
condition: service_completed_successfully
restart: always
langchain-platform-backend:
image: langchain/langsmith-go-backend:${_LANGSMITH_IMAGE_VERSION}
environment:
- PORT=1986
- LANGCHAIN_ENV=local_docker
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- LOG_LEVEL=${LOG_LEVEL}
- AUTH_TYPE=${AUTH_TYPE}
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID}
- OAUTH_ISSUER_URL=${OAUTH_ISSUER_URL}
- API_KEY_SALT=${API_KEY_SALT}
- X_SERVICE_AUTH_JWT_SECRET=${API_KEY_SALT}
- POSTGRES_DATABASE_URI=${POSTGRES_DATABASE_URI}
- REDIS_DATABASE_URI=${REDIS_DATABASE_URI}
- BASIC_AUTH_ENABLED=${BASIC_AUTH_ENABLED}
- BASIC_AUTH_JWT_SECRET=${BASIC_AUTH_JWT_SECRET}
ports:
- 1986:1986
depends_on:
langchain-db:
condition: service_healthy
langchain-redis:
condition: service_healthy
clickhouse-setup:
condition: service_completed_successfully
postgres-setup:
condition: service_completed_successfully
restart: always
langchain-queue:
image: langchain/langsmith-backend:${_LANGSMITH_IMAGE_VERSION}
environment:
- LANGCHAIN_ENV=local_docker
- GO_ENDPOINT=http://langchain-platform-backend:1986
- SMITH_BACKEND_ENDPOINT=http://langchain-backend:1984
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
- LOG_LEVEL=${LOG_LEVEL}
- AUTH_TYPE=${AUTH_TYPE}
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID}
- OAUTH_ISSUER_URL=${OAUTH_ISSUER_URL}
- API_KEY_SALT=${API_KEY_SALT}
- X_SERVICE_AUTH_JWT_SECRET=${API_KEY_SALT}
- POSTGRES_DATABASE_URI=${POSTGRES_DATABASE_URI}
- REDIS_DATABASE_URI=${REDIS_DATABASE_URI}
- CLICKHOUSE_HOST=${CLICKHOUSE_HOST}
- CLICKHOUSE_USER=${CLICKHOUSE_USER}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD}
- CLICKHOUSE_DB=${CLICKHOUSE_DB}
- CLICKHOUSE_PORT=${CLICKHOUSE_PORT}
- CLICKHOUSE_TLS=${CLICKHOUSE_TLS}
- FF_ORG_CREATION_DISABLED=${ORG_CREATION_DISABLED}
- FF_TRACE_TIERS_ENABLED=${TTL_ENABLED}
- FF_UPGRADE_TRACE_TIER_ENABLED=${TTL_ENABLED}
- FF_S3_STORAGE_ENABLED=${BLOB_STORAGE_ENABLED}
- S3_BUCKET_NAME=${BLOB_STORAGE_BUCKET_NAME}
- S3_RUN_MANIFEST_BUCKET_NAME=${BLOB_STORAGE_BUCKET_NAME}
- S3_API_URL=${BLOB_STORAGE_API_URL}
- S3_ACCESS_KEY=${BLOB_STORAGE_ACCESS_KEY}
- S3_ACCESS_KEY_SECRET=${BLOB_STORAGE_ACCESS_KEY_SECRET}
- FF_CH_SEARCH_ENABLED=${CH_SEARCH_ENABLED}
- BASIC_AUTH_ENABLED=${BASIC_AUTH_ENABLED}
- BASIC_AUTH_JWT_SECRET=${BASIC_AUTH_JWT_SECRET}
command:
- "saq"
- "app.workers.queues.single_queue_worker.settings"
- "--quiet"
depends_on:
langchain-db:
condition: service_healthy
langchain-redis:
condition: service_healthy
clickhouse-setup:
condition: service_completed_successfully
postgres-setup:
condition: service_completed_successfully
restart: always
langchain-db:
image: postgres:14.7
command:
[
"postgres",
"-c",
"log_min_messages=WARNING",
"-c",
"client_min_messages=WARNING",
]
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
volumes:
- /data001/langsmith/langchain-db-data:/var/lib/postgresql/data
ports:
- 5433:5432
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 2s
timeout: 2s
retries: 30
langchain-redis:
image: redis:7
ports:
- 63791:6379
volumes:
- /data001/langsmith/langchain-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 2s
retries: 30
langchain-clickhouse:
image: clickhouse/clickhouse-server:24.2
user: "101:101"
restart: always
environment:
- CLICKHOUSE_DB=${CLICKHOUSE_DB}
- CLICKHOUSE_USER=${CLICKHOUSE_USER}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD}
volumes:
- /data001/langsmith/langchain-clickhouse-data:/var/lib/clickhouse
- ./users.xml:/etc/clickhouse-server/users.d/users.xml
ports:
- 8124:8123
- 9001:9000
healthcheck:
test: ["CMD", "clickhouse-client", "--query", "SELECT 1"]
interval: 2s
timeout: 2s
retries: 30
clickhouse-setup:
image: langchain/langsmith-backend:${_LANGSMITH_IMAGE_VERSION}
depends_on:
langchain-clickhouse:
condition: service_healthy
restart: "on-failure:10"
environment:
- CLICKHOUSE_HOST=${CLICKHOUSE_HOST}
- CLICKHOUSE_USER=${CLICKHOUSE_USER}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD}
- CLICKHOUSE_DB=${CLICKHOUSE_DB}
- CLICKHOUSE_PORT=${CLICKHOUSE_PORT}
- CLICKHOUSE_NATIVE_PORT=${CLICKHOUSE_NATIVE_PORT}
- CLICKHOUSE_TLS=${CLICKHOUSE_TLS}
command:
[
"bash",
"scripts/wait_for_clickhouse_and_migrate.sh"
]
postgres-setup:
image: langchain/langsmith-backend:${_LANGSMITH_IMAGE_VERSION}
depends_on:
langchain-db:
condition: service_healthy
environment:
- LANGCHAIN_ENV=local_docker
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- LOG_LEVEL=${LOG_LEVEL}
- AUTH_TYPE=${AUTH_TYPE}
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID}
- OAUTH_ISSUER_URL=${OAUTH_ISSUER_URL}
- API_KEY_SALT=${API_KEY_SALT}
- POSTGRES_DATABASE_URI=${POSTGRES_DATABASE_URI}
- REDIS_DATABASE_URI=${REDIS_DATABASE_URI}
- MAX_ASYNC_JOBS_PER_WORKER=${MAX_ASYNC_JOBS_PER_WORKER}
- ASYNCPG_POOL_MAX_SIZE=${ASYNCPG_POOL_MAX_SIZE}
- CLICKHOUSE_HOST=${CLICKHOUSE_HOST}
- CLICKHOUSE_USER=${CLICKHOUSE_USER}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD}
- CLICKHOUSE_DB=${CLICKHOUSE_DB}
- CLICKHOUSE_PORT=${CLICKHOUSE_PORT}
- CLICKHOUSE_NATIVE_PORT=${CLICKHOUSE_NATIVE_PORT}
- CLICKHOUSE_TLS=${CLICKHOUSE_TLS}
restart: "on-failure:10"
command:
[
"bash",
"-c",
"alembic upgrade head",
]
volumes:
langchain-db-data:
langchain-redis-data:
langchain-clickhouse-data:
langchain-db, langchain-redis, langchain-clickhouse 의 volumes 경로를 원하는 위치의 절대 경로로 수정했습니다.
# env.yaml
#지정 하고자 하는 값으로 수정하여 사용
_LANGSMITH_IMAGE_VERSION=0.7.39 # Change to the desired Langsmith image version
LANGSMITH_LICENSE_KEY=*****
AUTH_TYPE=mixed # Set to oauth if you want to use OAuth2.0. Set to mixed for basic auth.
OAUTH_CLIENT_ID=your-client-id # Required if AUTH_TYPE=oauth
OAUTH_ISSUER_URL=https://your-issuer-url # Required if AUTH_TYPE=oauth
API_KEY_SALT=super # Change to your desired API key salt. Can be any random value. Must be set if AUTH_TYPE=oauth
POSTGRES_DATABASE_URI=postgres:postgres@langchain-db:5432/postgres # Change to your database URI if using external postgres. Otherwise, leave it as is
REDIS_DATABASE_URI=redis://langchain-redis:6379 # Change to your Redis URI if using external Redis. Otherwise, leave it as is
LOG_LEVEL=warning # Change to your desired log level
MAX_ASYNC_JOBS_PER_WORKER=10 # Change to your desired maximum async jobs per worker. We recommend 10/suggest spinning up more replicas of the queue worker if you need more throughput
ASYNCPG_POOL_MAX_SIZE=3 # Change the PG pool size based off your pg instance/requirements.
CLICKHOUSE_HOST=langchain-clickhouse # Change to your Clickhouse host if using external Clickhouse. Otherwise, leave it as is
CLICKHOUSE_USER=default # Change to your Clickhouse user if needed
CLICKHOUSE_DB=default # Change to your Clickhouse database if needed
CLICKHOUSE_PORT=8123 # Change to your Clickhouse port if needed
CLICKHOUSE_TLS=false # Change to true if you are using TLS to connect to Clickhouse. Otherwise, leave it as is
CLICKHOUSE_PASSWORD=**** # Change to your Clickhouse password if needed
CLICKHOUSE_NATIVE_PORT=9000 # Change to your Clickhouse native port if needed
ORG_CREATION_DISABLED=false # Set to true if you want to disable org creation
WORKSPACE_SCOPE_ORG_INVITES_ENABLED=true # Set to true if you want to disable workspace scope org invites
PERSONAL_ORGS_DISABLED=false # Set to true if you want to disable personal orgs
TTL_ENABLED=true # Set to true if you want to enable TTL for your data
SHORT_LIVED_TTL_SECONDS=1209600 # Set to your desired TTL for short-lived traces. Default is 14 days
LONG_LIVED_TTL_SECONDS=34560000 # Set to your desired TTL for long-lived traces. Default is 400 days
BLOB_STORAGE_ENABLED=false # Set to true if you want to enable blob storage
BLOB_STORAGE_BUCKET_NAME=langsmith-blob-storage # Change to your desired blob storage bucket name
BLOB_STORAGE_API_URL=https://s3.us-west-2.amazonaws.com # Change to your desired blob storage API URL
BLOB_STORAGE_ACCESS_KEY=your-access-key # Change to your desired blob storage access key
BLOB_STORAGE_ACCESS_KEY_SECRET=your-access-key-secret # Change to your desired blob storage access key secret
CH_SEARCH_ENABLED=true # Set to false if you do not want to store tokenized inputs/outputs in clickhouse
BASIC_AUTH_ENABLED=true # Set to true if you want to enable basic auth
BASIC_AUTH_JWT_SECRET=your-jwt-secret # Change to your desired basic auth JWT secret
INITIAL_ORG_ADMIN_EMAIL=admin@user.com # Change to your desired initial org admin email. Only used if BASIC_AUTH_ENABLED=true
INITIAL_ORG_ADMIN_PASSWORD=**** # Change to your desired initial org admin password. Only used if BASIC_AUTH_ENABLED=true
LANGSMITH_LICENSE_KEY, CLICKHOUSE_PASSWORD, INITIAL_ORG_ADMIN_EMAIL, INITIAL_ORG_ADMIN_PASSWORD 값은 개인 별 설정 해주면 되고 다른 옵션은 원하는 대로 수정 하면 됩니다.
# user.xml
<clickhouse>
<users>
<default>
<access_management>1</access_management>
<named_collection_control>1</named_collection_control>
<show_named_collections>1</show_named_collections>
<show_named_collections_secrets>1</show_named_collections_secrets>
<profile>default</profile>
</default>
</users>
<profiles>
<default>
<async_insert>1</async_insert>
<async_insert_max_data_size>2000000</async_insert_max_data_size>
<wait_for_async_insert>0</wait_for_async_insert>
<parallel_view_processing>1</parallel_view_processing>
<allow_simdjson>0</allow_simdjson>
</default>
</profiles>
</clickhouse>
파일 수정 후 볼륨으로 지정한 디렉터리의 권한을 755 로, langchain-clickhouse-data 의 볼륨 디렉터리는 101:101로 변경했습니다.
이후 docker-compose up -d 로 백그라운드 실행하면 Docker 가 올라오고 docker-compose logs 명령으로 로그를 확인할 수 있습니다.
볼륨으로 지정한 각 디렉터리에 데이터가 생성되고 Docker가 올라온 것을 확인할 수 있습니다.
모두 Running 상태가 되면 localhost:1980 로 Web을 확인할 수 있습니다.
'AI & Bigbata' 카테고리의 다른 글
LangSmith - LLM 디버깅, 모니터링을 위한 통합 플랫폼 (1) | 2024.09.12 |
---|---|
LangChain 이란? (1) | 2024.09.11 |