docker-compose.middleware.yaml 4.1 KB

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