docker-compose.yaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. version: '3'
  2. services:
  3. # API service
  4. api:
  5. image: langgenius/dify-api:0.6.8
  6. restart: always
  7. environment:
  8. # Startup mode, 'api' starts the API server.
  9. MODE: api
  10. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  11. LOG_LEVEL: INFO
  12. # enable DEBUG mode to output more logs
  13. # DEBUG : true
  14. # 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`.
  15. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  16. # The base URL of console application web frontend, refers to the Console base URL of WEB service if console domain is
  17. # different from api or web app domain.
  18. # example: http://cloud.dify.ai
  19. CONSOLE_WEB_URL: ''
  20. # Password for admin user initialization.
  21. # If left unset, admin user will not be prompted for a password when creating the initial admin account.
  22. INIT_PASSWORD: ''
  23. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  24. # different from api or web app domain.
  25. # example: http://cloud.dify.ai
  26. CONSOLE_API_URL: ''
  27. # The URL prefix for Service API endpoints, refers to the base URL of the current API service if api domain is
  28. # different from console domain.
  29. # example: http://api.dify.ai
  30. SERVICE_API_URL: ''
  31. # The URL prefix for Web APP frontend, refers to the Web App base URL of WEB service if web app domain is different from
  32. # console or api domain.
  33. # example: http://udify.app
  34. APP_WEB_URL: ''
  35. # File preview or download Url prefix.
  36. # used to display File preview or download Url to the front-end or as Multi-model inputs;
  37. # Url is signed and has expiration time.
  38. FILES_URL: ''
  39. # When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed.
  40. MIGRATION_ENABLED: 'true'
  41. # The configurations of postgres database connection.
  42. # It is consistent with the configuration in the 'db' service below.
  43. DB_USERNAME: postgres
  44. DB_PASSWORD: difyai123456
  45. DB_HOST: db
  46. DB_PORT: 5432
  47. DB_DATABASE: dify
  48. # The configurations of redis connection.
  49. # It is consistent with the configuration in the 'redis' service below.
  50. REDIS_HOST: redis
  51. REDIS_PORT: 6379
  52. REDIS_USERNAME: ''
  53. REDIS_PASSWORD: difyai123456
  54. REDIS_USE_SSL: 'false'
  55. # use redis db 0 for redis cache
  56. REDIS_DB: 0
  57. # The configurations of celery broker.
  58. # Use redis as the broker, and redis db 1 for celery broker.
  59. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  60. # Specifies the allowed origins for cross-origin requests to the Web API, e.g. https://dify.app or * for all origins.
  61. WEB_API_CORS_ALLOW_ORIGINS: '*'
  62. # Specifies the allowed origins for cross-origin requests to the console API, e.g. https://cloud.dify.ai or * for all origins.
  63. CONSOLE_CORS_ALLOW_ORIGINS: '*'
  64. # CSRF Cookie settings
  65. # Controls whether a cookie is sent with cross-site requests,
  66. # providing some protection against cross-site request forgery attacks
  67. #
  68. # Default: `SameSite=Lax, Secure=false, HttpOnly=true`
  69. # This default configuration supports same-origin requests using either HTTP or HTTPS,
  70. # but does not support cross-origin requests. It is suitable for local debugging purposes.
  71. #
  72. # If you want to enable cross-origin support,
  73. # you must use the HTTPS protocol and set the configuration to `SameSite=None, Secure=true, HttpOnly=true`.
  74. #
  75. # The type of storage to use for storing user files. Supported values are `local` and `s3` and `azure-blob` and `google-storage`, Default: `local`
  76. STORAGE_TYPE: local
  77. # 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`.
  78. # only available when STORAGE_TYPE is `local`.
  79. STORAGE_LOCAL_PATH: storage
  80. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  81. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  82. S3_BUCKET_NAME: 'difyai'
  83. S3_ACCESS_KEY: 'ak-difyai'
  84. S3_SECRET_KEY: 'sk-difyai'
  85. S3_REGION: 'us-east-1'
  86. # The Azure Blob storage configurations, only available when STORAGE_TYPE is `azure-blob`.
  87. AZURE_BLOB_ACCOUNT_NAME: 'difyai'
  88. AZURE_BLOB_ACCOUNT_KEY: 'difyai'
  89. AZURE_BLOB_CONTAINER_NAME: 'difyai-container'
  90. AZURE_BLOB_ACCOUNT_URL: 'https://<your_account_name>.blob.core.windows.net'
  91. # The Google storage configurations, only available when STORAGE_TYPE is `google-storage`.
  92. GOOGLE_STORAGE_BUCKET_NAME: 'yout-bucket-name'
  93. # if you want to use Application Default Credentials, you can leave GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64 empty.
  94. GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: 'your-google-service-account-json-base64-string'
  95. # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`, `relyt`.
  96. VECTOR_STORE: weaviate
  97. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  98. WEAVIATE_ENDPOINT: http://weaviate:8080
  99. # The Weaviate API key.
  100. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  101. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  102. QDRANT_URL: http://qdrant:6333
  103. # The Qdrant API key.
  104. QDRANT_API_KEY: difyai123456
  105. # The Qdrant client timeout setting.
  106. QDRANT_CLIENT_TIMEOUT: 20
  107. # The Qdrant client enable gRPC mode.
  108. QDRANT_GRPC_ENABLED: 'false'
  109. # The Qdrant server gRPC mode PORT.
  110. QDRANT_GRPC_PORT: 6334
  111. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  112. # The milvus host.
  113. MILVUS_HOST: 127.0.0.1
  114. # The milvus host.
  115. MILVUS_PORT: 19530
  116. # The milvus username.
  117. MILVUS_USER: root
  118. # The milvus password.
  119. MILVUS_PASSWORD: Milvus
  120. # The milvus tls switch.
  121. MILVUS_SECURE: 'false'
  122. # relyt configurations
  123. RELYT_HOST: db
  124. RELYT_PORT: 5432
  125. RELYT_USER: postgres
  126. RELYT_PASSWORD: difyai123456
  127. RELYT_DATABASE: postgres
  128. # pgvector configurations
  129. PGVECTOR_HOST: pgvector
  130. PGVECTOR_PORT: 5432
  131. PGVECTOR_USER: postgres
  132. PGVECTOR_PASSWORD: difyai123456
  133. PGVECTOR_DATABASE: dify
  134. # Mail configuration, support: resend, smtp
  135. MAIL_TYPE: ''
  136. # default send from email address, if not specified
  137. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  138. SMTP_SERVER: ''
  139. SMTP_PORT: 587
  140. SMTP_USERNAME: ''
  141. SMTP_PASSWORD: ''
  142. SMTP_USE_TLS: 'true'
  143. # the api-key for resend (https://resend.com)
  144. RESEND_API_KEY: ''
  145. RESEND_API_URL: https://api.resend.com
  146. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  147. SENTRY_DSN: ''
  148. # The sample rate for Sentry events. Default: `1.0`
  149. SENTRY_TRACES_SAMPLE_RATE: 1.0
  150. # The sample rate for Sentry profiles. Default: `1.0`
  151. SENTRY_PROFILES_SAMPLE_RATE: 1.0
  152. # Notion import configuration, support public and internal
  153. NOTION_INTEGRATION_TYPE: public
  154. NOTION_CLIENT_SECRET: you-client-secret
  155. NOTION_CLIENT_ID: you-client-id
  156. NOTION_INTERNAL_SECRET: you-internal-secret
  157. # The sandbox service endpoint.
  158. CODE_EXECUTION_ENDPOINT: "http://sandbox:8194"
  159. CODE_EXECUTION_API_KEY: dify-sandbox
  160. CODE_MAX_NUMBER: 9223372036854775807
  161. CODE_MIN_NUMBER: -9223372036854775808
  162. CODE_MAX_STRING_LENGTH: 80000
  163. TEMPLATE_TRANSFORM_MAX_LENGTH: 80000
  164. CODE_MAX_STRING_ARRAY_LENGTH: 30
  165. CODE_MAX_OBJECT_ARRAY_LENGTH: 30
  166. CODE_MAX_NUMBER_ARRAY_LENGTH: 1000
  167. # SSRF Proxy server
  168. SSRF_PROXY_HTTP_URL: 'http://ssrf_proxy:3128'
  169. SSRF_PROXY_HTTPS_URL: 'http://ssrf_proxy:3128'
  170. # Indexing configuration
  171. INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: 1000
  172. depends_on:
  173. - db
  174. - redis
  175. volumes:
  176. # Mount the storage directory to the container, for storing user files.
  177. - ./volumes/app/storage:/app/api/storage
  178. # uncomment to expose dify-api port to host
  179. # ports:
  180. # - "5001:5001"
  181. networks:
  182. - ssrf_proxy_network
  183. - default
  184. # worker service
  185. # The Celery worker for processing the queue.
  186. worker:
  187. image: langgenius/dify-api:0.6.8
  188. restart: always
  189. environment:
  190. CONSOLE_WEB_URL: ''
  191. # Startup mode, 'worker' starts the Celery worker for processing the queue.
  192. MODE: worker
  193. # --- All the configurations below are the same as those in the 'api' service. ---
  194. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  195. LOG_LEVEL: INFO
  196. # 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`.
  197. # same as the API service
  198. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  199. # The configurations of postgres database connection.
  200. # It is consistent with the configuration in the 'db' service below.
  201. DB_USERNAME: postgres
  202. DB_PASSWORD: difyai123456
  203. DB_HOST: db
  204. DB_PORT: 5432
  205. DB_DATABASE: dify
  206. # The configurations of redis cache connection.
  207. REDIS_HOST: redis
  208. REDIS_PORT: 6379
  209. REDIS_USERNAME: ''
  210. REDIS_PASSWORD: difyai123456
  211. REDIS_DB: 0
  212. REDIS_USE_SSL: 'false'
  213. # The configurations of celery broker.
  214. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  215. # The type of storage to use for storing user files. Supported values are `local` and `s3` and `azure-blob` and `google-storage`, Default: `local`
  216. STORAGE_TYPE: local
  217. STORAGE_LOCAL_PATH: storage
  218. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  219. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  220. S3_BUCKET_NAME: 'difyai'
  221. S3_ACCESS_KEY: 'ak-difyai'
  222. S3_SECRET_KEY: 'sk-difyai'
  223. S3_REGION: 'us-east-1'
  224. # The Azure Blob storage configurations, only available when STORAGE_TYPE is `azure-blob`.
  225. AZURE_BLOB_ACCOUNT_NAME: 'difyai'
  226. AZURE_BLOB_ACCOUNT_KEY: 'difyai'
  227. AZURE_BLOB_CONTAINER_NAME: 'difyai-container'
  228. AZURE_BLOB_ACCOUNT_URL: 'https://<your_account_name>.blob.core.windows.net'
  229. # The Google storage configurations, only available when STORAGE_TYPE is `google-storage`.
  230. GOOGLE_STORAGE_BUCKET_NAME: 'yout-bucket-name'
  231. # if you want to use Application Default Credentials, you can leave GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64 empty.
  232. GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: 'your-google-service-account-json-base64-string'
  233. # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`, `relyt`, `pgvector`.
  234. VECTOR_STORE: weaviate
  235. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  236. WEAVIATE_ENDPOINT: http://weaviate:8080
  237. # The Weaviate API key.
  238. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  239. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  240. QDRANT_URL: http://qdrant:6333
  241. # The Qdrant API key.
  242. QDRANT_API_KEY: difyai123456
  243. # The Qdrant client timeout setting.
  244. QDRANT_CLIENT_TIMEOUT: 20
  245. # The Qdrant client enable gRPC mode.
  246. QDRANT_GRPC_ENABLED: 'false'
  247. # The Qdrant server gRPC mode PORT.
  248. QDRANT_GRPC_PORT: 6334
  249. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  250. # The milvus host.
  251. MILVUS_HOST: 127.0.0.1
  252. # The milvus host.
  253. MILVUS_PORT: 19530
  254. # The milvus username.
  255. MILVUS_USER: root
  256. # The milvus password.
  257. MILVUS_PASSWORD: Milvus
  258. # The milvus tls switch.
  259. MILVUS_SECURE: 'false'
  260. # Mail configuration, support: resend
  261. MAIL_TYPE: ''
  262. # default send from email address, if not specified
  263. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  264. SMTP_SERVER: ''
  265. SMTP_PORT: 587
  266. SMTP_USERNAME: ''
  267. SMTP_PASSWORD: ''
  268. SMTP_USE_TLS: 'true'
  269. # the api-key for resend (https://resend.com)
  270. RESEND_API_KEY: ''
  271. RESEND_API_URL: https://api.resend.com
  272. # relyt configurations
  273. RELYT_HOST: db
  274. RELYT_PORT: 5432
  275. RELYT_USER: postgres
  276. RELYT_PASSWORD: difyai123456
  277. RELYT_DATABASE: postgres
  278. # pgvector configurations
  279. PGVECTOR_HOST: pgvector
  280. PGVECTOR_PORT: 5432
  281. PGVECTOR_USER: postgres
  282. PGVECTOR_PASSWORD: difyai123456
  283. PGVECTOR_DATABASE: dify
  284. # Notion import configuration, support public and internal
  285. NOTION_INTEGRATION_TYPE: public
  286. NOTION_CLIENT_SECRET: you-client-secret
  287. NOTION_CLIENT_ID: you-client-id
  288. NOTION_INTERNAL_SECRET: you-internal-secret
  289. # Indexing configuration
  290. INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: 1000
  291. depends_on:
  292. - db
  293. - redis
  294. volumes:
  295. # Mount the storage directory to the container, for storing user files.
  296. - ./volumes/app/storage:/app/api/storage
  297. networks:
  298. - ssrf_proxy_network
  299. - default
  300. # Frontend web application.
  301. web:
  302. image: langgenius/dify-web:0.6.8
  303. restart: always
  304. environment:
  305. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  306. # different from api or web app domain.
  307. # example: http://cloud.dify.ai
  308. CONSOLE_API_URL: ''
  309. # The URL for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
  310. # console or api domain.
  311. # example: http://udify.app
  312. APP_API_URL: ''
  313. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  314. SENTRY_DSN: ''
  315. # uncomment to expose dify-web port to host
  316. # ports:
  317. # - "3000:3000"
  318. # The postgres database.
  319. db:
  320. image: postgres:15-alpine
  321. restart: always
  322. environment:
  323. PGUSER: postgres
  324. # The password for the default postgres user.
  325. POSTGRES_PASSWORD: difyai123456
  326. # The name of the default postgres database.
  327. POSTGRES_DB: dify
  328. # postgres data directory
  329. PGDATA: /var/lib/postgresql/data/pgdata
  330. volumes:
  331. - ./volumes/db/data:/var/lib/postgresql/data
  332. # uncomment to expose db(postgresql) port to host
  333. # ports:
  334. # - "5432:5432"
  335. healthcheck:
  336. test: [ "CMD", "pg_isready" ]
  337. interval: 1s
  338. timeout: 3s
  339. retries: 30
  340. # The redis cache.
  341. redis:
  342. image: redis:6-alpine
  343. restart: always
  344. volumes:
  345. # Mount the redis data directory to the container.
  346. - ./volumes/redis/data:/data
  347. # Set the redis password when startup redis server.
  348. command: redis-server --requirepass difyai123456
  349. healthcheck:
  350. test: [ "CMD", "redis-cli", "ping" ]
  351. # uncomment to expose redis port to host
  352. # ports:
  353. # - "6379:6379"
  354. # The Weaviate vector store.
  355. weaviate:
  356. image: semitechnologies/weaviate:1.19.0
  357. restart: always
  358. volumes:
  359. # Mount the Weaviate data directory to the container.
  360. - ./volumes/weaviate:/var/lib/weaviate
  361. environment:
  362. # The Weaviate configurations
  363. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  364. QUERY_DEFAULTS_LIMIT: 25
  365. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
  366. PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
  367. DEFAULT_VECTORIZER_MODULE: 'none'
  368. CLUSTER_HOSTNAME: 'node1'
  369. AUTHENTICATION_APIKEY_ENABLED: 'true'
  370. AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
  371. AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
  372. AUTHORIZATION_ADMINLIST_ENABLED: 'true'
  373. AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
  374. # uncomment to expose weaviate port to host
  375. # ports:
  376. # - "8080:8080"
  377. # The DifySandbox
  378. sandbox:
  379. image: langgenius/dify-sandbox:0.2.0
  380. restart: always
  381. environment:
  382. # The DifySandbox configurations
  383. # Make sure you are changing this key for your deployment with a strong key.
  384. # You can generate a strong key using `openssl rand -base64 42`.
  385. API_KEY: dify-sandbox
  386. GIN_MODE: 'release'
  387. WORKER_TIMEOUT: 15
  388. ENABLE_NETWORK: 'true'
  389. HTTP_PROXY: 'http://ssrf_proxy:3128'
  390. HTTPS_PROXY: 'http://ssrf_proxy:3128'
  391. volumes:
  392. - ./volumes/sandbox/dependencies:/dependencies
  393. networks:
  394. - ssrf_proxy_network
  395. # ssrf_proxy server
  396. # for more information, please refer to
  397. # https://docs.dify.ai/getting-started/install-self-hosted/install-faq#id-16.-why-is-ssrf_proxy-needed
  398. ssrf_proxy:
  399. image: ubuntu/squid:latest
  400. restart: always
  401. volumes:
  402. # pls clearly modify the squid.conf file to fit your network environment.
  403. - ./volumes/ssrf_proxy/squid.conf:/etc/squid/squid.conf
  404. networks:
  405. - ssrf_proxy_network
  406. - default
  407. # Qdrant vector store.
  408. # uncomment to use qdrant as vector store.
  409. # (if uncommented, you need to comment out the weaviate service above,
  410. # and set VECTOR_STORE to qdrant in the api & worker service.)
  411. # qdrant:
  412. # image: langgenius/qdrant:v1.7.3
  413. # restart: always
  414. # volumes:
  415. # - ./volumes/qdrant:/qdrant/storage
  416. # environment:
  417. # QDRANT_API_KEY: 'difyai123456'
  418. # # uncomment to expose qdrant port to host
  419. # # ports:
  420. # # - "6333:6333"
  421. # # - "6334:6334"
  422. # The pgvector vector database.
  423. # Uncomment to use qdrant as vector store.
  424. # pgvector:
  425. # image: pgvector/pgvector:pg16
  426. # restart: always
  427. # environment:
  428. # PGUSER: postgres
  429. # # The password for the default postgres user.
  430. # POSTGRES_PASSWORD: difyai123456
  431. # # The name of the default postgres database.
  432. # POSTGRES_DB: dify
  433. # # postgres data directory
  434. # PGDATA: /var/lib/postgresql/data/pgdata
  435. # volumes:
  436. # - ./volumes/pgvector/data:/var/lib/postgresql/data
  437. # # uncomment to expose db(postgresql) port to host
  438. # # ports:
  439. # # - "5433:5432"
  440. # healthcheck:
  441. # test: [ "CMD", "pg_isready" ]
  442. # interval: 1s
  443. # timeout: 3s
  444. # retries: 30
  445. # The nginx reverse proxy.
  446. # used for reverse proxying the API service and Web service.
  447. nginx:
  448. image: nginx:latest
  449. restart: always
  450. volumes:
  451. - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  452. - ./nginx/proxy.conf:/etc/nginx/proxy.conf
  453. - ./nginx/conf.d:/etc/nginx/conf.d
  454. #- ./nginx/ssl:/etc/ssl
  455. depends_on:
  456. - api
  457. - web
  458. ports:
  459. - "80:80"
  460. #- "443:443"
  461. networks:
  462. # create a network between sandbox, api and ssrf_proxy, and can not access outside.
  463. ssrf_proxy_network:
  464. driver: bridge
  465. internal: true