docker-compose.yaml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. version: '3.1'
  2. services:
  3. # API service
  4. api:
  5. image: langgenius/dify-api:latest
  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, 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_URL: ''
  18. # The URL for Service API endpoints,refers to the base URL of the current API service if api domain is
  19. # different from console domain.
  20. # example: http://api.dify.ai
  21. API_URL: ''
  22. # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
  23. # console or api domain.
  24. # example: http://udify.app
  25. APP_URL: ''
  26. # When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed.
  27. MIGRATION_ENABLED: 'true'
  28. # The configurations of postgres database connection.
  29. # It is consistent with the configuration in the 'db' service below.
  30. DB_USERNAME: postgres
  31. DB_PASSWORD: difyai123456
  32. DB_HOST: db
  33. DB_PORT: 5432
  34. DB_DATABASE: dify
  35. # The configurations of redis connection.
  36. # It is consistent with the configuration in the 'redis' service below.
  37. REDIS_HOST: redis
  38. REDIS_PORT: 6379
  39. REDIS_PASSWORD: difyai123456
  40. # use redis db 0 for redis cache
  41. REDIS_DB: 0
  42. # The configurations of session, Supported values are `sqlalchemy`. `redis`
  43. SESSION_TYPE: redis
  44. SESSION_REDIS_HOST: redis
  45. SESSION_REDIS_PORT: 6379
  46. SESSION_REDIS_PASSWORD: difyai123456
  47. # use redis db 2 for session store
  48. SESSION_REDIS_DB: 2
  49. # The configurations of celery broker.
  50. # Use redis as the broker, and redis db 1 for celery broker.
  51. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  52. # Specifies the allowed origins for cross-origin requests to the Web API, e.g. https://dify.app or * for all origins.
  53. WEB_API_CORS_ALLOW_ORIGINS: '*'
  54. # Specifies the allowed origins for cross-origin requests to the console API, e.g. https://cloud.dify.ai or * for all origins.
  55. CONSOLE_CORS_ALLOW_ORIGINS: '*'
  56. # CSRF Cookie settings
  57. # Controls whether a cookie is sent with cross-site requests,
  58. # providing some protection against cross-site request forgery attacks
  59. #
  60. # Default: `SameSite=Lax, Secure=false, HttpOnly=true`
  61. # This default configuration supports same-origin requests using either HTTP or HTTPS,
  62. # but does not support cross-origin requests. It is suitable for local debugging purposes.
  63. #
  64. # If you want to enable cross-origin support,
  65. # you must use the HTTPS protocol and set the configuration to `SameSite=None, Secure=true, HttpOnly=true`.
  66. #
  67. # For **production** purposes, please set `SameSite=Lax, Secure=true, HttpOnly=true`.
  68. COOKIE_HTTPONLY: 'true'
  69. COOKIE_SAMESITE: 'Lax'
  70. COOKIE_SECURE: 'false'
  71. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  72. STORAGE_TYPE: local
  73. # 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`.
  74. # only available when STORAGE_TYPE is `local`.
  75. STORAGE_LOCAL_PATH: storage
  76. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  77. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  78. S3_BUCKET_NAME: 'difyai'
  79. S3_ACCESS_KEY: 'ak-difyai'
  80. S3_SECRET_KEY: 'sk-difyai'
  81. S3_REGION: 'us-east-1'
  82. # The type of vector store to use. Supported values are `weaviate`, `qdrant`.
  83. VECTOR_STORE: weaviate
  84. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  85. WEAVIATE_ENDPOINT: http://weaviate:8080
  86. # The Weaviate API key.
  87. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  88. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  89. QDRANT_URL: 'https://your-qdrant-cluster-url.qdrant.tech/'
  90. # The Qdrant API key.
  91. QDRANT_API_KEY: 'ak-difyai'
  92. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  93. SENTRY_DSN: ''
  94. # The sample rate for Sentry events. Default: `1.0`
  95. SENTRY_TRACES_SAMPLE_RATE: 1.0
  96. # The sample rate for Sentry profiles. Default: `1.0`
  97. SENTRY_PROFILES_SAMPLE_RATE: 1.0
  98. depends_on:
  99. - db
  100. - redis
  101. - weaviate
  102. volumes:
  103. # Mount the storage directory to the container, for storing user files.
  104. - ./volumes/app/storage:/app/api/storage
  105. # worker service
  106. # The Celery worker for processing the queue.
  107. worker:
  108. image: langgenius/dify-api:latest
  109. restart: always
  110. environment:
  111. # Startup mode, 'worker' starts the Celery worker for processing the queue.
  112. MODE: worker
  113. # --- All the configurations below are the same as those in the 'api' service. ---
  114. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  115. LOG_LEVEL: INFO
  116. # 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`.
  117. # same as the API service
  118. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  119. # The configurations of postgres database connection.
  120. # It is consistent with the configuration in the 'db' service below.
  121. DB_USERNAME: postgres
  122. DB_PASSWORD: difyai123456
  123. DB_HOST: db
  124. DB_PORT: 5432
  125. DB_DATABASE: dify
  126. # The configurations of redis cache connection.
  127. REDIS_HOST: redis
  128. REDIS_PORT: 6379
  129. REDIS_PASSWORD: difyai123456
  130. REDIS_DB: 0
  131. # The configurations of celery broker.
  132. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  133. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  134. STORAGE_TYPE: local
  135. STORAGE_LOCAL_PATH: storage
  136. # The Vector store configurations.
  137. VECTOR_STORE: weaviate
  138. WEAVIATE_ENDPOINT: http://weaviate:8080
  139. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  140. depends_on:
  141. - db
  142. - redis
  143. - weaviate
  144. volumes:
  145. # Mount the storage directory to the container, for storing user files.
  146. - ./volumes/app/storage:/app/api/storage
  147. # Frontend web application.
  148. web:
  149. image: langgenius/dify-web:latest
  150. restart: always
  151. environment:
  152. EDITION: SELF_HOSTED
  153. # The base URL of console application, refers to the Console base URL of WEB service if console domain is
  154. # different from api or web app domain.
  155. # example: http://cloud.dify.ai
  156. CONSOLE_URL: ''
  157. # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
  158. # console or api domain.
  159. # example: http://udify.app
  160. APP_URL: ''
  161. # The postgres database.
  162. db:
  163. image: postgres:15-alpine
  164. restart: always
  165. environment:
  166. # The password for the default postgres user.
  167. POSTGRES_PASSWORD: difyai123456
  168. # The name of the default postgres database.
  169. POSTGRES_DB: dify
  170. # postgres data directory
  171. PGDATA: /var/lib/postgresql/data/pgdata
  172. volumes:
  173. - ./volumes/db/data:/var/lib/postgresql/data
  174. ports:
  175. - "5432:5432"
  176. # The redis cache.
  177. redis:
  178. image: redis:6-alpine
  179. restart: always
  180. volumes:
  181. # Mount the redis data directory to the container.
  182. - ./volumes/redis/data:/data
  183. # Set the redis password when startup redis server.
  184. command: redis-server --requirepass difyai123456
  185. # The Weaviate vector store.
  186. weaviate:
  187. image: semitechnologies/weaviate:1.18.4
  188. restart: always
  189. volumes:
  190. # Mount the Weaviate data directory to the container.
  191. - ./volumes/weaviate:/var/lib/weaviate
  192. environment:
  193. # The Weaviate configurations
  194. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  195. QUERY_DEFAULTS_LIMIT: 25
  196. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
  197. PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
  198. DEFAULT_VECTORIZER_MODULE: 'none'
  199. CLUSTER_HOSTNAME: 'node1'
  200. AUTHENTICATION_APIKEY_ENABLED: 'true'
  201. AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
  202. AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
  203. AUTHORIZATION_ADMINLIST_ENABLED: 'true'
  204. AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
  205. # The nginx reverse proxy.
  206. # used for reverse proxying the API service and Web service.
  207. nginx:
  208. image: nginx:latest
  209. volumes:
  210. - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  211. - ./nginx/proxy.conf:/etc/nginx/proxy.conf
  212. - ./nginx/conf.d:/etc/nginx/conf.d
  213. depends_on:
  214. - api
  215. - web
  216. ports:
  217. - "80:80"