docker-compose.yaml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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
  47. WEB_API_CORS_ALLOW_ORIGINS: http://localhost,*
  48. # Specifies the allowed origins for cross-origin requests to the console API
  49. CONSOLE_CORS_ALLOW_ORIGINS: http://localhost,*
  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. COOKIE_HTTPONLY: 'true'
  54. COOKIE_SAMESITE: 'None'
  55. COOKIE_SECURE: 'true'
  56. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  57. STORAGE_TYPE: local
  58. # 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`.
  59. # only available when STORAGE_TYPE is `local`.
  60. STORAGE_LOCAL_PATH: storage
  61. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  62. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  63. S3_BUCKET_NAME: 'difyai'
  64. S3_ACCESS_KEY: 'ak-difyai'
  65. S3_SECRET_KEY: 'sk-difyai'
  66. S3_REGION: 'us-east-1'
  67. # The type of vector store to use. Supported values are `weaviate`, `qdrant`.
  68. VECTOR_STORE: weaviate
  69. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  70. WEAVIATE_ENDPOINT: http://weaviate:8080
  71. # The Weaviate API key.
  72. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  73. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  74. QDRANT_URL: 'https://your-qdrant-cluster-url.qdrant.tech/'
  75. # The Qdrant API key.
  76. QDRANT_API_KEY: 'ak-difyai'
  77. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  78. SENTRY_DSN: ''
  79. # The sample rate for Sentry events. Default: `1.0`
  80. SENTRY_TRACES_SAMPLE_RATE: 1.0
  81. # The sample rate for Sentry profiles. Default: `1.0`
  82. SENTRY_PROFILES_SAMPLE_RATE: 1.0
  83. depends_on:
  84. - db
  85. - redis
  86. - weaviate
  87. volumes:
  88. # Mount the storage directory to the container, for storing user files.
  89. - ./volumes/app/storage:/app/storage
  90. # worker service
  91. # The Celery worker for processing the queue.
  92. worker:
  93. image: langgenius/dify-api:latest
  94. restart: always
  95. environment:
  96. # Startup mode, 'worker' starts the Celery worker for processing the queue.
  97. MODE: worker
  98. # --- All the configurations below are the same as those in the 'api' service. ---
  99. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  100. LOG_LEVEL: INFO
  101. # 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`.
  102. # same as the API service
  103. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  104. # The base URL of console application, refers to the Console base URL of WEB service.
  105. CONSOLE_URL: http://localhost
  106. # The URL for Service API endpoints,refers to the base URL of the current API service.
  107. API_URL: http://localhost
  108. # The URL for Web APP, refers to the Web App base URL of WEB service.
  109. APP_URL: http://localhost
  110. # The configurations of postgres database connection.
  111. # It is consistent with the configuration in the 'db' service below.
  112. DB_USERNAME: postgres
  113. DB_PASSWORD: difyai123456
  114. DB_HOST: db
  115. DB_PORT: 5432
  116. DB_DATABASE: dify
  117. # The configurations of redis cache connection.
  118. REDIS_HOST: redis
  119. REDIS_PORT: 6379
  120. REDIS_PASSWORD: difyai123456
  121. REDIS_DB: 0
  122. # The configurations of celery broker.
  123. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  124. # The type of storage to use for storing user files. Supported values are `local` and `s3`, Default: `local`
  125. STORAGE_TYPE: local
  126. STORAGE_LOCAL_PATH: storage
  127. # The Vector store configurations.
  128. VECTOR_STORE: weaviate
  129. WEAVIATE_ENDPOINT: http://weaviate:8080
  130. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  131. depends_on:
  132. - db
  133. - redis
  134. - weaviate
  135. volumes:
  136. # Mount the storage directory to the container, for storing user files.
  137. - ./volumes/app/storage:/app/storage
  138. # Frontend web application.
  139. web:
  140. image: langgenius/dify-web:latest
  141. restart: always
  142. environment:
  143. EDITION: SELF_HOSTED
  144. # The base URL of console application, refers to the Console base URL of WEB service.
  145. CONSOLE_URL: http://localhost
  146. # The URL for Web APP, refers to the Web App base URL of WEB service.
  147. APP_URL: http://localhost
  148. # The postgres database.
  149. db:
  150. image: postgres:15-alpine
  151. restart: always
  152. environment:
  153. # The password for the default postgres user.
  154. POSTGRES_PASSWORD: difyai123456
  155. # The name of the default postgres database.
  156. POSTGRES_DB: dify
  157. # postgres data directory
  158. PGDATA: /var/lib/postgresql/data/pgdata
  159. volumes:
  160. - ./volumes/db/data:/var/lib/postgresql/data
  161. ports:
  162. - "5432:5432"
  163. # The redis cache.
  164. redis:
  165. image: redis:6-alpine
  166. restart: always
  167. volumes:
  168. # Mount the redis data directory to the container.
  169. - ./volumes/redis/data:/data
  170. # Set the redis password when startup redis server.
  171. command: redis-server --requirepass difyai123456
  172. # The Weaviate vector store.
  173. weaviate:
  174. image: semitechnologies/weaviate:1.18.4
  175. restart: always
  176. volumes:
  177. # Mount the Weaviate data directory to the container.
  178. - ./volumes/weaviate:/var/lib/weaviate
  179. environment:
  180. # The Weaviate configurations
  181. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  182. QUERY_DEFAULTS_LIMIT: 25
  183. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
  184. PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
  185. DEFAULT_VECTORIZER_MODULE: 'none'
  186. CLUSTER_HOSTNAME: 'node1'
  187. AUTHENTICATION_APIKEY_ENABLED: 'true'
  188. AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
  189. AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
  190. AUTHORIZATION_ADMINLIST_ENABLED: 'true'
  191. AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
  192. # The nginx reverse proxy.
  193. # used for reverse proxying the API service and Web service.
  194. nginx:
  195. image: nginx:latest
  196. volumes:
  197. - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  198. - ./nginx/proxy.conf:/etc/nginx/proxy.conf
  199. - ./nginx/conf.d:/etc/nginx/conf.d
  200. depends_on:
  201. - api
  202. - web
  203. ports:
  204. - "80:80"