docker-compose.middleware.yaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. services:
  2. # The postgres database.
  3. db:
  4. image: postgres:15-alpine
  5. restart: always
  6. env_file:
  7. - ./middleware.env
  8. environment:
  9. POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-difyai123456}
  10. POSTGRES_DB: ${POSTGRES_DB:-dify}
  11. PGDATA: ${PGDATA:-/var/lib/postgresql/data/pgdata}
  12. command: >
  13. postgres -c 'max_connections=${POSTGRES_MAX_CONNECTIONS:-100}'
  14. -c 'shared_buffers=${POSTGRES_SHARED_BUFFERS:-128MB}'
  15. -c 'work_mem=${POSTGRES_WORK_MEM:-4MB}'
  16. -c 'maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM:-64MB}'
  17. -c 'effective_cache_size=${POSTGRES_EFFECTIVE_CACHE_SIZE:-4096MB}'
  18. volumes:
  19. - ${PGDATA_HOST_VOLUME:-./volumes/db/data}:/var/lib/postgresql/data
  20. ports:
  21. - "${EXPOSE_POSTGRES_PORT:-5432}:5432"
  22. healthcheck:
  23. test: [ "CMD", "pg_isready" ]
  24. interval: 1s
  25. timeout: 3s
  26. retries: 30
  27. # The redis cache.
  28. redis:
  29. image: redis:6-alpine
  30. restart: always
  31. environment:
  32. REDISCLI_AUTH: ${REDIS_PASSWORD:-difyai123456}
  33. volumes:
  34. # Mount the redis data directory to the container.
  35. - ${REDIS_HOST_VOLUME:-./volumes/redis/data}:/data
  36. # Set the redis password when startup redis server.
  37. command: redis-server --requirepass ${REDIS_PASSWORD:-difyai123456}
  38. ports:
  39. - "${EXPOSE_REDIS_PORT:-6379}:6379"
  40. healthcheck:
  41. test: [ "CMD", "redis-cli", "ping" ]
  42. # The DifySandbox
  43. sandbox:
  44. image: langgenius/dify-sandbox:0.2.10
  45. restart: always
  46. environment:
  47. # The DifySandbox configurations
  48. # Make sure you are changing this key for your deployment with a strong key.
  49. # You can generate a strong key using `openssl rand -base64 42`.
  50. API_KEY: ${SANDBOX_API_KEY:-dify-sandbox}
  51. GIN_MODE: ${SANDBOX_GIN_MODE:-release}
  52. WORKER_TIMEOUT: ${SANDBOX_WORKER_TIMEOUT:-15}
  53. ENABLE_NETWORK: ${SANDBOX_ENABLE_NETWORK:-true}
  54. HTTP_PROXY: ${SANDBOX_HTTP_PROXY:-http://ssrf_proxy:3128}
  55. HTTPS_PROXY: ${SANDBOX_HTTPS_PROXY:-http://ssrf_proxy:3128}
  56. SANDBOX_PORT: ${SANDBOX_PORT:-8194}
  57. volumes:
  58. - ./volumes/sandbox/dependencies:/dependencies
  59. - ./volumes/sandbox/conf:/conf
  60. healthcheck:
  61. test: [ "CMD", "curl", "-f", "http://localhost:8194/health" ]
  62. networks:
  63. - ssrf_proxy_network
  64. # plugin daemon
  65. plugin_daemon:
  66. image: langgenius/dify-plugin-daemon:0.0.3-local
  67. restart: always
  68. environment:
  69. # Use the shared environment variables.
  70. DB_HOST: ${DB_HOST:-db}
  71. DB_PORT: ${DB_PORT:-5432}
  72. DB_USERNAME: ${DB_USER:-postgres}
  73. DB_PASSWORD: ${DB_PASSWORD:-difyai123456}
  74. DB_DATABASE: ${DB_PLUGIN_DATABASE:-dify_plugin}
  75. REDIS_HOST: ${REDIS_HOST:-redis}
  76. REDIS_PORT: ${REDIS_PORT:-6379}
  77. REDIS_PASSWORD: ${REDIS_PASSWORD:-difyai123456}
  78. SERVER_PORT: ${PLUGIN_DAEMON_PORT:-5002}
  79. SERVER_KEY: ${PLUGIN_DAEMON_KEY:-lYkiYYT6owG+71oLerGzA7GXCgOT++6ovaezWAjpCjf+Sjc3ZtU+qUEi}
  80. MAX_PLUGIN_PACKAGE_SIZE: ${PLUGIN_MAX_PACKAGE_SIZE:-52428800}
  81. PPROF_ENABLED: ${PLUGIN_PPROF_ENABLED:-false}
  82. DIFY_INNER_API_URL: ${PLUGIN_DIFY_INNER_API_URL:-http://host.docker.internal:5001}
  83. DIFY_INNER_API_KEY: ${PLUGIN_DIFY_INNER_API_KEY:-QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691iy+kGDv2Jvy0/eAh8Y1}
  84. PLUGIN_REMOTE_INSTALLING_HOST: ${PLUGIN_DEBUGGING_HOST:-0.0.0.0}
  85. PLUGIN_REMOTE_INSTALLING_PORT: ${PLUGIN_DEBUGGING_PORT:-5003}
  86. PLUGIN_WORKING_PATH: ${PLUGIN_WORKING_PATH:-/app/storage/cwd}
  87. FORCE_VERIFYING_SIGNATURE: ${FORCE_VERIFYING_SIGNATURE:-true}
  88. ports:
  89. - "${EXPOSE_PLUGIN_DAEMON_PORT:-5002}:${PLUGIN_DAEMON_PORT:-5002}"
  90. - "${EXPOSE_PLUGIN_DEBUGGING_PORT:-5003}:${PLUGIN_DEBUGGING_PORT:-5003}"
  91. volumes:
  92. - ./volumes/plugin_daemon:/app/storage
  93. # ssrf_proxy server
  94. # for more information, please refer to
  95. # https://docs.dify.ai/learn-more/faq/install-faq#id-18.-why-is-ssrf_proxy-needed
  96. ssrf_proxy:
  97. image: ubuntu/squid:latest
  98. restart: always
  99. volumes:
  100. - ./ssrf_proxy/squid.conf.template:/etc/squid/squid.conf.template
  101. - ./ssrf_proxy/docker-entrypoint.sh:/docker-entrypoint-mount.sh
  102. entrypoint: [ "sh", "-c", "cp /docker-entrypoint-mount.sh /docker-entrypoint.sh && sed -i 's/\r$$//' /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh && /docker-entrypoint.sh" ]
  103. environment:
  104. # pls clearly modify the squid env vars to fit your network environment.
  105. HTTP_PORT: ${SSRF_HTTP_PORT:-3128}
  106. COREDUMP_DIR: ${SSRF_COREDUMP_DIR:-/var/spool/squid}
  107. REVERSE_PROXY_PORT: ${SSRF_REVERSE_PROXY_PORT:-8194}
  108. SANDBOX_HOST: ${SSRF_SANDBOX_HOST:-sandbox}
  109. SANDBOX_PORT: ${SANDBOX_PORT:-8194}
  110. ports:
  111. - "${EXPOSE_SSRF_PROXY_PORT:-3128}:${SSRF_HTTP_PORT:-3128}"
  112. - "${EXPOSE_SANDBOX_PORT:-8194}:${SANDBOX_PORT:-8194}"
  113. networks:
  114. - ssrf_proxy_network
  115. - default
  116. # The Weaviate vector store.
  117. weaviate:
  118. image: semitechnologies/weaviate:1.19.0
  119. profiles:
  120. - ""
  121. - weaviate
  122. restart: always
  123. volumes:
  124. # Mount the Weaviate data directory to the container.
  125. - ${WEAVIATE_HOST_VOLUME:-./volumes/weaviate}:/var/lib/weaviate
  126. env_file:
  127. - ./middleware.env
  128. environment:
  129. # The Weaviate configurations
  130. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  131. PERSISTENCE_DATA_PATH: ${WEAVIATE_PERSISTENCE_DATA_PATH:-/var/lib/weaviate}
  132. QUERY_DEFAULTS_LIMIT: ${WEAVIATE_QUERY_DEFAULTS_LIMIT:-25}
  133. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: ${WEAVIATE_AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED:-false}
  134. DEFAULT_VECTORIZER_MODULE: ${WEAVIATE_DEFAULT_VECTORIZER_MODULE:-none}
  135. CLUSTER_HOSTNAME: ${WEAVIATE_CLUSTER_HOSTNAME:-node1}
  136. AUTHENTICATION_APIKEY_ENABLED: ${WEAVIATE_AUTHENTICATION_APIKEY_ENABLED:-true}
  137. AUTHENTICATION_APIKEY_ALLOWED_KEYS: ${WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS:-WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih}
  138. AUTHENTICATION_APIKEY_USERS: ${WEAVIATE_AUTHENTICATION_APIKEY_USERS:-hello@dify.ai}
  139. AUTHORIZATION_ADMINLIST_ENABLED: ${WEAVIATE_AUTHORIZATION_ADMINLIST_ENABLED:-true}
  140. AUTHORIZATION_ADMINLIST_USERS: ${WEAVIATE_AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai}
  141. ports:
  142. - "${EXPOSE_WEAVIATE_PORT:-8080}:8080"
  143. networks:
  144. # create a network between sandbox, api and ssrf_proxy, and can not access outside.
  145. ssrf_proxy_network:
  146. driver: bridge
  147. internal: true