docker-compose.yaml 14 KB

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