docker-compose.yaml 15 KB

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