docker-compose.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. version: '3.1'
  2. services:
  3. # API service
  4. api:
  5. image: langgenius/dify-api:0.5.3
  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`, 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 type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`.
  85. VECTOR_STORE: weaviate
  86. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  87. WEAVIATE_ENDPOINT: http://weaviate:8080
  88. # The Weaviate API key.
  89. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  90. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  91. QDRANT_URL: http://qdrant:6333
  92. # The Qdrant API key.
  93. QDRANT_API_KEY: difyai123456
  94. # The Qdrant clinet timeout setting.
  95. QDRANT_CLIENT_TIMEOUT: 20
  96. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  97. # The milvus host.
  98. MILVUS_HOST: 127.0.0.1
  99. # The milvus host.
  100. MILVUS_PORT: 19530
  101. # The milvus username.
  102. MILVUS_USER: root
  103. # The milvus password.
  104. MILVUS_PASSWORD: Milvus
  105. # The milvus tls switch.
  106. MILVUS_SECURE: 'false'
  107. # Mail configuration, support: resend
  108. MAIL_TYPE: ''
  109. # default send from email address, if not specified
  110. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  111. # the api-key for resend (https://resend.com)
  112. RESEND_API_KEY: ''
  113. RESEND_API_URL: https://api.resend.com
  114. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  115. SENTRY_DSN: ''
  116. # The sample rate for Sentry events. Default: `1.0`
  117. SENTRY_TRACES_SAMPLE_RATE: 1.0
  118. # The sample rate for Sentry profiles. Default: `1.0`
  119. SENTRY_PROFILES_SAMPLE_RATE: 1.0
  120. depends_on:
  121. - db
  122. - redis
  123. volumes:
  124. # Mount the storage directory to the container, for storing user files.
  125. - ./volumes/app/storage:/app/api/storage
  126. # uncomment to expose dify-api port to host
  127. # ports:
  128. # - "5001:5001"
  129. # worker service
  130. # The Celery worker for processing the queue.
  131. worker:
  132. image: langgenius/dify-api:0.5.3
  133. restart: always
  134. environment:
  135. # Startup mode, 'worker' starts the Celery worker for processing the queue.
  136. MODE: worker
  137. # --- All the configurations below are the same as those in the 'api' service. ---
  138. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  139. LOG_LEVEL: INFO
  140. # 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`.
  141. # same as the API service
  142. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  143. # The configurations of postgres database connection.
  144. # It is consistent with the configuration in the 'db' service below.
  145. DB_USERNAME: postgres
  146. DB_PASSWORD: difyai123456
  147. DB_HOST: db
  148. DB_PORT: 5432
  149. DB_DATABASE: dify
  150. # The configurations of redis cache connection.
  151. REDIS_HOST: redis
  152. REDIS_PORT: 6379
  153. REDIS_USERNAME: ''
  154. REDIS_PASSWORD: difyai123456
  155. REDIS_DB: 0
  156. REDIS_USE_SSL: 'false'
  157. # The configurations of celery broker.
  158. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  159. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  160. STORAGE_TYPE: local
  161. STORAGE_LOCAL_PATH: storage
  162. # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`.
  163. VECTOR_STORE: weaviate
  164. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  165. WEAVIATE_ENDPOINT: http://weaviate:8080
  166. # The Weaviate API key.
  167. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  168. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  169. QDRANT_URL: http://qdrant:6333
  170. # The Qdrant API key.
  171. QDRANT_API_KEY: difyai123456
  172. # The Qdrant clinet timeout setting.
  173. QDRANT_CLIENT_TIMEOUT: 20
  174. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  175. # The milvus host.
  176. MILVUS_HOST: 127.0.0.1
  177. # The milvus host.
  178. MILVUS_PORT: 19530
  179. # The milvus username.
  180. MILVUS_USER: root
  181. # The milvus password.
  182. MILVUS_PASSWORD: Milvus
  183. # The milvus tls switch.
  184. MILVUS_SECURE: 'false'
  185. # Mail configuration, support: resend
  186. MAIL_TYPE: ''
  187. # default send from email address, if not specified
  188. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  189. # the api-key for resend (https://resend.com)
  190. RESEND_API_KEY: ''
  191. RESEND_API_URL: https://api.resend.com
  192. depends_on:
  193. - db
  194. - redis
  195. volumes:
  196. # Mount the storage directory to the container, for storing user files.
  197. - ./volumes/app/storage:/app/api/storage
  198. # Frontend web application.
  199. web:
  200. image: langgenius/dify-web:0.5.3
  201. restart: always
  202. environment:
  203. EDITION: SELF_HOSTED
  204. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  205. # different from api or web app domain.
  206. # example: http://cloud.dify.ai
  207. CONSOLE_API_URL: ''
  208. # The URL for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
  209. # console or api domain.
  210. # example: http://udify.app
  211. APP_API_URL: ''
  212. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  213. SENTRY_DSN: ''
  214. # uncomment to expose dify-web port to host
  215. # ports:
  216. # - "3000:3000"
  217. # The postgres database.
  218. db:
  219. image: postgres:15-alpine
  220. restart: always
  221. environment:
  222. PGUSER: postgres
  223. # The password for the default postgres user.
  224. POSTGRES_PASSWORD: difyai123456
  225. # The name of the default postgres database.
  226. POSTGRES_DB: dify
  227. # postgres data directory
  228. PGDATA: /var/lib/postgresql/data/pgdata
  229. volumes:
  230. - ./volumes/db/data:/var/lib/postgresql/data
  231. # uncomment to expose db(postgresql) port to host
  232. # ports:
  233. # - "5432:5432"
  234. healthcheck:
  235. test: [ "CMD", "pg_isready" ]
  236. interval: 1s
  237. timeout: 3s
  238. retries: 30
  239. # The redis cache.
  240. redis:
  241. image: redis:6-alpine
  242. restart: always
  243. volumes:
  244. # Mount the redis data directory to the container.
  245. - ./volumes/redis/data:/data
  246. # Set the redis password when startup redis server.
  247. command: redis-server --requirepass difyai123456
  248. healthcheck:
  249. test: [ "CMD", "redis-cli", "ping" ]
  250. # uncomment to expose redis port to host
  251. # ports:
  252. # - "6379:6379"
  253. # The Weaviate vector store.
  254. weaviate:
  255. image: semitechnologies/weaviate:1.19.0
  256. restart: always
  257. volumes:
  258. # Mount the Weaviate data directory to the container.
  259. - ./volumes/weaviate:/var/lib/weaviate
  260. environment:
  261. # The Weaviate configurations
  262. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  263. QUERY_DEFAULTS_LIMIT: 25
  264. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
  265. PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
  266. DEFAULT_VECTORIZER_MODULE: 'none'
  267. CLUSTER_HOSTNAME: 'node1'
  268. AUTHENTICATION_APIKEY_ENABLED: 'true'
  269. AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
  270. AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
  271. AUTHORIZATION_ADMINLIST_ENABLED: 'true'
  272. AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
  273. # uncomment to expose weaviate port to host
  274. # ports:
  275. # - "8080:8080"
  276. # Qdrant vector store.
  277. # uncomment to use qdrant as vector store.
  278. # (if uncommented, you need to comment out the weaviate service above,
  279. # and set VECTOR_STORE to qdrant in the api & worker service.)
  280. # qdrant:
  281. # image: langgenius/qdrant:v1.7.3
  282. # restart: always
  283. # volumes:
  284. # - ./volumes/qdrant:/qdrant/storage
  285. # environment:
  286. # QDRANT__API_KEY: 'difyai123456'
  287. # # uncomment to expose qdrant port to host
  288. # # ports:
  289. # # - "6333:6333"
  290. # The nginx reverse proxy.
  291. # used for reverse proxying the API service and Web service.
  292. nginx:
  293. image: nginx:latest
  294. restart: always
  295. volumes:
  296. - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  297. - ./nginx/proxy.conf:/etc/nginx/proxy.conf
  298. - ./nginx/conf.d:/etc/nginx/conf.d
  299. depends_on:
  300. - api
  301. - web
  302. ports:
  303. - "80:80"