docker-compose.yaml 9.3 KB

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