docker-compose.middleware.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. - ./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. volumes:
  32. # Mount the redis data directory to the container.
  33. - ./volumes/redis/data:/data
  34. # Set the redis password when startup redis server.
  35. command: redis-server --requirepass difyai123456
  36. ports:
  37. - "${EXPOSE_REDIS_PORT:-6379}:6379"
  38. healthcheck:
  39. test: [ "CMD", "redis-cli", "ping" ]
  40. # The DifySandbox
  41. sandbox:
  42. image: langgenius/dify-sandbox:0.2.10
  43. restart: always
  44. environment:
  45. # The DifySandbox configurations
  46. # Make sure you are changing this key for your deployment with a strong key.
  47. # You can generate a strong key using `openssl rand -base64 42`.
  48. API_KEY: ${SANDBOX_API_KEY:-dify-sandbox}
  49. GIN_MODE: ${SANDBOX_GIN_MODE:-release}
  50. WORKER_TIMEOUT: ${SANDBOX_WORKER_TIMEOUT:-15}
  51. ENABLE_NETWORK: ${SANDBOX_ENABLE_NETWORK:-true}
  52. HTTP_PROXY: ${SANDBOX_HTTP_PROXY:-http://ssrf_proxy:3128}
  53. HTTPS_PROXY: ${SANDBOX_HTTPS_PROXY:-http://ssrf_proxy:3128}
  54. SANDBOX_PORT: ${SANDBOX_PORT:-8194}
  55. volumes:
  56. - ./volumes/sandbox/dependencies:/dependencies
  57. healthcheck:
  58. test: [ "CMD", "curl", "-f", "http://localhost:8194/health" ]
  59. networks:
  60. - ssrf_proxy_network
  61. # ssrf_proxy server
  62. # for more information, please refer to
  63. # https://docs.dify.ai/learn-more/faq/install-faq#id-18.-why-is-ssrf_proxy-needed
  64. ssrf_proxy:
  65. image: ubuntu/squid:latest
  66. restart: always
  67. volumes:
  68. - ./ssrf_proxy/squid.conf.template:/etc/squid/squid.conf.template
  69. - ./ssrf_proxy/docker-entrypoint.sh:/docker-entrypoint-mount.sh
  70. 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" ]
  71. environment:
  72. # pls clearly modify the squid env vars to fit your network environment.
  73. HTTP_PORT: ${SSRF_HTTP_PORT:-3128}
  74. COREDUMP_DIR: ${SSRF_COREDUMP_DIR:-/var/spool/squid}
  75. REVERSE_PROXY_PORT: ${SSRF_REVERSE_PROXY_PORT:-8194}
  76. SANDBOX_HOST: ${SSRF_SANDBOX_HOST:-sandbox}
  77. SANDBOX_PORT: ${SANDBOX_PORT:-8194}
  78. ports:
  79. - "${EXPOSE_SSRF_PROXY_PORT:-3128}:${SSRF_HTTP_PORT:-3128}"
  80. - "${EXPOSE_SANDBOX_PORT:-8194}:${SANDBOX_PORT:-8194}"
  81. networks:
  82. - ssrf_proxy_network
  83. - default
  84. # The Weaviate vector store.
  85. weaviate:
  86. image: semitechnologies/weaviate:1.19.0
  87. profiles:
  88. - ""
  89. - weaviate
  90. restart: always
  91. volumes:
  92. # Mount the Weaviate data directory to the container.
  93. - ./volumes/weaviate:/var/lib/weaviate
  94. env_file:
  95. - ./middleware.env
  96. environment:
  97. # The Weaviate configurations
  98. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  99. PERSISTENCE_DATA_PATH: ${WEAVIATE_PERSISTENCE_DATA_PATH:-/var/lib/weaviate}
  100. QUERY_DEFAULTS_LIMIT: ${WEAVIATE_QUERY_DEFAULTS_LIMIT:-25}
  101. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: ${WEAVIATE_AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED:-false}
  102. DEFAULT_VECTORIZER_MODULE: ${WEAVIATE_DEFAULT_VECTORIZER_MODULE:-none}
  103. CLUSTER_HOSTNAME: ${WEAVIATE_CLUSTER_HOSTNAME:-node1}
  104. AUTHENTICATION_APIKEY_ENABLED: ${WEAVIATE_AUTHENTICATION_APIKEY_ENABLED:-true}
  105. AUTHENTICATION_APIKEY_ALLOWED_KEYS: ${WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS:-WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih}
  106. AUTHENTICATION_APIKEY_USERS: ${WEAVIATE_AUTHENTICATION_APIKEY_USERS:-hello@dify.ai}
  107. AUTHORIZATION_ADMINLIST_ENABLED: ${WEAVIATE_AUTHORIZATION_ADMINLIST_ENABLED:-true}
  108. AUTHORIZATION_ADMINLIST_USERS: ${WEAVIATE_AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai}
  109. ports:
  110. - "${EXPOSE_WEAVIATE_PORT:-8080}:8080"
  111. networks:
  112. # create a network between sandbox, api and ssrf_proxy, and can not access outside.
  113. ssrf_proxy_network:
  114. driver: bridge
  115. internal: true