2023-05-15 08:51:32 +08:00
version : '3.1'
services :
# API service
api :
2023-12-19 14:08:47 +08:00
image : langgenius/dify-api:0.3.34
2023-05-15 08:51:32 +08:00
restart : always
environment :
# Startup mode, 'api' starts the API server.
MODE : api
# The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
LOG_LEVEL : INFO
# A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`.
SECRET_KEY : sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
2023-07-14 11:19:26 +08:00
# The base URL of console application web frontend, refers to the Console base URL of WEB service if console domain is
2023-05-16 22:01:29 +08:00
# different from api or web app domain.
# example: http://cloud.dify.ai
2023-07-14 11:19:26 +08:00
CONSOLE_WEB_URL : ''
# The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
# different from api or web app domain.
# example: http://cloud.dify.ai
CONSOLE_API_URL : ''
2023-11-13 22:05:46 +08:00
# The URL prefix for Service API endpoints, refers to the base URL of the current API service if api domain is
2023-05-16 22:01:29 +08:00
# different from console domain.
# example: http://api.dify.ai
2023-07-14 11:19:26 +08:00
SERVICE_API_URL : ''
2023-11-13 22:05:46 +08:00
# The URL prefix for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
2023-07-14 11:19:26 +08:00
# console or api domain.
# example: http://udify.app
APP_API_URL : ''
2023-11-13 22:05:46 +08:00
# The URL prefix for Web APP frontend, refers to the Web App base URL of WEB service if web app domain is different from
2023-05-16 22:01:29 +08:00
# console or api domain.
# example: http://udify.app
2023-07-14 11:19:26 +08:00
APP_WEB_URL : ''
2023-11-13 22:05:46 +08:00
# File preview or download Url prefix.
# used to display File preview or download Url to the front-end or as Multi-model inputs;
# Url is signed and has expiration time.
FILES_URL : ''
2023-05-15 08:51:32 +08:00
# When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed.
MIGRATION_ENABLED : 'true'
# The configurations of postgres database connection.
# It is consistent with the configuration in the 'db' service below.
DB_USERNAME : postgres
DB_PASSWORD : difyai123456
DB_HOST : db
DB_PORT : 5432
DB_DATABASE : dify
# The configurations of redis connection.
# It is consistent with the configuration in the 'redis' service below.
REDIS_HOST : redis
REDIS_PORT : 6379
2023-05-17 15:40:21 +08:00
REDIS_USERNAME : ''
2023-05-15 08:51:32 +08:00
REDIS_PASSWORD : difyai123456
2023-05-17 15:40:21 +08:00
REDIS_USE_SSL : 'false'
2023-05-15 08:51:32 +08:00
# use redis db 0 for redis cache
REDIS_DB : 0
# The configurations of celery broker.
# Use redis as the broker, and redis db 1 for celery broker.
CELERY_BROKER_URL : redis://:difyai123456@redis:6379/1
2023-05-15 17:33:35 +08:00
# Specifies the allowed origins for cross-origin requests to the Web API, e.g. https://dify.app or * for all origins.
WEB_API_CORS_ALLOW_ORIGINS : '*'
# Specifies the allowed origins for cross-origin requests to the console API, e.g. https://cloud.dify.ai or * for all origins.
CONSOLE_CORS_ALLOW_ORIGINS : '*'
2023-05-15 08:51:32 +08:00
# CSRF Cookie settings
# Controls whether a cookie is sent with cross-site requests,
# providing some protection against cross-site request forgery attacks
2023-05-15 17:33:35 +08:00
#
# Default: `SameSite=Lax, Secure=false, HttpOnly=true`
# This default configuration supports same-origin requests using either HTTP or HTTPS,
# but does not support cross-origin requests. It is suitable for local debugging purposes.
#
# If you want to enable cross-origin support,
# you must use the HTTPS protocol and set the configuration to `SameSite=None, Secure=true, HttpOnly=true`.
#
2023-05-15 08:51:32 +08:00
# The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
STORAGE_TYPE : local
# The path to the local storage directory, the directory relative the root path of API service codes or absolute path. Default: `storage` or `/home/john/storage`.
# only available when STORAGE_TYPE is `local`.
STORAGE_LOCAL_PATH : storage
# The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
S3_ENDPOINT : 'https://xxx.r2.cloudflarestorage.com'
S3_BUCKET_NAME : 'difyai'
S3_ACCESS_KEY : 'ak-difyai'
S3_SECRET_KEY : 'sk-difyai'
S3_REGION : 'us-east-1'
2023-10-11 16:05:37 +08:00
# The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`.
2023-05-15 08:51:32 +08:00
VECTOR_STORE : weaviate
# The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
WEAVIATE_ENDPOINT : http://weaviate:8080
# The Weaviate API key.
WEAVIATE_API_KEY : WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
# The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
2023-10-09 01:04:04 +08:00
QDRANT_URL : http://qdrant:6333
2023-05-15 08:51:32 +08:00
# The Qdrant API key.
2023-10-09 01:04:04 +08:00
QDRANT_API_KEY : difyai123456
2023-10-11 16:05:37 +08:00
# Milvus configuration Only available when VECTOR_STORE is `milvus`.
# The milvus host.
MILVUS_HOST : 127.0 .0 .1
# The milvus host.
MILVUS_PORT : 19530
# The milvus username.
MILVUS_USER : root
# The milvus password.
MILVUS_PASSWORD : Milvus
# The milvus tls switch.
2023-10-17 17:40:40 +08:00
MILVUS_SECURE : 'false'
2023-07-14 11:19:26 +08:00
# Mail configuration, support: resend
MAIL_TYPE : ''
# default send from email address, if not specified
MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg : no -reply <no-reply@dify.ai>)'
# the api-key for resend (https://resend.com)
RESEND_API_KEY : ''
2023-05-15 08:51:32 +08:00
# The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
SENTRY_DSN : ''
# The sample rate for Sentry events. Default: `1.0`
SENTRY_TRACES_SAMPLE_RATE : 1.0
# The sample rate for Sentry profiles. Default: `1.0`
SENTRY_PROFILES_SAMPLE_RATE : 1.0
depends_on :
2023-09-10 12:07:20 +08:00
- db
- redis
2023-05-15 08:51:32 +08:00
volumes :
# Mount the storage directory to the container, for storing user files.
2023-05-15 16:57:50 +08:00
- ./volumes/app/storage:/app/api/storage
2023-11-30 09:46:36 +08:00
# uncomment to expose dify-api port to host
# ports:
# - "5001:5001"
2023-05-15 08:51:32 +08:00
# worker service
# The Celery worker for processing the queue.
worker :
2023-12-19 14:08:47 +08:00
image : langgenius/dify-api:0.3.34
2023-05-15 08:51:32 +08:00
restart : always
environment :
# Startup mode, 'worker' starts the Celery worker for processing the queue.
MODE : worker
# --- All the configurations below are the same as those in the 'api' service. ---
# The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
LOG_LEVEL : INFO
# A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`.
# same as the API service
SECRET_KEY : sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
# The configurations of postgres database connection.
# It is consistent with the configuration in the 'db' service below.
DB_USERNAME : postgres
DB_PASSWORD : difyai123456
DB_HOST : db
DB_PORT : 5432
DB_DATABASE : dify
# The configurations of redis cache connection.
REDIS_HOST : redis
REDIS_PORT : 6379
2023-05-17 15:40:21 +08:00
REDIS_USERNAME : ''
2023-05-15 08:51:32 +08:00
REDIS_PASSWORD : difyai123456
REDIS_DB : 0
2023-05-17 15:40:21 +08:00
REDIS_USE_SSL : 'false'
2023-05-15 08:51:32 +08:00
# The configurations of celery broker.
CELERY_BROKER_URL : redis://:difyai123456@redis:6379/1
# The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
STORAGE_TYPE : local
STORAGE_LOCAL_PATH : storage
2023-10-11 16:05:37 +08:00
# The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`.
2023-05-15 08:51:32 +08:00
VECTOR_STORE : weaviate
2023-10-09 01:04:04 +08:00
# The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
2023-05-15 08:51:32 +08:00
WEAVIATE_ENDPOINT : http://weaviate:8080
2023-10-09 01:04:04 +08:00
# The Weaviate API key.
2023-05-15 08:51:32 +08:00
WEAVIATE_API_KEY : WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
2023-10-09 01:04:04 +08:00
# The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
QDRANT_URL : http://qdrant:6333
# The Qdrant API key.
QDRANT_API_KEY : difyai123456
2023-10-11 16:05:37 +08:00
# Milvus configuration Only available when VECTOR_STORE is `milvus`.
# The milvus host.
MILVUS_HOST : 127.0 .0 .1
# The milvus host.
MILVUS_PORT : 19530
# The milvus username.
MILVUS_USER : root
# The milvus password.
MILVUS_PASSWORD : Milvus
# The milvus tls switch.
2023-10-17 17:40:40 +08:00
MILVUS_SECURE : 'false'
2023-07-14 11:19:26 +08:00
# Mail configuration, support: resend
MAIL_TYPE : ''
# default send from email address, if not specified
MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg : no -reply <no-reply@dify.ai>)'
# the api-key for resend (https://resend.com)
RESEND_API_KEY : ''
2023-05-15 08:51:32 +08:00
depends_on :
2023-09-10 12:07:20 +08:00
- db
- redis
2023-05-15 08:51:32 +08:00
volumes :
# Mount the storage directory to the container, for storing user files.
2023-05-15 16:57:50 +08:00
- ./volumes/app/storage:/app/api/storage
2023-05-15 08:51:32 +08:00
# Frontend web application.
web :
2023-12-19 14:08:47 +08:00
image : langgenius/dify-web:0.3.34
2023-05-15 08:51:32 +08:00
restart : always
environment :
EDITION : SELF_HOSTED
2023-07-14 11:19:26 +08:00
# The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
2023-05-16 22:01:29 +08:00
# different from api or web app domain.
# example: http://cloud.dify.ai
2023-07-14 11:19:26 +08:00
CONSOLE_API_URL : ''
# The URL for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
2023-05-16 22:01:29 +08:00
# console or api domain.
# example: http://udify.app
2023-07-14 11:19:26 +08:00
APP_API_URL : ''
2023-06-13 16:30:31 +08:00
# The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
SENTRY_DSN : ''
2023-11-30 09:46:36 +08:00
# uncomment to expose dify-web port to host
# ports:
# - "3000:3000"
2023-05-15 08:51:32 +08:00
# The postgres database.
db :
image : postgres:15-alpine
restart : always
environment :
2023-09-26 10:20:00 +08:00
PGUSER : postgres
2023-05-15 08:51:32 +08:00
# The password for the default postgres user.
POSTGRES_PASSWORD : difyai123456
# The name of the default postgres database.
POSTGRES_DB : dify
# postgres data directory
PGDATA : /var/lib/postgresql/data/pgdata
volumes :
- ./volumes/db/data:/var/lib/postgresql/data
2023-12-24 15:43:43 +08:00
# uncomment to expose db(postgresql) port to host
# ports:
# - "5432:5432"
2023-09-09 13:47:08 +08:00
healthcheck :
test : [ "CMD" , "pg_isready" ]
interval : 1s
timeout : 3s
retries : 30
2023-05-15 08:51:32 +08:00
# The redis cache.
redis :
image : redis:6-alpine
restart : always
volumes :
# Mount the redis data directory to the container.
- ./volumes/redis/data:/data
# Set the redis password when startup redis server.
command : redis-server --requirepass difyai123456
2023-09-09 13:47:08 +08:00
healthcheck :
test : [ "CMD" , "redis-cli" , "ping" ]
2023-11-30 09:46:36 +08:00
# uncomment to expose redis port to host
# ports:
# - "6379:6379"
2023-05-15 08:51:32 +08:00
# The Weaviate vector store.
weaviate :
2023-11-22 16:41:20 +08:00
image : semitechnologies/weaviate:1.19.0
2023-05-15 08:51:32 +08:00
restart : always
volumes :
# Mount the Weaviate data directory to the container.
- ./volumes/weaviate:/var/lib/weaviate
environment :
# The Weaviate configurations
# You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
QUERY_DEFAULTS_LIMIT : 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED : 'false'
PERSISTENCE_DATA_PATH : '/var/lib/weaviate'
DEFAULT_VECTORIZER_MODULE : 'none'
CLUSTER_HOSTNAME : 'node1'
AUTHENTICATION_APIKEY_ENABLED : 'true'
AUTHENTICATION_APIKEY_ALLOWED_KEYS : 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
AUTHENTICATION_APIKEY_USERS : 'hello@dify.ai'
AUTHORIZATION_ADMINLIST_ENABLED : 'true'
AUTHORIZATION_ADMINLIST_USERS : 'hello@dify.ai'
2023-11-30 09:46:36 +08:00
# uncomment to expose weaviate port to host
# ports:
# - "8080:8080"
2023-10-09 01:04:04 +08:00
# Qdrant vector store.
2023-11-30 09:46:36 +08:00
# uncomment to use qdrant as vector store.
# (if uncommented, you need to comment out the weaviate service above,
# and set VECTOR_STORE to qdrant in the api & worker service.)
# qdrant:
# image: langgenius/qdrant:latest
# restart: always
# volumes:
# - ./volumes/qdrant:/qdrant/storage
# environment:
# QDRANT__API_KEY: 'difyai123456'
# # uncomment to expose qdrant port to host
# # ports:
# # - "6333:6333"
2023-05-15 08:51:32 +08:00
# The nginx reverse proxy.
# used for reverse proxying the API service and Web service.
nginx :
image : nginx:latest
2023-12-24 15:33:28 +08:00
restart : always
2023-05-15 08:51:32 +08:00
volumes :
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/proxy.conf:/etc/nginx/proxy.conf
- ./nginx/conf.d:/etc/nginx/conf.d
depends_on :
- api
- web
ports :
2023-11-21 17:33:35 +08:00
- "80:80"