docker-compose.yaml 17 KB

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