docker-compose.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. version: '3.1'
  2. services:
  3. # API service
  4. api:
  5. image: langgenius/dify-api:0.5.0
  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. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  19. # different from api or web app domain.
  20. # example: http://cloud.dify.ai
  21. CONSOLE_API_URL: ''
  22. # The URL prefix for Service API endpoints, refers to the base URL of the current API service if api domain is
  23. # different from console domain.
  24. # example: http://api.dify.ai
  25. SERVICE_API_URL: ''
  26. # The URL prefix for Web APP frontend, refers to the Web App base URL of WEB service if web app domain is different from
  27. # console or api domain.
  28. # example: http://udify.app
  29. APP_WEB_URL: ''
  30. # File preview or download Url prefix.
  31. # used to display File preview or download Url to the front-end or as Multi-model inputs;
  32. # Url is signed and has expiration time.
  33. FILES_URL: ''
  34. # When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed.
  35. MIGRATION_ENABLED: 'true'
  36. # The configurations of postgres database connection.
  37. # It is consistent with the configuration in the 'db' service below.
  38. DB_USERNAME: postgres
  39. DB_PASSWORD: difyai123456
  40. DB_HOST: db
  41. DB_PORT: 5432
  42. DB_DATABASE: dify
  43. # The configurations of redis connection.
  44. # It is consistent with the configuration in the 'redis' service below.
  45. REDIS_HOST: redis
  46. REDIS_PORT: 6379
  47. REDIS_USERNAME: ''
  48. REDIS_PASSWORD: difyai123456
  49. REDIS_USE_SSL: 'false'
  50. # use redis db 0 for redis cache
  51. REDIS_DB: 0
  52. # The configurations of celery broker.
  53. # Use redis as the broker, and redis db 1 for celery broker.
  54. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  55. # Specifies the allowed origins for cross-origin requests to the Web API, e.g. https://dify.app or * for all origins.
  56. WEB_API_CORS_ALLOW_ORIGINS: '*'
  57. # Specifies the allowed origins for cross-origin requests to the console API, e.g. https://cloud.dify.ai or * for all origins.
  58. CONSOLE_CORS_ALLOW_ORIGINS: '*'
  59. # CSRF Cookie settings
  60. # Controls whether a cookie is sent with cross-site requests,
  61. # providing some protection against cross-site request forgery attacks
  62. #
  63. # Default: `SameSite=Lax, Secure=false, HttpOnly=true`
  64. # This default configuration supports same-origin requests using either HTTP or HTTPS,
  65. # but does not support cross-origin requests. It is suitable for local debugging purposes.
  66. #
  67. # If you want to enable cross-origin support,
  68. # you must use the HTTPS protocol and set the configuration to `SameSite=None, Secure=true, HttpOnly=true`.
  69. #
  70. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  71. STORAGE_TYPE: local
  72. # 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`.
  73. # only available when STORAGE_TYPE is `local`.
  74. STORAGE_LOCAL_PATH: storage
  75. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  76. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  77. S3_BUCKET_NAME: 'difyai'
  78. S3_ACCESS_KEY: 'ak-difyai'
  79. S3_SECRET_KEY: 'sk-difyai'
  80. S3_REGION: 'us-east-1'
  81. # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`.
  82. VECTOR_STORE: weaviate
  83. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  84. WEAVIATE_ENDPOINT: http://weaviate:8080
  85. # The Weaviate API key.
  86. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  87. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  88. QDRANT_URL: http://qdrant:6333
  89. # The Qdrant API key.
  90. QDRANT_API_KEY: difyai123456
  91. # The Qdrant clinet timeout setting.
  92. QDRANT_CLIENT_TIMEOUT: 20
  93. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  94. # The milvus host.
  95. MILVUS_HOST: 127.0.0.1
  96. # The milvus host.
  97. MILVUS_PORT: 19530
  98. # The milvus username.
  99. MILVUS_USER: root
  100. # The milvus password.
  101. MILVUS_PASSWORD: Milvus
  102. # The milvus tls switch.
  103. MILVUS_SECURE: 'false'
  104. # Mail configuration, support: resend
  105. MAIL_TYPE: ''
  106. # default send from email address, if not specified
  107. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  108. # the api-key for resend (https://resend.com)
  109. RESEND_API_KEY: ''
  110. RESEND_API_URL: https://api.resend.com
  111. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  112. SENTRY_DSN: ''
  113. # The sample rate for Sentry events. Default: `1.0`
  114. SENTRY_TRACES_SAMPLE_RATE: 1.0
  115. # The sample rate for Sentry profiles. Default: `1.0`
  116. SENTRY_PROFILES_SAMPLE_RATE: 1.0
  117. depends_on:
  118. - db
  119. - redis
  120. volumes:
  121. # Mount the storage directory to the container, for storing user files.
  122. - ./volumes/app/storage:/app/api/storage
  123. # uncomment to expose dify-api port to host
  124. # ports:
  125. # - "5001:5001"
  126. # worker service
  127. # The Celery worker for processing the queue.
  128. worker:
  129. image: langgenius/dify-api:0.5.0
  130. restart: always
  131. environment:
  132. # Startup mode, 'worker' starts the Celery worker for processing the queue.
  133. MODE: worker
  134. # --- All the configurations below are the same as those in the 'api' service. ---
  135. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  136. LOG_LEVEL: INFO
  137. # 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`.
  138. # same as the API service
  139. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  140. # The configurations of postgres database connection.
  141. # It is consistent with the configuration in the 'db' service below.
  142. DB_USERNAME: postgres
  143. DB_PASSWORD: difyai123456
  144. DB_HOST: db
  145. DB_PORT: 5432
  146. DB_DATABASE: dify
  147. # The configurations of redis cache connection.
  148. REDIS_HOST: redis
  149. REDIS_PORT: 6379
  150. REDIS_USERNAME: ''
  151. REDIS_PASSWORD: difyai123456
  152. REDIS_DB: 0
  153. REDIS_USE_SSL: 'false'
  154. # The configurations of celery broker.
  155. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  156. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  157. STORAGE_TYPE: local
  158. STORAGE_LOCAL_PATH: storage
  159. # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`.
  160. VECTOR_STORE: weaviate
  161. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  162. WEAVIATE_ENDPOINT: http://weaviate:8080
  163. # The Weaviate API key.
  164. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  165. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  166. QDRANT_URL: http://qdrant:6333
  167. # The Qdrant API key.
  168. QDRANT_API_KEY: difyai123456
  169. # The Qdrant clinet timeout setting.
  170. QDRANT_CLIENT_TIMEOUT: 20
  171. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  172. # The milvus host.
  173. MILVUS_HOST: 127.0.0.1
  174. # The milvus host.
  175. MILVUS_PORT: 19530
  176. # The milvus username.
  177. MILVUS_USER: root
  178. # The milvus password.
  179. MILVUS_PASSWORD: Milvus
  180. # The milvus tls switch.
  181. MILVUS_SECURE: 'false'
  182. # Mail configuration, support: resend
  183. MAIL_TYPE: ''
  184. # default send from email address, if not specified
  185. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  186. # the api-key for resend (https://resend.com)
  187. RESEND_API_KEY: ''
  188. RESEND_API_URL: https://api.resend.com
  189. depends_on:
  190. - db
  191. - redis
  192. volumes:
  193. # Mount the storage directory to the container, for storing user files.
  194. - ./volumes/app/storage:/app/api/storage
  195. # Frontend web application.
  196. web:
  197. image: langgenius/dify-web:0.5.0
  198. restart: always
  199. environment:
  200. EDITION: SELF_HOSTED
  201. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  202. # different from api or web app domain.
  203. # example: http://cloud.dify.ai
  204. CONSOLE_API_URL: ''
  205. # The URL for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
  206. # console or api domain.
  207. # example: http://udify.app
  208. APP_API_URL: ''
  209. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  210. SENTRY_DSN: ''
  211. # uncomment to expose dify-web port to host
  212. # ports:
  213. # - "3000:3000"
  214. # The postgres database.
  215. db:
  216. image: postgres:15-alpine
  217. restart: always
  218. environment:
  219. PGUSER: postgres
  220. # The password for the default postgres user.
  221. POSTGRES_PASSWORD: difyai123456
  222. # The name of the default postgres database.
  223. POSTGRES_DB: dify
  224. # postgres data directory
  225. PGDATA: /var/lib/postgresql/data/pgdata
  226. volumes:
  227. - ./volumes/db/data:/var/lib/postgresql/data
  228. # uncomment to expose db(postgresql) port to host
  229. # ports:
  230. # - "5432:5432"
  231. healthcheck:
  232. test: [ "CMD", "pg_isready" ]
  233. interval: 1s
  234. timeout: 3s
  235. retries: 30
  236. # The redis cache.
  237. redis:
  238. image: redis:6-alpine
  239. restart: always
  240. volumes:
  241. # Mount the redis data directory to the container.
  242. - ./volumes/redis/data:/data
  243. # Set the redis password when startup redis server.
  244. command: redis-server --requirepass difyai123456
  245. healthcheck:
  246. test: [ "CMD", "redis-cli", "ping" ]
  247. # uncomment to expose redis port to host
  248. # ports:
  249. # - "6379:6379"
  250. # The Weaviate vector store.
  251. weaviate:
  252. image: semitechnologies/weaviate:1.19.0
  253. restart: always
  254. volumes:
  255. # Mount the Weaviate data directory to the container.
  256. - ./volumes/weaviate:/var/lib/weaviate
  257. environment:
  258. # The Weaviate configurations
  259. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  260. QUERY_DEFAULTS_LIMIT: 25
  261. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
  262. PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
  263. DEFAULT_VECTORIZER_MODULE: 'none'
  264. CLUSTER_HOSTNAME: 'node1'
  265. AUTHENTICATION_APIKEY_ENABLED: 'true'
  266. AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
  267. AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
  268. AUTHORIZATION_ADMINLIST_ENABLED: 'true'
  269. AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
  270. # uncomment to expose weaviate port to host
  271. # ports:
  272. # - "8080:8080"
  273. # Qdrant vector store.
  274. # uncomment to use qdrant as vector store.
  275. # (if uncommented, you need to comment out the weaviate service above,
  276. # and set VECTOR_STORE to qdrant in the api & worker service.)
  277. # qdrant:
  278. # image: langgenius/qdrant:v1.7.3
  279. # restart: always
  280. # volumes:
  281. # - ./volumes/qdrant:/qdrant/storage
  282. # environment:
  283. # QDRANT__API_KEY: 'difyai123456'
  284. # # uncomment to expose qdrant port to host
  285. # # ports:
  286. # # - "6333:6333"
  287. # The nginx reverse proxy.
  288. # used for reverse proxying the API service and Web service.
  289. nginx:
  290. image: nginx:latest
  291. restart: always
  292. volumes:
  293. - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  294. - ./nginx/proxy.conf:/etc/nginx/proxy.conf
  295. - ./nginx/conf.d:/etc/nginx/conf.d
  296. depends_on:
  297. - api
  298. - web
  299. ports:
  300. - "80:80"