docker-compose.yaml 9.6 KB

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