docker-compose.yaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. version: '3.1'
  2. services:
  3. # API service
  4. api:
  5. image: langgenius/dify-api:0.3.19
  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 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 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 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. # 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 session, Supported values are `sqlalchemy`. `redis`
  53. SESSION_TYPE: redis
  54. SESSION_REDIS_HOST: redis
  55. SESSION_REDIS_PORT: 6379
  56. SESSION_REDIS_USERNAME: ''
  57. SESSION_REDIS_PASSWORD: difyai123456
  58. SESSION_REDIS_USE_SSL: 'false'
  59. # use redis db 2 for session store
  60. SESSION_REDIS_DB: 2
  61. # The configurations of celery broker.
  62. # Use redis as the broker, and redis db 1 for celery broker.
  63. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  64. # Specifies the allowed origins for cross-origin requests to the Web API, e.g. https://dify.app or * for all origins.
  65. WEB_API_CORS_ALLOW_ORIGINS: '*'
  66. # Specifies the allowed origins for cross-origin requests to the console API, e.g. https://cloud.dify.ai or * for all origins.
  67. CONSOLE_CORS_ALLOW_ORIGINS: '*'
  68. # CSRF Cookie settings
  69. # Controls whether a cookie is sent with cross-site requests,
  70. # providing some protection against cross-site request forgery attacks
  71. #
  72. # Default: `SameSite=Lax, Secure=false, HttpOnly=true`
  73. # This default configuration supports same-origin requests using either HTTP or HTTPS,
  74. # but does not support cross-origin requests. It is suitable for local debugging purposes.
  75. #
  76. # If you want to enable cross-origin support,
  77. # you must use the HTTPS protocol and set the configuration to `SameSite=None, Secure=true, HttpOnly=true`.
  78. #
  79. # For **production** purposes, please set `SameSite=Lax, Secure=true, HttpOnly=true`.
  80. COOKIE_HTTPONLY: 'true'
  81. COOKIE_SAMESITE: 'Lax'
  82. COOKIE_SECURE: 'false'
  83. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  84. STORAGE_TYPE: local
  85. # 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`.
  86. # only available when STORAGE_TYPE is `local`.
  87. STORAGE_LOCAL_PATH: storage
  88. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  89. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  90. S3_BUCKET_NAME: 'difyai'
  91. S3_ACCESS_KEY: 'ak-difyai'
  92. S3_SECRET_KEY: 'sk-difyai'
  93. S3_REGION: 'us-east-1'
  94. # The type of vector store to use. Supported values are `weaviate`, `qdrant`.
  95. VECTOR_STORE: weaviate
  96. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  97. WEAVIATE_ENDPOINT: http://weaviate:8080
  98. # The Weaviate API key.
  99. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  100. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  101. QDRANT_URL: 'https://your-qdrant-cluster-url.qdrant.tech/'
  102. # The Qdrant API key.
  103. QDRANT_API_KEY: 'ak-difyai'
  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. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  111. SENTRY_DSN: ''
  112. # The sample rate for Sentry events. Default: `1.0`
  113. SENTRY_TRACES_SAMPLE_RATE: 1.0
  114. # The sample rate for Sentry profiles. Default: `1.0`
  115. SENTRY_PROFILES_SAMPLE_RATE: 1.0
  116. depends_on:
  117. db:
  118. condition: service_healthy
  119. redis:
  120. condition: service_healthy
  121. weaviate:
  122. condition: service_started
  123. volumes:
  124. # Mount the storage directory to the container, for storing user files.
  125. - ./volumes/app/storage:/app/api/storage
  126. # worker service
  127. # The Celery worker for processing the queue.
  128. worker:
  129. image: langgenius/dify-api:0.3.19
  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 Vector store configurations.
  160. VECTOR_STORE: weaviate
  161. WEAVIATE_ENDPOINT: http://weaviate:8080
  162. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  163. # Mail configuration, support: resend
  164. MAIL_TYPE: ''
  165. # default send from email address, if not specified
  166. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  167. # the api-key for resend (https://resend.com)
  168. RESEND_API_KEY: ''
  169. depends_on:
  170. db:
  171. condition: service_healthy
  172. redis:
  173. condition: service_healthy
  174. weaviate:
  175. condition: service_started
  176. volumes:
  177. # Mount the storage directory to the container, for storing user files.
  178. - ./volumes/app/storage:/app/api/storage
  179. # Frontend web application.
  180. web:
  181. image: langgenius/dify-web:0.3.19
  182. restart: always
  183. environment:
  184. EDITION: SELF_HOSTED
  185. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  186. # different from api or web app domain.
  187. # example: http://cloud.dify.ai
  188. CONSOLE_API_URL: ''
  189. # The URL for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
  190. # console or api domain.
  191. # example: http://udify.app
  192. APP_API_URL: ''
  193. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  194. SENTRY_DSN: ''
  195. # The postgres database.
  196. db:
  197. image: postgres:15-alpine
  198. restart: always
  199. environment:
  200. # The password for the default postgres user.
  201. POSTGRES_PASSWORD: difyai123456
  202. # The name of the default postgres database.
  203. POSTGRES_DB: dify
  204. # postgres data directory
  205. PGDATA: /var/lib/postgresql/data/pgdata
  206. volumes:
  207. - ./volumes/db/data:/var/lib/postgresql/data
  208. ports:
  209. - "5432:5432"
  210. healthcheck:
  211. test: ["CMD", "pg_isready"]
  212. interval: 1s
  213. timeout: 3s
  214. retries: 30
  215. # The redis cache.
  216. redis:
  217. image: redis:6-alpine
  218. restart: always
  219. volumes:
  220. # Mount the redis data directory to the container.
  221. - ./volumes/redis/data:/data
  222. # Set the redis password when startup redis server.
  223. command: redis-server --requirepass difyai123456
  224. healthcheck:
  225. test: ["CMD", "redis-cli","ping"]
  226. # The Weaviate vector store.
  227. weaviate:
  228. image: semitechnologies/weaviate:1.18.4
  229. restart: always
  230. volumes:
  231. # Mount the Weaviate data directory to the container.
  232. - ./volumes/weaviate:/var/lib/weaviate
  233. environment:
  234. # The Weaviate configurations
  235. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  236. QUERY_DEFAULTS_LIMIT: 25
  237. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
  238. PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
  239. DEFAULT_VECTORIZER_MODULE: 'none'
  240. CLUSTER_HOSTNAME: 'node1'
  241. AUTHENTICATION_APIKEY_ENABLED: 'true'
  242. AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
  243. AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
  244. AUTHORIZATION_ADMINLIST_ENABLED: 'true'
  245. AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
  246. # The nginx reverse proxy.
  247. # used for reverse proxying the API service and Web service.
  248. nginx:
  249. image: nginx:latest
  250. volumes:
  251. - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  252. - ./nginx/proxy.conf:/etc/nginx/proxy.conf
  253. - ./nginx/conf.d:/etc/nginx/conf.d
  254. depends_on:
  255. - api
  256. - web
  257. ports:
  258. - "80:80"