docker-compose.yaml 12 KB

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