mirror of
https://github.com/okxlin/appstore.git
synced 2026-11-23 00:00:22 +00:00
Update langgenius/dify-web Docker tag to v1.20.0 (#9124)
* Update langgenius/dify-web Docker tag to v1.20.0 * Update app version [skip ci] * Complete Dify 1.20 component upgrade --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-action update-app-version <githubaction@githubaction.com> Co-authored-by: okxlin <61420215+okxlin@users.noreply.github.com>
This commit is contained in:
co-authored by
github-action update-app-version
okxlin
parent
4c17c5be87
commit
90e2906cb9
@@ -0,0 +1,309 @@
|
||||
# ------------------------------------------------------------------
|
||||
# Standalone helper for this packaged compose bundle.
|
||||
# 1Panel runtime does not load this file; 1Panel uses dify.env.
|
||||
#
|
||||
# For direct docker compose deployment, copy this file to .env and run:
|
||||
# docker compose up -d
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
# Package defaults
|
||||
PANEL_APP_PORT_HTTP=40288
|
||||
CONTAINER_NAME=dify
|
||||
APP_DATA_DIR=./data
|
||||
TZ=Asia/Shanghai
|
||||
CUSTOM_ENV_FILE=./data/custom.env
|
||||
PUBLIC_BASE_URL=
|
||||
|
||||
# Store dependency defaults
|
||||
PANEL_DB_TYPE=postgresql
|
||||
PANEL_DB_HOST=postgresql
|
||||
PANEL_DB_PORT=5432
|
||||
PANEL_DB_USER=dify
|
||||
PANEL_DB_USER_PASSWORD=difyai123456
|
||||
PANEL_DB_NAME=dify
|
||||
PANEL_REDIS_ROOT_PASSWORD=difyai123456
|
||||
|
||||
# Core service URLs
|
||||
CONSOLE_API_URL=
|
||||
SERVER_CONSOLE_API_URL=http://api:5001
|
||||
CONSOLE_WEB_URL=
|
||||
SERVICE_API_URL=
|
||||
TRIGGER_URL=/
|
||||
APP_API_URL=
|
||||
APP_WEB_URL=
|
||||
FILES_URL=
|
||||
INTERNAL_FILES_URL=
|
||||
ENDPOINT_URL_TEMPLATE=/e/{hook_id}
|
||||
NEXT_PUBLIC_SOCKET_URL=/
|
||||
|
||||
# Runtime and security
|
||||
LANG=C.UTF-8
|
||||
LC_ALL=C.UTF-8
|
||||
PYTHONIOENCODING=utf-8
|
||||
UV_CACHE_DIR=/tmp/.uv-cache
|
||||
# Leave empty to auto-generate a persistent key in the storage directory.
|
||||
SECRET_KEY=
|
||||
INIT_PASSWORD=
|
||||
DEPLOY_ENV=PRODUCTION
|
||||
CHECK_UPDATE_URL=https://updates.dify.ai
|
||||
OPENAI_API_BASE=https://api.openai.com/v1
|
||||
MIGRATION_ENABLED=true
|
||||
FILES_ACCESS_TIMEOUT=300
|
||||
# Remove `collaboration` from COMPOSE_PROFILES to stop the dedicated websocket service.
|
||||
ENABLE_COLLABORATION_MODE=false
|
||||
|
||||
# Learn app feature toggle
|
||||
ENABLE_LEARN_APP=true
|
||||
|
||||
# Logging and server workers
|
||||
LOG_LEVEL=INFO
|
||||
LOG_OUTPUT_FORMAT=text
|
||||
LOG_FILE=/app/logs/server.log
|
||||
LOG_FILE_MAX_SIZE=20
|
||||
LOG_FILE_BACKUP_COUNT=5
|
||||
LOG_DATEFORMAT=%Y-%m-%d %H:%M:%S
|
||||
LOG_TZ=UTC
|
||||
DEBUG=false
|
||||
FLASK_DEBUG=false
|
||||
ENABLE_REQUEST_LOGGING=False
|
||||
DIFY_BIND_ADDRESS=0.0.0.0
|
||||
DIFY_PORT=5001
|
||||
SERVER_WORKER_AMOUNT=1
|
||||
SERVER_WORKER_CLASS=gevent
|
||||
SERVER_WORKER_CONNECTIONS=10
|
||||
API_WEBSOCKET_WORKER_CLASS=geventwebsocket.gunicorn.workers.GeventWebSocketWorker
|
||||
API_WEBSOCKET_WORKER_CONNECTIONS=1000
|
||||
API_WEBSOCKET_GUNICORN_TIMEOUT=360
|
||||
GUNICORN_TIMEOUT=360
|
||||
CELERY_WORKER_CLASS=
|
||||
CELERY_WORKER_AMOUNT=4
|
||||
CELERY_AUTO_SCALE=false
|
||||
CELERY_MAX_WORKERS=
|
||||
CELERY_MIN_WORKERS=
|
||||
COMPOSE_WORKER_HEALTHCHECK_DISABLED=true
|
||||
COMPOSE_WORKER_HEALTHCHECK_INTERVAL=30s
|
||||
COMPOSE_WORKER_HEALTHCHECK_TIMEOUT=30s
|
||||
|
||||
# Database
|
||||
DB_TYPE=postgresql
|
||||
DB_USERNAME=dify
|
||||
DB_PASSWORD=difyai123456
|
||||
DB_HOST=postgresql
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=dify
|
||||
SQLALCHEMY_POOL_SIZE=30
|
||||
SQLALCHEMY_MAX_OVERFLOW=10
|
||||
SQLALCHEMY_POOL_RECYCLE=3600
|
||||
SQLALCHEMY_ECHO=false
|
||||
SQLALCHEMY_POOL_PRE_PING=false
|
||||
SQLALCHEMY_POOL_USE_LIFO=false
|
||||
SQLALCHEMY_POOL_TIMEOUT=30
|
||||
SQLALCHEMY_POOL_RESET_ON_RETURN=rollback
|
||||
PGDATA=/var/lib/postgresql/data/pgdata
|
||||
POSTGRES_MAX_CONNECTIONS=200
|
||||
POSTGRES_SHARED_BUFFERS=128MB
|
||||
POSTGRES_WORK_MEM=4MB
|
||||
POSTGRES_MAINTENANCE_WORK_MEM=64MB
|
||||
POSTGRES_EFFECTIVE_CACHE_SIZE=4096MB
|
||||
POSTGRES_STATEMENT_TIMEOUT=0
|
||||
POSTGRES_IDLE_IN_TRANSACTION_SESSION_TIMEOUT=0
|
||||
|
||||
# Redis and Celery
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_USERNAME=
|
||||
REDIS_PASSWORD=difyai123456
|
||||
REDIS_USE_SSL=false
|
||||
REDIS_SSL_CERT_REQS=CERT_NONE
|
||||
REDIS_SSL_CA_CERTS=
|
||||
REDIS_SSL_CERTFILE=
|
||||
REDIS_SSL_KEYFILE=
|
||||
REDIS_DB=0
|
||||
REDIS_KEY_PREFIX=
|
||||
REDIS_MAX_CONNECTIONS=
|
||||
REDIS_RETRY_RETRIES=3
|
||||
REDIS_RETRY_BACKOFF_BASE=1.0
|
||||
REDIS_RETRY_BACKOFF_CAP=10.0
|
||||
REDIS_SOCKET_TIMEOUT=5.0
|
||||
REDIS_SOCKET_CONNECT_TIMEOUT=5.0
|
||||
REDIS_HEALTH_CHECK_INTERVAL=30
|
||||
CELERY_BROKER_URL=redis://:difyai123456@redis:6379/1
|
||||
CELERY_BACKEND=redis
|
||||
BROKER_USE_SSL=false
|
||||
CELERY_TASK_ANNOTATIONS=null
|
||||
EVENT_BUS_REDIS_URL=
|
||||
EVENT_BUS_REDIS_CHANNEL_TYPE=pubsub
|
||||
EVENT_BUS_REDIS_USE_CLUSTERS=false
|
||||
|
||||
# Web and app limits
|
||||
WEB_API_CORS_ALLOW_ORIGINS=*
|
||||
CONSOLE_CORS_ALLOW_ORIGINS=*
|
||||
COOKIE_DOMAIN=
|
||||
NEXT_PUBLIC_COOKIE_DOMAIN=
|
||||
NEXT_PUBLIC_BATCH_CONCURRENCY=5
|
||||
API_SENTRY_DSN=
|
||||
API_SENTRY_TRACES_SAMPLE_RATE=1.0
|
||||
API_SENTRY_PROFILES_SAMPLE_RATE=1.0
|
||||
WEB_SENTRY_DSN=
|
||||
AMPLITUDE_API_KEY=
|
||||
TEXT_GENERATION_TIMEOUT_MS=60000
|
||||
CSP_WHITELIST=
|
||||
ALLOW_EMBED=false
|
||||
ALLOW_UNSAFE_DATA_SCHEME=false
|
||||
TOP_K_MAX_VALUE=10
|
||||
INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=4000
|
||||
LOOP_NODE_MAX_COUNT=100
|
||||
MAX_TOOLS_NUM=10
|
||||
MAX_PARALLEL_LIMIT=10
|
||||
MAX_ITERATIONS_NUM=99
|
||||
MAX_TREE_DEPTH=50
|
||||
ENABLE_WEBSITE_JINAREADER=true
|
||||
ENABLE_WEBSITE_FIRECRAWL=true
|
||||
ENABLE_WEBSITE_WATERCRAWL=true
|
||||
NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX=false
|
||||
# Enable preview features still in development (currently the /create and
|
||||
# /refine slash commands in the "Go to Anything" command palette).
|
||||
NEXT_PUBLIC_ENABLE_FEATURE_PREVIEW=true
|
||||
NEXT_PUBLIC_ENABLE_AGENT_V2=true
|
||||
EXPERIMENTAL_ENABLE_VINEXT=false
|
||||
WORKFLOW_GENERATION_TIMEOUT_MS=180000
|
||||
|
||||
# Dify Agent services
|
||||
# Replace these values before exposing a standalone Compose deployment.
|
||||
DIFY_AGENT_SHELLCTL_AUTH_TOKEN=
|
||||
DIFY_AGENT_SERVER_SECRET_KEY=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY
|
||||
|
||||
# Storage and default vector store
|
||||
STORAGE_TYPE=opendal
|
||||
OPENDAL_SCHEME=fs
|
||||
OPENDAL_FS_ROOT=storage
|
||||
VECTOR_STORE=weaviate
|
||||
VECTOR_INDEX_NAME_PREFIX=Vector_index
|
||||
WEAVIATE_ENDPOINT=http://weaviate:8080
|
||||
WEAVIATE_API_KEY=weaviate-change-me
|
||||
WEAVIATE_GRPC_ENDPOINT=grpc://weaviate:50051
|
||||
WEAVIATE_TOKENIZATION=word
|
||||
WEAVIATE_PERSISTENCE_DATA_PATH=/var/lib/weaviate
|
||||
WEAVIATE_QUERY_DEFAULTS_LIMIT=25
|
||||
WEAVIATE_AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=false
|
||||
WEAVIATE_DEFAULT_VECTORIZER_MODULE=none
|
||||
WEAVIATE_CLUSTER_HOSTNAME=node1
|
||||
WEAVIATE_AUTHENTICATION_APIKEY_ENABLED=true
|
||||
WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS=weaviate-change-me
|
||||
WEAVIATE_AUTHENTICATION_APIKEY_USERS=dify@local
|
||||
WEAVIATE_AUTHORIZATION_ADMINLIST_ENABLED=true
|
||||
WEAVIATE_AUTHORIZATION_ADMINLIST_USERS=dify@local
|
||||
WEAVIATE_DISABLE_TELEMETRY=false
|
||||
WEAVIATE_ENABLE_TOKENIZER_GSE=false
|
||||
WEAVIATE_ENABLE_TOKENIZER_KAGOME_JA=false
|
||||
WEAVIATE_ENABLE_TOKENIZER_KAGOME_KR=false
|
||||
|
||||
# Sandbox and SSRF proxy
|
||||
CODE_EXECUTION_ENDPOINT=http://sandbox:8194
|
||||
CODE_EXECUTION_API_KEY=dify-sandbox
|
||||
CODE_EXECUTION_SSL_VERIFY=True
|
||||
CODE_EXECUTION_POOL_MAX_CONNECTIONS=100
|
||||
CODE_EXECUTION_POOL_MAX_KEEPALIVE_CONNECTIONS=20
|
||||
CODE_EXECUTION_POOL_KEEPALIVE_EXPIRY=5.0
|
||||
CODE_EXECUTION_CONNECT_TIMEOUT=10
|
||||
CODE_EXECUTION_READ_TIMEOUT=60
|
||||
CODE_EXECUTION_WRITE_TIMEOUT=10
|
||||
SANDBOX_API_KEY=dify-sandbox
|
||||
SANDBOX_GIN_MODE=release
|
||||
SANDBOX_WORKER_TIMEOUT=15
|
||||
SANDBOX_ENABLE_NETWORK=true
|
||||
SANDBOX_HTTP_PROXY=http://ssrf_proxy:3128
|
||||
SANDBOX_HTTPS_PROXY=http://ssrf_proxy:3128
|
||||
SANDBOX_PORT=8194
|
||||
PIP_MIRROR_URL=
|
||||
SSRF_PROXY_HTTP_URL=http://ssrf_proxy:3128
|
||||
SSRF_PROXY_HTTPS_URL=http://ssrf_proxy:3128
|
||||
SSRF_HTTP_PORT=3128
|
||||
SSRF_COREDUMP_DIR=/var/spool/squid
|
||||
SSRF_DEFAULT_TIME_OUT=5
|
||||
SSRF_DEFAULT_CONNECT_TIME_OUT=5
|
||||
SSRF_DEFAULT_READ_TIME_OUT=5
|
||||
SSRF_DEFAULT_WRITE_TIME_OUT=5
|
||||
SSRF_POOL_MAX_CONNECTIONS=100
|
||||
SSRF_POOL_MAX_KEEPALIVE_CONNECTIONS=20
|
||||
SSRF_POOL_KEEPALIVE_EXPIRY=5.0
|
||||
|
||||
# Plugin daemon
|
||||
DB_PLUGIN_DATABASE=dify_plugin
|
||||
EXPOSE_PLUGIN_DAEMON_PORT=5002
|
||||
PLUGIN_DAEMON_PORT=5002
|
||||
PLUGIN_DAEMON_KEY=plugin-daemon-key-change-me
|
||||
PLUGIN_DAEMON_TIMEOUT=600.0
|
||||
PLUGIN_DAEMON_URL=http://plugin_daemon:5002
|
||||
PLUGIN_MAX_PACKAGE_SIZE=52428800
|
||||
PLUGIN_MODEL_SCHEMA_CACHE_TTL=3600
|
||||
PLUGIN_PPROF_ENABLED=false
|
||||
PLUGIN_DEBUGGING_HOST=0.0.0.0
|
||||
PLUGIN_DEBUGGING_PORT=5003
|
||||
PLUGIN_REMOTE_INSTALL_HOST=
|
||||
EXPOSE_PLUGIN_DEBUGGING_PORT=5003
|
||||
PLUGIN_DIFY_INNER_API_KEY=plugin-inner-api-key-change-me
|
||||
PLUGIN_DIFY_INNER_API_URL=http://api:5001
|
||||
FORCE_VERIFYING_SIGNATURE=true
|
||||
PLUGIN_STDIO_BUFFER_SIZE=1024
|
||||
PLUGIN_STDIO_MAX_BUFFER_SIZE=5242880
|
||||
PLUGIN_PYTHON_ENV_INIT_TIMEOUT=120
|
||||
PLUGIN_MAX_EXECUTION_TIMEOUT=600
|
||||
PLUGIN_STORAGE_TYPE=local
|
||||
PLUGIN_STORAGE_LOCAL_ROOT=/app/storage
|
||||
PLUGIN_WORKING_PATH=/app/storage/cwd
|
||||
PLUGIN_INSTALLED_PATH=plugin
|
||||
PLUGIN_PACKAGE_CACHE_PATH=plugin_packages
|
||||
PLUGIN_MEDIA_CACHE_PATH=assets
|
||||
PLUGIN_STORAGE_OSS_BUCKET=
|
||||
PLUGIN_S3_USE_AWS_MANAGED_IAM=false
|
||||
PLUGIN_S3_USE_AWS=false
|
||||
PLUGIN_S3_ENDPOINT=
|
||||
PLUGIN_S3_USE_PATH_STYLE=false
|
||||
PLUGIN_AWS_ACCESS_KEY=
|
||||
PLUGIN_AWS_SECRET_KEY=
|
||||
PLUGIN_AWS_REGION=
|
||||
PLUGIN_AZURE_BLOB_STORAGE_CONNECTION_STRING=
|
||||
PLUGIN_AZURE_BLOB_STORAGE_CONTAINER_NAME=
|
||||
PLUGIN_TENCENT_COS_SECRET_KEY=
|
||||
PLUGIN_TENCENT_COS_SECRET_ID=
|
||||
PLUGIN_TENCENT_COS_REGION=
|
||||
PLUGIN_ALIYUN_OSS_REGION=
|
||||
PLUGIN_ALIYUN_OSS_ENDPOINT=
|
||||
PLUGIN_ALIYUN_OSS_ACCESS_KEY_ID=
|
||||
PLUGIN_ALIYUN_OSS_ACCESS_KEY_SECRET=
|
||||
PLUGIN_ALIYUN_OSS_AUTH_VERSION=v4
|
||||
PLUGIN_ALIYUN_OSS_PATH=
|
||||
PLUGIN_VOLCENGINE_TOS_ENDPOINT=
|
||||
PLUGIN_VOLCENGINE_TOS_ACCESS_KEY=
|
||||
PLUGIN_VOLCENGINE_TOS_SECRET_KEY=
|
||||
PLUGIN_VOLCENGINE_TOS_REGION=
|
||||
PLUGIN_SENTRY_ENABLED=false
|
||||
PLUGIN_SENTRY_DSN=
|
||||
MARKETPLACE_ENABLED=true
|
||||
MARKETPLACE_API_URL=https://marketplace.dify.ai
|
||||
MARKETPLACE_URL=
|
||||
|
||||
# Nginx and Docker Compose
|
||||
NGINX_SERVER_NAME=_
|
||||
NGINX_HTTPS_ENABLED=false
|
||||
NGINX_PORT=80
|
||||
NGINX_SSL_PORT=443
|
||||
NGINX_SSL_CERT_FILENAME=dify.crt
|
||||
NGINX_SSL_CERT_KEY_FILENAME=dify.key
|
||||
NGINX_SSL_PROTOCOLS=TLSv1.2 TLSv1.3
|
||||
NGINX_WORKER_PROCESSES=auto
|
||||
NGINX_CLIENT_MAX_BODY_SIZE=100M
|
||||
NGINX_KEEPALIVE_TIMEOUT=65
|
||||
NGINX_PROXY_READ_TIMEOUT=3600s
|
||||
NGINX_PROXY_SEND_TIMEOUT=3600s
|
||||
NGINX_ENABLE_CERTBOT_CHALLENGE=false
|
||||
NGINX_SOCKET_IO_UPSTREAM=api_websocket:5001
|
||||
CERTBOT_DOMAIN=
|
||||
EXPOSE_NGINX_PORT=80
|
||||
EXPOSE_NGINX_SSL_PORT=443
|
||||
COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql},collaboration
|
||||
NEXT_TELEMETRY_DISABLED=0
|
||||
DB_SSL_MODE=disable
|
||||
SSRF_PROXY_ALLOW_PRIVATE_IPS=
|
||||
SSRF_PROXY_ALLOW_PRIVATE_DOMAINS=
|
||||
@@ -0,0 +1,426 @@
|
||||
additionalProperties:
|
||||
formFields:
|
||||
- default: 40288
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: HTTP Port
|
||||
labelZh: HTTP 端口
|
||||
label:
|
||||
en: HTTP Port
|
||||
zh: HTTP 端口
|
||||
zh-Hant: HTTP 埠
|
||||
ja: HTTP ポート
|
||||
ko: HTTP 포트
|
||||
ru: HTTP-порт
|
||||
ms: Port HTTP
|
||||
pt-br: Porta HTTP
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ./data
|
||||
edit: true
|
||||
envKey: APP_DATA_DIR
|
||||
labelEn: Data Directory
|
||||
labelZh: 数据目录
|
||||
label:
|
||||
en: Data Directory
|
||||
zh: 数据目录
|
||||
zh-Hant: 資料目錄
|
||||
ja: データディレクトリ
|
||||
ko: 데이터 디렉터리
|
||||
ru: Каталог данных
|
||||
ms: Direktori data
|
||||
pt-br: Diretório de dados
|
||||
required: true
|
||||
type: text
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Timezone
|
||||
labelZh: 时区
|
||||
label:
|
||||
en: Timezone
|
||||
zh: 时区
|
||||
zh-Hant: 時區
|
||||
ja: タイムゾーン
|
||||
ko: 시간대
|
||||
ru: Часовой пояс
|
||||
ms: Zon waktu
|
||||
pt-br: Fuso horário
|
||||
required: true
|
||||
type: text
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PUBLIC_BASE_URL
|
||||
labelEn: Public Base URL
|
||||
labelZh: 公网基础 URL
|
||||
label:
|
||||
en: Public Base URL
|
||||
zh: 公网基础 URL
|
||||
zh-Hant: 公網基礎 URL
|
||||
ja: 公開ベースURL
|
||||
ko: 공용 기본 URL
|
||||
ru: Публичный базовый URL
|
||||
ms: URL asas awam
|
||||
pt-br: URL base pública
|
||||
required: false
|
||||
type: text
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: INIT_PASSWORD
|
||||
labelEn: Initial Admin Password
|
||||
labelZh: 初始化管理员密码
|
||||
label:
|
||||
en: Initial Admin Password
|
||||
zh: 初始化管理员密码
|
||||
zh-Hant: 初始化管理員密碼
|
||||
ja: 初期管理者パスワード
|
||||
ko: 초기 관리자 비밀번호
|
||||
ru: Начальный пароль администратора
|
||||
ms: Kata laluan pentadbir awal
|
||||
pt-br: Senha inicial do administrador
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: "false"
|
||||
edit: true
|
||||
envKey: ENABLE_COLLABORATION_MODE
|
||||
labelEn: Collaboration Mode
|
||||
labelZh: 协作模式
|
||||
label:
|
||||
en: Collaboration Mode
|
||||
zh: 协作模式
|
||||
zh-Hant: 協作模式
|
||||
ja: コラボレーションモード
|
||||
ko: 협업 모드
|
||||
ru: Режим совместной работы
|
||||
ms: Mod kolaborasi
|
||||
pt-br: Modo de colaboração
|
||||
required: true
|
||||
type: select
|
||||
values:
|
||||
- label: Disabled
|
||||
value: "false"
|
||||
- label: Enabled
|
||||
value: "true"
|
||||
- child:
|
||||
default: ""
|
||||
envKey: PANEL_DB_HOST
|
||||
labelEn: PostgreSQL Service (15 recommended)
|
||||
labelZh: PostgreSQL 服务(建议 15)
|
||||
label:
|
||||
en: PostgreSQL Service (15 recommended)
|
||||
zh: PostgreSQL 服务(建议 15)
|
||||
zh-Hant: PostgreSQL 服務(建議 15)
|
||||
ja: PostgreSQL サービス
|
||||
ko: PostgreSQL 서비스
|
||||
ru: Сервис PostgreSQL
|
||||
ms: Perkhidmatan PostgreSQL
|
||||
pt-br: Serviço PostgreSQL
|
||||
required: true
|
||||
type: service
|
||||
default: postgresql
|
||||
envKey: PANEL_DB_TYPE
|
||||
labelEn: Database
|
||||
labelZh: 数据库服务
|
||||
label:
|
||||
en: Database
|
||||
zh: 数据库服务
|
||||
zh-Hant: 資料庫服務
|
||||
ja: データベース
|
||||
ko: 데이터베이스
|
||||
ru: База данных
|
||||
ms: Pangkalan Data
|
||||
pt-br: Banco de dados
|
||||
required: true
|
||||
type: apps
|
||||
values:
|
||||
- label: PostgreSQL
|
||||
value: postgresql
|
||||
- default: dify
|
||||
edit: true
|
||||
envKey: PANEL_DB_NAME
|
||||
labelEn: Database Name
|
||||
labelZh: 数据库名
|
||||
label:
|
||||
en: Database Name
|
||||
zh: 数据库名
|
||||
zh-Hant: 資料庫名
|
||||
ja: データベース名
|
||||
ko: 데이터베이스 이름
|
||||
ru: Имя базы данных
|
||||
ms: Nama pangkalan data
|
||||
pt-br: Nome do banco de dados
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: dify
|
||||
edit: true
|
||||
envKey: PANEL_DB_USER
|
||||
labelEn: Database User
|
||||
labelZh: 数据库用户
|
||||
label:
|
||||
en: Database User
|
||||
zh: 数据库用户
|
||||
zh-Hant: 資料庫用戶
|
||||
ja: データベースユーザー
|
||||
ko: 데이터베이스 사용자
|
||||
ru: Пользователь базы данных
|
||||
ms: Pengguna pangkalan data
|
||||
pt-br: Usuário do banco de dados
|
||||
random: true
|
||||
required: true
|
||||
rule: paramCommon
|
||||
type: text
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PANEL_DB_USER_PASSWORD
|
||||
labelEn: Database Password
|
||||
labelZh: 数据库用户密码
|
||||
label:
|
||||
en: Database Password
|
||||
zh: 数据库用户密码
|
||||
zh-Hant: 資料庫用戶密碼
|
||||
ja: データベースユーザーパスワード
|
||||
ko: 데이터베이스 사용자 비밀번호
|
||||
ru: Пароль пользователя базы данных
|
||||
ms: Kata laluan pengguna pangkalan data
|
||||
pt-br: Senha do usuário do banco de dados
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: 5432
|
||||
edit: true
|
||||
envKey: PANEL_DB_PORT
|
||||
labelEn: Database Port
|
||||
labelZh: 数据库端口
|
||||
label:
|
||||
en: Database Port
|
||||
zh: 数据库端口
|
||||
zh-Hant: 資料庫連接埠
|
||||
ja: データベースポート
|
||||
ko: 데이터베이스 포트
|
||||
ru: Порт базы данных
|
||||
ms: Port pangkalan data
|
||||
pt-br: Porta do banco de dados
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: REDIS_HOST
|
||||
key: redis
|
||||
labelEn: Redis Service
|
||||
labelZh: Redis 服务
|
||||
label:
|
||||
en: Redis Service
|
||||
zh: Redis 服务
|
||||
zh-Hant: Redis 服務
|
||||
ja: Redis サービス
|
||||
ko: Redis 서비스
|
||||
ru: Сервис Redis
|
||||
ms: Perkhidmatan Redis
|
||||
pt-br: Serviço Redis
|
||||
required: true
|
||||
type: service
|
||||
- default: 6379
|
||||
edit: true
|
||||
envKey: REDIS_PORT
|
||||
labelEn: Redis Port
|
||||
labelZh: Redis 端口
|
||||
label:
|
||||
en: Redis Port
|
||||
zh: Redis 端口
|
||||
zh-Hant: Redis 連接埠
|
||||
ja: Redis ポート
|
||||
ko: Redis 포트
|
||||
ru: Порт Redis
|
||||
ms: Port Redis
|
||||
pt-br: Porta Redis
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PANEL_REDIS_ROOT_PASSWORD
|
||||
labelEn: Redis Password
|
||||
labelZh: Redis 密码
|
||||
label:
|
||||
en: Redis Password
|
||||
zh: Redis 密码
|
||||
zh-Hant: Redis 密碼
|
||||
ja: Redis パスワード
|
||||
ko: Redis 비밀번호
|
||||
ru: Пароль Redis
|
||||
ms: Kata laluan Redis
|
||||
pt-br: Senha do Redis
|
||||
required: true
|
||||
type: password
|
||||
- default: 0
|
||||
edit: true
|
||||
envKey: REDIS_DB
|
||||
labelEn: Redis Database
|
||||
labelZh: Redis 数据库
|
||||
label:
|
||||
en: Redis Database
|
||||
zh: Redis 数据库
|
||||
zh-Hant: Redis 資料庫
|
||||
ja: Redis データベース
|
||||
ko: Redis 데이터베이스
|
||||
ru: База данных Redis
|
||||
ms: Pangkalan data Redis
|
||||
pt-br: Banco de dados Redis
|
||||
required: true
|
||||
type: number
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: SANDBOX_API_KEY
|
||||
labelEn: Sandbox API Key
|
||||
labelZh: Sandbox API 密钥
|
||||
label:
|
||||
en: Sandbox API Key
|
||||
zh: Sandbox API 密钥
|
||||
zh-Hant: Sandbox API 金鑰
|
||||
ja: Sandbox APIキー
|
||||
ko: Sandbox API 키
|
||||
ru: API-ключ Sandbox
|
||||
ms: Kunci API Sandbox
|
||||
pt-br: Chave da API do Sandbox
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PLUGIN_DAEMON_KEY
|
||||
labelEn: Plugin Daemon Key
|
||||
labelZh: Plugin Daemon 密钥
|
||||
label:
|
||||
en: Plugin Daemon Key
|
||||
zh: Plugin Daemon 密钥
|
||||
zh-Hant: Plugin Daemon 金鑰
|
||||
ja: Plugin Daemon キー
|
||||
ko: Plugin Daemon 키
|
||||
ru: Ключ Plugin Daemon
|
||||
ms: Kunci Plugin Daemon
|
||||
pt-br: Chave do Plugin Daemon
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: PLUGIN_DIFY_INNER_API_KEY
|
||||
labelEn: Plugin Inner API Key
|
||||
labelZh: Plugin 内部 API 密钥
|
||||
label:
|
||||
en: Plugin Inner API Key
|
||||
zh: Plugin 内部 API 密钥
|
||||
zh-Hant: Plugin 內部 API 金鑰
|
||||
ja: Plugin 内部APIキー
|
||||
ko: Plugin 내부 API 키
|
||||
ru: Внутренний API-ключ Plugin
|
||||
ms: Kunci API dalaman Plugin
|
||||
pt-br: Chave interna da API do Plugin
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: DIFY_AGENT_SHELLCTL_AUTH_TOKEN
|
||||
labelEn: Agent Sandbox Auth Token
|
||||
labelZh: Agent 沙箱认证令牌
|
||||
label:
|
||||
en: Agent Sandbox Auth Token
|
||||
zh: Agent 沙箱认证令牌
|
||||
zh-Hant: Agent 沙箱驗證權杖
|
||||
ja: Agent サンドボックス認証トークン
|
||||
ko: Agent 샌드박스 인증 토큰
|
||||
ru: Токен доступа к песочнице Agent
|
||||
ms: Token Pengesahan Kotak Pasir Agent
|
||||
pt-br: Token de Autenticacao do Sandbox do Agent
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: DIFY_AGENT_SERVER_SECRET_KEY
|
||||
labelEn: Agent Server Secret Key (32-byte Base64URL)
|
||||
labelZh: Agent 服务端加密密钥(32 字节 Base64URL)
|
||||
label:
|
||||
en: Agent Server Secret Key (32-byte Base64URL)
|
||||
zh: Agent 服务端加密密钥(32 字节 Base64URL)
|
||||
zh-Hant: Agent 伺服器加密金鑰(32 位元組 Base64URL)
|
||||
ja: Agent サーバー暗号化キー(32バイト Base64URL)
|
||||
ko: Agent 서버 암호화 키(32바이트 Base64URL)
|
||||
ru: Ключ сервера Agent (Base64URL, 32 байта)
|
||||
ms: Kunci Rahsia Pelayan Agent (Base64URL 32 bait)
|
||||
pt-br: Chave Secreta do Servidor Agent (Base64URL de 32 bytes)
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: ""
|
||||
edit: true
|
||||
envKey: WEAVIATE_API_KEY
|
||||
labelEn: Weaviate API Key
|
||||
labelZh: Weaviate API 密钥
|
||||
label:
|
||||
en: Weaviate API Key
|
||||
zh: Weaviate API 密钥
|
||||
zh-Hant: Weaviate API 金鑰
|
||||
ja: Weaviate APIキー
|
||||
ko: Weaviate API 키
|
||||
ru: API-ключ Weaviate
|
||||
ms: Kunci API Weaviate
|
||||
pt-br: Chave da API do Weaviate
|
||||
random: true
|
||||
required: true
|
||||
rule: paramComplexity
|
||||
type: password
|
||||
- default: INFO
|
||||
edit: true
|
||||
envKey: LOG_LEVEL
|
||||
labelEn: Log Level
|
||||
labelZh: 日志级别
|
||||
label:
|
||||
en: Log Level
|
||||
zh: 日志级别
|
||||
zh-Hant: 日誌級別
|
||||
ja: ログレベル
|
||||
ko: 로그 수준
|
||||
ru: Уровень логирования
|
||||
ms: Tahap log
|
||||
pt-br: Nivel de log
|
||||
required: true
|
||||
type: select
|
||||
values:
|
||||
- label: INFO
|
||||
value: INFO
|
||||
- label: DEBUG
|
||||
value: DEBUG
|
||||
- label: WARNING
|
||||
value: WARNING
|
||||
- label: ERROR
|
||||
value: ERROR
|
||||
- default: ./data/custom.env
|
||||
edit: true
|
||||
envKey: CUSTOM_ENV_FILE
|
||||
labelEn: Custom Env File
|
||||
labelZh: 自定义环境变量文件
|
||||
label:
|
||||
en: Custom Env File
|
||||
zh: 自定义环境变量文件
|
||||
zh-Hant: 自訂環境變數文件
|
||||
ja: カスタム環境変数ファイル
|
||||
ko: 사용자 지정 환경 변수 파일
|
||||
ru: Пользовательский файл переменных окружения
|
||||
ms: Fail env tersuai
|
||||
pt-br: Arquivo env personalizado
|
||||
required: false
|
||||
type: text
|
||||
@@ -0,0 +1,311 @@
|
||||
# ------------------------------------------------------------------
|
||||
# Runtime defaults for this 1Panel package.
|
||||
# 1Panel loads this file automatically via docker-compose.yml.
|
||||
#
|
||||
# For direct docker compose deployment of this package, copy this file
|
||||
# to .env or adjust docker-compose.yml to reference dify.env directly:
|
||||
# docker compose up -d
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
# 1Panel runtime defaults
|
||||
PANEL_APP_PORT_HTTP=40288
|
||||
CONTAINER_NAME=dify
|
||||
APP_DATA_DIR=./data
|
||||
TZ=Asia/Shanghai
|
||||
CUSTOM_ENV_FILE=./data/custom.env
|
||||
PUBLIC_BASE_URL=
|
||||
|
||||
# Store dependency defaults
|
||||
PANEL_DB_TYPE=postgresql
|
||||
PANEL_DB_HOST=postgresql
|
||||
PANEL_DB_PORT=5432
|
||||
PANEL_DB_USER=dify
|
||||
PANEL_DB_USER_PASSWORD=difyai123456
|
||||
PANEL_DB_NAME=dify
|
||||
PANEL_REDIS_ROOT_PASSWORD=difyai123456
|
||||
|
||||
# Core service URLs
|
||||
CONSOLE_API_URL=
|
||||
SERVER_CONSOLE_API_URL=http://api:5001
|
||||
CONSOLE_WEB_URL=
|
||||
SERVICE_API_URL=
|
||||
TRIGGER_URL=/
|
||||
APP_API_URL=
|
||||
APP_WEB_URL=
|
||||
FILES_URL=
|
||||
INTERNAL_FILES_URL=
|
||||
ENDPOINT_URL_TEMPLATE=/e/{hook_id}
|
||||
NEXT_PUBLIC_SOCKET_URL=/
|
||||
|
||||
# Runtime and security
|
||||
LANG=C.UTF-8
|
||||
LC_ALL=C.UTF-8
|
||||
PYTHONIOENCODING=utf-8
|
||||
UV_CACHE_DIR=/tmp/.uv-cache
|
||||
# Leave empty to auto-generate a persistent key in the storage directory.
|
||||
SECRET_KEY=
|
||||
INIT_PASSWORD=
|
||||
DEPLOY_ENV=PRODUCTION
|
||||
CHECK_UPDATE_URL=https://updates.dify.ai
|
||||
OPENAI_API_BASE=https://api.openai.com/v1
|
||||
MIGRATION_ENABLED=true
|
||||
FILES_ACCESS_TIMEOUT=300
|
||||
# Remove `collaboration` from COMPOSE_PROFILES to stop the dedicated websocket service.
|
||||
ENABLE_COLLABORATION_MODE=false
|
||||
|
||||
# Learn app feature toggle
|
||||
ENABLE_LEARN_APP=true
|
||||
|
||||
# Logging and server workers
|
||||
LOG_LEVEL=INFO
|
||||
LOG_OUTPUT_FORMAT=text
|
||||
LOG_FILE=/app/logs/server.log
|
||||
LOG_FILE_MAX_SIZE=20
|
||||
LOG_FILE_BACKUP_COUNT=5
|
||||
LOG_DATEFORMAT=%Y-%m-%d %H:%M:%S
|
||||
LOG_TZ=UTC
|
||||
DEBUG=false
|
||||
FLASK_DEBUG=false
|
||||
ENABLE_REQUEST_LOGGING=False
|
||||
DIFY_BIND_ADDRESS=0.0.0.0
|
||||
DIFY_PORT=5001
|
||||
SERVER_WORKER_AMOUNT=1
|
||||
SERVER_WORKER_CLASS=gevent
|
||||
SERVER_WORKER_CONNECTIONS=10
|
||||
API_WEBSOCKET_WORKER_CLASS=geventwebsocket.gunicorn.workers.GeventWebSocketWorker
|
||||
API_WEBSOCKET_WORKER_CONNECTIONS=1000
|
||||
API_WEBSOCKET_GUNICORN_TIMEOUT=360
|
||||
GUNICORN_TIMEOUT=360
|
||||
CELERY_WORKER_CLASS=
|
||||
CELERY_WORKER_AMOUNT=4
|
||||
CELERY_AUTO_SCALE=false
|
||||
CELERY_MAX_WORKERS=
|
||||
CELERY_MIN_WORKERS=
|
||||
COMPOSE_WORKER_HEALTHCHECK_DISABLED=true
|
||||
COMPOSE_WORKER_HEALTHCHECK_INTERVAL=30s
|
||||
COMPOSE_WORKER_HEALTHCHECK_TIMEOUT=30s
|
||||
|
||||
# Database
|
||||
DB_TYPE=postgresql
|
||||
DB_USERNAME=dify
|
||||
DB_PASSWORD=difyai123456
|
||||
DB_HOST=postgresql
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=dify
|
||||
SQLALCHEMY_POOL_SIZE=30
|
||||
SQLALCHEMY_MAX_OVERFLOW=10
|
||||
SQLALCHEMY_POOL_RECYCLE=3600
|
||||
SQLALCHEMY_ECHO=false
|
||||
SQLALCHEMY_POOL_PRE_PING=false
|
||||
SQLALCHEMY_POOL_USE_LIFO=false
|
||||
SQLALCHEMY_POOL_TIMEOUT=30
|
||||
SQLALCHEMY_POOL_RESET_ON_RETURN=rollback
|
||||
PGDATA=/var/lib/postgresql/data/pgdata
|
||||
POSTGRES_MAX_CONNECTIONS=200
|
||||
POSTGRES_SHARED_BUFFERS=128MB
|
||||
POSTGRES_WORK_MEM=4MB
|
||||
POSTGRES_MAINTENANCE_WORK_MEM=64MB
|
||||
POSTGRES_EFFECTIVE_CACHE_SIZE=4096MB
|
||||
POSTGRES_STATEMENT_TIMEOUT=0
|
||||
POSTGRES_IDLE_IN_TRANSACTION_SESSION_TIMEOUT=0
|
||||
|
||||
# Redis and Celery
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_USERNAME=
|
||||
REDIS_PASSWORD=difyai123456
|
||||
REDIS_USE_SSL=false
|
||||
REDIS_SSL_CERT_REQS=CERT_NONE
|
||||
REDIS_SSL_CA_CERTS=
|
||||
REDIS_SSL_CERTFILE=
|
||||
REDIS_SSL_KEYFILE=
|
||||
REDIS_DB=0
|
||||
REDIS_KEY_PREFIX=
|
||||
REDIS_MAX_CONNECTIONS=
|
||||
REDIS_RETRY_RETRIES=3
|
||||
REDIS_RETRY_BACKOFF_BASE=1.0
|
||||
REDIS_RETRY_BACKOFF_CAP=10.0
|
||||
REDIS_SOCKET_TIMEOUT=5.0
|
||||
REDIS_SOCKET_CONNECT_TIMEOUT=5.0
|
||||
REDIS_HEALTH_CHECK_INTERVAL=30
|
||||
CELERY_BROKER_URL=redis://:difyai123456@redis:6379/1
|
||||
CELERY_BACKEND=redis
|
||||
BROKER_USE_SSL=false
|
||||
CELERY_TASK_ANNOTATIONS=null
|
||||
EVENT_BUS_REDIS_URL=
|
||||
EVENT_BUS_REDIS_CHANNEL_TYPE=pubsub
|
||||
EVENT_BUS_REDIS_USE_CLUSTERS=false
|
||||
|
||||
# Web and app limits
|
||||
WEB_API_CORS_ALLOW_ORIGINS=*
|
||||
CONSOLE_CORS_ALLOW_ORIGINS=*
|
||||
COOKIE_DOMAIN=
|
||||
NEXT_PUBLIC_COOKIE_DOMAIN=
|
||||
NEXT_PUBLIC_BATCH_CONCURRENCY=5
|
||||
API_SENTRY_DSN=
|
||||
API_SENTRY_TRACES_SAMPLE_RATE=1.0
|
||||
API_SENTRY_PROFILES_SAMPLE_RATE=1.0
|
||||
WEB_SENTRY_DSN=
|
||||
AMPLITUDE_API_KEY=
|
||||
TEXT_GENERATION_TIMEOUT_MS=60000
|
||||
CSP_WHITELIST=
|
||||
ALLOW_EMBED=false
|
||||
ALLOW_UNSAFE_DATA_SCHEME=false
|
||||
TOP_K_MAX_VALUE=10
|
||||
INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=4000
|
||||
LOOP_NODE_MAX_COUNT=100
|
||||
MAX_TOOLS_NUM=10
|
||||
MAX_PARALLEL_LIMIT=10
|
||||
MAX_ITERATIONS_NUM=99
|
||||
MAX_TREE_DEPTH=50
|
||||
ENABLE_WEBSITE_JINAREADER=true
|
||||
ENABLE_WEBSITE_FIRECRAWL=true
|
||||
ENABLE_WEBSITE_WATERCRAWL=true
|
||||
NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX=false
|
||||
# Enable preview features still in development (currently the /create and
|
||||
# /refine slash commands in the "Go to Anything" command palette).
|
||||
NEXT_PUBLIC_ENABLE_FEATURE_PREVIEW=true
|
||||
NEXT_PUBLIC_ENABLE_AGENT_V2=true
|
||||
EXPERIMENTAL_ENABLE_VINEXT=false
|
||||
WORKFLOW_GENERATION_TIMEOUT_MS=180000
|
||||
|
||||
# Dify Agent services
|
||||
DIFY_AGENT_SHELLCTL_AUTH_TOKEN=
|
||||
DIFY_AGENT_SERVER_SECRET_KEY=
|
||||
|
||||
# Storage and default vector store
|
||||
STORAGE_TYPE=opendal
|
||||
OPENDAL_SCHEME=fs
|
||||
OPENDAL_FS_ROOT=storage
|
||||
VECTOR_STORE=weaviate
|
||||
VECTOR_INDEX_NAME_PREFIX=Vector_index
|
||||
WEAVIATE_ENDPOINT=http://weaviate:8080
|
||||
WEAVIATE_API_KEY=weaviate-change-me
|
||||
WEAVIATE_GRPC_ENDPOINT=grpc://weaviate:50051
|
||||
WEAVIATE_TOKENIZATION=word
|
||||
WEAVIATE_PERSISTENCE_DATA_PATH=/var/lib/weaviate
|
||||
WEAVIATE_QUERY_DEFAULTS_LIMIT=25
|
||||
WEAVIATE_AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=false
|
||||
WEAVIATE_DEFAULT_VECTORIZER_MODULE=none
|
||||
WEAVIATE_CLUSTER_HOSTNAME=node1
|
||||
WEAVIATE_AUTHENTICATION_APIKEY_ENABLED=true
|
||||
WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS=weaviate-change-me
|
||||
WEAVIATE_AUTHENTICATION_APIKEY_USERS=dify@local
|
||||
WEAVIATE_AUTHORIZATION_ADMINLIST_ENABLED=true
|
||||
WEAVIATE_AUTHORIZATION_ADMINLIST_USERS=dify@local
|
||||
WEAVIATE_DISABLE_TELEMETRY=false
|
||||
WEAVIATE_ENABLE_TOKENIZER_GSE=false
|
||||
WEAVIATE_ENABLE_TOKENIZER_KAGOME_JA=false
|
||||
WEAVIATE_ENABLE_TOKENIZER_KAGOME_KR=false
|
||||
|
||||
# Sandbox and SSRF proxy
|
||||
CODE_EXECUTION_ENDPOINT=http://sandbox:8194
|
||||
CODE_EXECUTION_API_KEY=dify-sandbox
|
||||
CODE_EXECUTION_SSL_VERIFY=True
|
||||
CODE_EXECUTION_POOL_MAX_CONNECTIONS=100
|
||||
CODE_EXECUTION_POOL_MAX_KEEPALIVE_CONNECTIONS=20
|
||||
CODE_EXECUTION_POOL_KEEPALIVE_EXPIRY=5.0
|
||||
CODE_EXECUTION_CONNECT_TIMEOUT=10
|
||||
CODE_EXECUTION_READ_TIMEOUT=60
|
||||
CODE_EXECUTION_WRITE_TIMEOUT=10
|
||||
SANDBOX_API_KEY=dify-sandbox
|
||||
SANDBOX_GIN_MODE=release
|
||||
SANDBOX_WORKER_TIMEOUT=15
|
||||
SANDBOX_ENABLE_NETWORK=true
|
||||
SANDBOX_HTTP_PROXY=http://ssrf_proxy:3128
|
||||
SANDBOX_HTTPS_PROXY=http://ssrf_proxy:3128
|
||||
SANDBOX_PORT=8194
|
||||
PIP_MIRROR_URL=
|
||||
SSRF_PROXY_HTTP_URL=http://ssrf_proxy:3128
|
||||
SSRF_PROXY_HTTPS_URL=http://ssrf_proxy:3128
|
||||
SSRF_HTTP_PORT=3128
|
||||
SSRF_COREDUMP_DIR=/var/spool/squid
|
||||
SSRF_DEFAULT_TIME_OUT=5
|
||||
SSRF_DEFAULT_CONNECT_TIME_OUT=5
|
||||
SSRF_DEFAULT_READ_TIME_OUT=5
|
||||
SSRF_DEFAULT_WRITE_TIME_OUT=5
|
||||
SSRF_POOL_MAX_CONNECTIONS=100
|
||||
SSRF_POOL_MAX_KEEPALIVE_CONNECTIONS=20
|
||||
SSRF_POOL_KEEPALIVE_EXPIRY=5.0
|
||||
|
||||
# Plugin daemon
|
||||
DB_PLUGIN_DATABASE=dify_plugin
|
||||
EXPOSE_PLUGIN_DAEMON_PORT=5002
|
||||
PLUGIN_DAEMON_PORT=5002
|
||||
PLUGIN_DAEMON_KEY=plugin-daemon-key-change-me
|
||||
PLUGIN_DAEMON_TIMEOUT=600.0
|
||||
PLUGIN_DAEMON_URL=http://plugin_daemon:5002
|
||||
PLUGIN_MAX_PACKAGE_SIZE=52428800
|
||||
PLUGIN_MODEL_SCHEMA_CACHE_TTL=3600
|
||||
PLUGIN_PPROF_ENABLED=false
|
||||
PLUGIN_DEBUGGING_HOST=0.0.0.0
|
||||
PLUGIN_DEBUGGING_PORT=5003
|
||||
PLUGIN_REMOTE_INSTALL_HOST=
|
||||
EXPOSE_PLUGIN_DEBUGGING_PORT=5003
|
||||
PLUGIN_DIFY_INNER_API_KEY=plugin-inner-api-key-change-me
|
||||
PLUGIN_DIFY_INNER_API_URL=http://api:5001
|
||||
FORCE_VERIFYING_SIGNATURE=true
|
||||
PLUGIN_STDIO_BUFFER_SIZE=1024
|
||||
PLUGIN_STDIO_MAX_BUFFER_SIZE=5242880
|
||||
PLUGIN_PYTHON_ENV_INIT_TIMEOUT=120
|
||||
PLUGIN_MAX_EXECUTION_TIMEOUT=600
|
||||
PLUGIN_STORAGE_TYPE=local
|
||||
PLUGIN_STORAGE_LOCAL_ROOT=/app/storage
|
||||
PLUGIN_WORKING_PATH=/app/storage/cwd
|
||||
PLUGIN_INSTALLED_PATH=plugin
|
||||
PLUGIN_PACKAGE_CACHE_PATH=plugin_packages
|
||||
PLUGIN_MEDIA_CACHE_PATH=assets
|
||||
PLUGIN_STORAGE_OSS_BUCKET=
|
||||
PLUGIN_S3_USE_AWS_MANAGED_IAM=false
|
||||
PLUGIN_S3_USE_AWS=false
|
||||
PLUGIN_S3_ENDPOINT=
|
||||
PLUGIN_S3_USE_PATH_STYLE=false
|
||||
PLUGIN_AWS_ACCESS_KEY=
|
||||
PLUGIN_AWS_SECRET_KEY=
|
||||
PLUGIN_AWS_REGION=
|
||||
PLUGIN_AZURE_BLOB_STORAGE_CONNECTION_STRING=
|
||||
PLUGIN_AZURE_BLOB_STORAGE_CONTAINER_NAME=
|
||||
PLUGIN_TENCENT_COS_SECRET_KEY=
|
||||
PLUGIN_TENCENT_COS_SECRET_ID=
|
||||
PLUGIN_TENCENT_COS_REGION=
|
||||
PLUGIN_ALIYUN_OSS_REGION=
|
||||
PLUGIN_ALIYUN_OSS_ENDPOINT=
|
||||
PLUGIN_ALIYUN_OSS_ACCESS_KEY_ID=
|
||||
PLUGIN_ALIYUN_OSS_ACCESS_KEY_SECRET=
|
||||
PLUGIN_ALIYUN_OSS_AUTH_VERSION=v4
|
||||
PLUGIN_ALIYUN_OSS_PATH=
|
||||
PLUGIN_VOLCENGINE_TOS_ENDPOINT=
|
||||
PLUGIN_VOLCENGINE_TOS_ACCESS_KEY=
|
||||
PLUGIN_VOLCENGINE_TOS_SECRET_KEY=
|
||||
PLUGIN_VOLCENGINE_TOS_REGION=
|
||||
PLUGIN_SENTRY_ENABLED=false
|
||||
PLUGIN_SENTRY_DSN=
|
||||
|
||||
# Marketplace
|
||||
MARKETPLACE_ENABLED=true
|
||||
MARKETPLACE_API_URL=https://marketplace.dify.ai
|
||||
MARKETPLACE_URL=
|
||||
|
||||
# Nginx and Docker Compose
|
||||
NGINX_SERVER_NAME=_
|
||||
NGINX_HTTPS_ENABLED=false
|
||||
NGINX_PORT=80
|
||||
NGINX_SSL_PORT=443
|
||||
NGINX_SSL_CERT_FILENAME=dify.crt
|
||||
NGINX_SSL_CERT_KEY_FILENAME=dify.key
|
||||
NGINX_SSL_PROTOCOLS=TLSv1.2 TLSv1.3
|
||||
NGINX_WORKER_PROCESSES=auto
|
||||
NGINX_CLIENT_MAX_BODY_SIZE=100M
|
||||
NGINX_KEEPALIVE_TIMEOUT=65
|
||||
NGINX_PROXY_READ_TIMEOUT=3600s
|
||||
NGINX_PROXY_SEND_TIMEOUT=3600s
|
||||
NGINX_ENABLE_CERTBOT_CHALLENGE=false
|
||||
NGINX_SOCKET_IO_UPSTREAM=api_websocket:5001
|
||||
CERTBOT_DOMAIN=
|
||||
EXPOSE_NGINX_PORT=80
|
||||
EXPOSE_NGINX_SSL_PORT=443
|
||||
COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql},collaboration
|
||||
NEXT_TELEMETRY_DISABLED=0
|
||||
DB_SSL_MODE=disable
|
||||
SSRF_PROXY_ALLOW_PRIVATE_IPS=
|
||||
SSRF_PROXY_ALLOW_PRIVATE_DOMAINS=
|
||||
@@ -0,0 +1,521 @@
|
||||
services:
|
||||
init_permissions:
|
||||
image: "busybox:latest"
|
||||
container_name: ${CONTAINER_NAME}-init
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
for DIR in /app/api/storage /app/plugin_daemon/storage; do
|
||||
FLAG_FILE="$${DIR}/.init_permissions"
|
||||
if [ -f "$${FLAG_FILE}" ]; then
|
||||
echo "Permissions already initialized for $${DIR}."
|
||||
continue
|
||||
fi
|
||||
echo "Initializing permissions for $${DIR}"
|
||||
chown -R 1001:1001 "$${DIR}" && touch "$${FLAG_FILE}" || exit 1
|
||||
done
|
||||
for DIR in /home/dify /workspace; do
|
||||
FLAG_FILE="$${DIR}/.init_permissions"
|
||||
if [ -f "$${FLAG_FILE}" ]; then
|
||||
echo "Permissions already initialized for $${DIR}."
|
||||
continue
|
||||
fi
|
||||
echo "Initializing permissions for $${DIR}"
|
||||
chown -R 1000:1000 "$${DIR}" && touch "$${FLAG_FILE}" || exit 1
|
||||
done
|
||||
echo "Permissions initialized. Exiting."
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/app/storage:/app/api/storage
|
||||
- ${APP_DATA_DIR}/plugin_daemon:/app/plugin_daemon/storage
|
||||
- ${APP_DATA_DIR}/agent_local_sandbox/home:/home/dify
|
||||
- ${APP_DATA_DIR}/agent_local_sandbox/workspace:/workspace
|
||||
restart: "no"
|
||||
|
||||
api:
|
||||
image: "langgenius/dify-api:1.20.0"
|
||||
container_name: ${CONTAINER_NAME}-api
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: &dify-env
|
||||
- path: ./dify.env
|
||||
required: true
|
||||
- path: ${CUSTOM_ENV_FILE}
|
||||
required: false
|
||||
- path: ./.env
|
||||
required: false
|
||||
environment:
|
||||
- MODE=api
|
||||
- DB_HOST=${PANEL_DB_HOST}
|
||||
- DB_PORT=${PANEL_DB_PORT}
|
||||
- DB_USERNAME=${PANEL_DB_USER}
|
||||
- DB_PASSWORD=${PANEL_DB_USER_PASSWORD}
|
||||
- DB_DATABASE=${PANEL_DB_NAME}
|
||||
- REDIS_HOST=${REDIS_HOST}
|
||||
- REDIS_PORT=${REDIS_PORT}
|
||||
- REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
|
||||
- REDIS_DB=${REDIS_DB}
|
||||
- INNER_API_KEY_FOR_PLUGIN=${PLUGIN_DIFY_INNER_API_KEY}
|
||||
- CELERY_BROKER_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/1
|
||||
- CODE_EXECUTION_API_KEY=${SANDBOX_API_KEY}
|
||||
- PLUGIN_REMOTE_INSTALL_PORT=5003
|
||||
- AGENT_BACKEND_BASE_URL=http://agent_backend:5050
|
||||
- AGENT_BACKEND_STREAM_READ_TIMEOUT_SECONDS=30
|
||||
- AGENT_BACKEND_STREAM_MAX_RECONNECTS=3
|
||||
- AGENT_BACKEND_RUN_TIMEOUT_SECONDS=1200
|
||||
- SENTRY_DSN=
|
||||
- SENTRY_TRACES_SAMPLE_RATE=1.0
|
||||
- SENTRY_PROFILES_SAMPLE_RATE=1.0
|
||||
depends_on:
|
||||
init_permissions:
|
||||
condition: service_completed_successfully
|
||||
agent_backend:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/app/storage:/app/api/storage
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- curl
|
||||
- -f
|
||||
- http://localhost:5001/health
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
networks:
|
||||
- ssrf_proxy_network
|
||||
- default
|
||||
- 1panel-network
|
||||
|
||||
api_websocket:
|
||||
image: "langgenius/dify-api:1.20.0"
|
||||
container_name: ${CONTAINER_NAME}-websocket
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: *dify-env
|
||||
environment:
|
||||
- MODE=api
|
||||
- DB_HOST=${PANEL_DB_HOST}
|
||||
- DB_PORT=${PANEL_DB_PORT}
|
||||
- DB_USERNAME=${PANEL_DB_USER}
|
||||
- DB_PASSWORD=${PANEL_DB_USER_PASSWORD}
|
||||
- DB_DATABASE=${PANEL_DB_NAME}
|
||||
- REDIS_HOST=${REDIS_HOST}
|
||||
- REDIS_PORT=${REDIS_PORT}
|
||||
- REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
|
||||
- REDIS_DB=${REDIS_DB}
|
||||
- MIGRATION_ENABLED=false
|
||||
- SERVER_WORKER_AMOUNT=1
|
||||
- SERVER_WORKER_CLASS=geventwebsocket.gunicorn.workers.GeventWebSocketWorker
|
||||
- SERVER_WORKER_CONNECTIONS=1000
|
||||
- GUNICORN_TIMEOUT=360
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- ssrf_proxy_network
|
||||
- default
|
||||
- 1panel-network
|
||||
|
||||
worker:
|
||||
image: "langgenius/dify-api:1.20.0"
|
||||
container_name: ${CONTAINER_NAME}-worker
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: *dify-env
|
||||
environment:
|
||||
- MODE=worker
|
||||
- DB_HOST=${PANEL_DB_HOST}
|
||||
- DB_PORT=${PANEL_DB_PORT}
|
||||
- DB_USERNAME=${PANEL_DB_USER}
|
||||
- DB_PASSWORD=${PANEL_DB_USER_PASSWORD}
|
||||
- DB_DATABASE=${PANEL_DB_NAME}
|
||||
- REDIS_HOST=${REDIS_HOST}
|
||||
- REDIS_PORT=${REDIS_PORT}
|
||||
- REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
|
||||
- REDIS_DB=${REDIS_DB}
|
||||
- MIGRATION_ENABLED=false
|
||||
- INNER_API_KEY_FOR_PLUGIN=${PLUGIN_DIFY_INNER_API_KEY}
|
||||
- CELERY_BROKER_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/1
|
||||
- CODE_EXECUTION_API_KEY=${SANDBOX_API_KEY}
|
||||
- PLUGIN_MAX_PACKAGE_SIZE=52428800
|
||||
- AGENT_BACKEND_BASE_URL=http://agent_backend:5050
|
||||
- AGENT_BACKEND_STREAM_READ_TIMEOUT_SECONDS=30
|
||||
- AGENT_BACKEND_STREAM_MAX_RECONNECTS=3
|
||||
- AGENT_BACKEND_RUN_TIMEOUT_SECONDS=1200
|
||||
- SENTRY_DSN=
|
||||
- SENTRY_TRACES_SAMPLE_RATE=1.0
|
||||
- SENTRY_PROFILES_SAMPLE_RATE=1.0
|
||||
depends_on:
|
||||
init_permissions:
|
||||
condition: service_completed_successfully
|
||||
api:
|
||||
condition: service_healthy
|
||||
agent_backend:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/app/storage:/app/api/storage
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- celery -A celery_healthcheck.celery inspect ping
|
||||
interval: 30s
|
||||
timeout: 30s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
disable: true
|
||||
networks:
|
||||
- ssrf_proxy_network
|
||||
- default
|
||||
- 1panel-network
|
||||
|
||||
worker_beat:
|
||||
image: "langgenius/dify-api:1.20.0"
|
||||
container_name: ${CONTAINER_NAME}-worker-beat
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: *dify-env
|
||||
environment:
|
||||
- MODE=beat
|
||||
- DB_HOST=${PANEL_DB_HOST}
|
||||
- DB_PORT=${PANEL_DB_PORT}
|
||||
- DB_USERNAME=${PANEL_DB_USER}
|
||||
- DB_PASSWORD=${PANEL_DB_USER_PASSWORD}
|
||||
- DB_DATABASE=${PANEL_DB_NAME}
|
||||
- REDIS_HOST=${REDIS_HOST}
|
||||
- REDIS_PORT=${REDIS_PORT}
|
||||
- REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
|
||||
- REDIS_DB=${REDIS_DB}
|
||||
- MIGRATION_ENABLED=false
|
||||
- CELERY_BROKER_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/1
|
||||
- CODE_EXECUTION_API_KEY=${SANDBOX_API_KEY}
|
||||
depends_on:
|
||||
init_permissions:
|
||||
condition: service_completed_successfully
|
||||
api:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- ssrf_proxy_network
|
||||
- default
|
||||
- 1panel-network
|
||||
|
||||
web:
|
||||
image: "langgenius/dify-web:1.20.0"
|
||||
container_name: ${CONTAINER_NAME}-web
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: *dify-env
|
||||
environment:
|
||||
- CONSOLE_API_URL=
|
||||
- SERVER_CONSOLE_API_URL=http://api:5001
|
||||
- APP_API_URL=
|
||||
- AMPLITUDE_API_KEY=
|
||||
- SENTRY_DSN=
|
||||
- MARKETPLACE_API_URL=https://marketplace.dify.ai
|
||||
- MARKETPLACE_URL=https://marketplace.dify.ai
|
||||
- WORKFLOW_GENERATION_TIMEOUT_MS=180000
|
||||
- NEXT_PUBLIC_ENABLE_AGENT_V2=true
|
||||
- NEXT_PUBLIC_ENABLE_FEATURE_PREVIEW=true
|
||||
networks:
|
||||
- default
|
||||
|
||||
sandbox:
|
||||
image: "langgenius/dify-sandbox:0.2.15"
|
||||
container_name: ${CONTAINER_NAME}-sandbox
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: *dify-env
|
||||
environment:
|
||||
- API_KEY=${SANDBOX_API_KEY}
|
||||
- GIN_MODE=release
|
||||
- WORKER_TIMEOUT=15
|
||||
- ENABLE_NETWORK=true
|
||||
- HTTP_PROXY=http://ssrf_proxy:3128
|
||||
- HTTPS_PROXY=http://ssrf_proxy:3128
|
||||
- SANDBOX_PORT=8194
|
||||
- PIP_MIRROR_URL=
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/sandbox/dependencies:/dependencies
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- curl
|
||||
- -f
|
||||
- http://localhost:8194/health
|
||||
networks:
|
||||
- ssrf_proxy_network
|
||||
|
||||
local_sandbox:
|
||||
image: "langgenius/dify-agent-local-sandbox:1.20.0"
|
||||
command: ["shellctl", "serve", "--listen", "0.0.0.0:5004", "--require-auth-token"]
|
||||
container_name: ${CONTAINER_NAME}-local-sandbox
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
environment:
|
||||
- SHELLCTL_AUTH_TOKEN=${DIFY_AGENT_SHELLCTL_AUTH_TOKEN}
|
||||
- SHELLCTL_ENABLE_PATH_ISOLATION=true
|
||||
- HTTP_PROXY=http://agent_ssrf_proxy:3128
|
||||
- HTTPS_PROXY=http://agent_ssrf_proxy:3128
|
||||
- NO_PROXY=localhost,127.0.0.1
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/agent_local_sandbox/home:/home/dify
|
||||
- ${APP_DATA_DIR}/agent_local_sandbox/workspace:/workspace
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- curl
|
||||
- -f
|
||||
- http://localhost:5004/healthz
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
networks:
|
||||
- agent_sandbox_network
|
||||
- local_sandbox_proxy_network
|
||||
depends_on:
|
||||
init_permissions:
|
||||
condition: service_completed_successfully
|
||||
agent_ssrf_proxy:
|
||||
condition: service_started
|
||||
|
||||
agent_backend:
|
||||
image: "langgenius/dify-agent-backend:1.20.0"
|
||||
container_name: ${CONTAINER_NAME}-agent-backend
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: *dify-env
|
||||
environment:
|
||||
- DIFY_AGENT_REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2
|
||||
- DIFY_AGENT_REDIS_PREFIX=dify-agent
|
||||
- DIFY_AGENT_PLUGIN_DAEMON_URL=http://plugin_daemon:5002
|
||||
- DIFY_AGENT_PLUGIN_DAEMON_API_KEY=${PLUGIN_DAEMON_KEY}
|
||||
- DIFY_AGENT_INNER_API_URL=http://api:5001
|
||||
- DIFY_AGENT_INNER_API_KEY=${PLUGIN_DIFY_INNER_API_KEY}
|
||||
- DIFY_AGENT_SHELLCTL_ENTRYPOINT=http://local_sandbox:5004
|
||||
- DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN=${DIFY_AGENT_SHELLCTL_AUTH_TOKEN}
|
||||
- DIFY_AGENT_STUB_API_BASE_URL=http://agent_backend:5050/agent-stub
|
||||
- DIFY_AGENT_SANDBOX_FILES_BASE_URL=${DIFY_AGENT_SANDBOX_FILES_BASE_URL:-http://api:5001}
|
||||
- DIFY_AGENT_SERVER_SECRET_KEY=${DIFY_AGENT_SERVER_SECRET_KEY}
|
||||
- DIFY_AGENT_SHUTDOWN_GRACE_SECONDS=30
|
||||
- DIFY_AGENT_RUN_RETENTION_SECONDS=259200
|
||||
depends_on:
|
||||
plugin_daemon:
|
||||
condition: service_started
|
||||
local_sandbox:
|
||||
condition: service_started
|
||||
networks:
|
||||
- default
|
||||
- agent_sandbox_network
|
||||
|
||||
plugin_daemon:
|
||||
image: "langgenius/dify-plugin-daemon:0.6.15-local"
|
||||
container_name: ${CONTAINER_NAME}-plugin-daemon
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
env_file: *dify-env
|
||||
environment:
|
||||
- DB_HOST=${PANEL_DB_HOST}
|
||||
- DB_PORT=${PANEL_DB_PORT}
|
||||
- DB_USERNAME=${PANEL_DB_USER}
|
||||
- DB_PASSWORD=${PANEL_DB_USER_PASSWORD}
|
||||
- DB_DATABASE=${PANEL_DB_NAME}
|
||||
- DB_SSL_MODE=disable
|
||||
- REDIS_HOST=${REDIS_HOST}
|
||||
- REDIS_PORT=${REDIS_PORT}
|
||||
- REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
|
||||
- REDIS_DB=${REDIS_DB}
|
||||
- SERVER_PORT=5002
|
||||
- SERVER_KEY=${PLUGIN_DAEMON_KEY}
|
||||
- MAX_PLUGIN_PACKAGE_SIZE=52428800
|
||||
- PPROF_ENABLED=false
|
||||
- DIFY_INNER_API_URL=http://api:5001
|
||||
- DIFY_INNER_API_KEY=${PLUGIN_DIFY_INNER_API_KEY}
|
||||
- PLUGIN_REMOTE_INSTALLING_HOST=0.0.0.0
|
||||
- PLUGIN_REMOTE_INSTALLING_PORT=5003
|
||||
- PLUGIN_WORKING_PATH=/app/storage/cwd
|
||||
- FORCE_VERIFYING_SIGNATURE=true
|
||||
- PYTHON_ENV_INIT_TIMEOUT=120
|
||||
- PLUGIN_MAX_EXECUTION_TIMEOUT=600
|
||||
- PLUGIN_STDIO_BUFFER_SIZE=1024
|
||||
- PLUGIN_STDIO_MAX_BUFFER_SIZE=5242880
|
||||
- PIP_MIRROR_URL=
|
||||
- PLUGIN_STORAGE_TYPE=local
|
||||
- PLUGIN_STORAGE_LOCAL_ROOT=/app/storage
|
||||
- PLUGIN_INSTALLED_PATH=plugin
|
||||
- PLUGIN_PACKAGE_CACHE_PATH=plugin_packages
|
||||
- PLUGIN_MEDIA_CACHE_PATH=assets
|
||||
- PLUGIN_STORAGE_OSS_BUCKET=
|
||||
- S3_USE_AWS_MANAGED_IAM=false
|
||||
- S3_USE_AWS=false
|
||||
- S3_ENDPOINT=
|
||||
- S3_USE_PATH_STYLE=false
|
||||
- AWS_ACCESS_KEY=
|
||||
- AWS_SECRET_KEY=
|
||||
- AWS_REGION=
|
||||
- AZURE_BLOB_STORAGE_CONNECTION_STRING=
|
||||
- AZURE_BLOB_STORAGE_CONTAINER_NAME=
|
||||
- TENCENT_COS_SECRET_KEY=
|
||||
- TENCENT_COS_SECRET_ID=
|
||||
- TENCENT_COS_REGION=
|
||||
- ALIYUN_OSS_REGION=
|
||||
- ALIYUN_OSS_ENDPOINT=
|
||||
- ALIYUN_OSS_ACCESS_KEY_ID=
|
||||
- ALIYUN_OSS_ACCESS_KEY_SECRET=
|
||||
- ALIYUN_OSS_AUTH_VERSION=v4
|
||||
- ALIYUN_OSS_PATH=
|
||||
- VOLCENGINE_TOS_ENDPOINT=
|
||||
- VOLCENGINE_TOS_ACCESS_KEY=
|
||||
- VOLCENGINE_TOS_SECRET_KEY=
|
||||
- VOLCENGINE_TOS_REGION=
|
||||
- SENTRY_ENABLED=false
|
||||
- SENTRY_DSN=
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/plugin_daemon:/app/storage
|
||||
depends_on:
|
||||
init_permissions:
|
||||
condition: service_completed_successfully
|
||||
networks:
|
||||
- ssrf_proxy_network
|
||||
- default
|
||||
- 1panel-network
|
||||
|
||||
ssrf_proxy:
|
||||
image: "ubuntu/squid:latest"
|
||||
container_name: ${CONTAINER_NAME}-ssrf-proxy
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
volumes:
|
||||
- ./ssrf_proxy/squid.conf.template:/etc/squid/squid.conf.template
|
||||
- ./ssrf_proxy/docker-entrypoint.sh:/docker-entrypoint-mount.sh
|
||||
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
|
||||
environment:
|
||||
- HTTP_PORT=3128
|
||||
- COREDUMP_DIR=/var/spool/squid
|
||||
- SSRF_PROXY_ALLOW_PRIVATE_IPS=
|
||||
- SSRF_PROXY_ALLOW_PRIVATE_DOMAINS=
|
||||
networks:
|
||||
- ssrf_proxy_network
|
||||
- default
|
||||
|
||||
agent_ssrf_proxy:
|
||||
image: "ubuntu/squid:latest"
|
||||
container_name: ${CONTAINER_NAME}-agent-ssrf-proxy
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
volumes:
|
||||
- ./ssrf_proxy/squid-agent.conf.template:/etc/squid/squid.conf.template
|
||||
- ./ssrf_proxy/squid-common.conf.template:/etc/squid/dify_common.conf.template
|
||||
- ./ssrf_proxy/docker-agent-entrypoint.sh:/docker-entrypoint-mount.sh
|
||||
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
|
||||
environment:
|
||||
- HTTP_PORT=3128
|
||||
- COREDUMP_DIR=/var/spool/squid
|
||||
- SSRF_PROXY_ALLOW_PRIVATE_IPS=
|
||||
- SSRF_PROXY_ALLOW_PRIVATE_DOMAINS=
|
||||
networks:
|
||||
- default
|
||||
- local_sandbox_proxy_network
|
||||
|
||||
nginx:
|
||||
image: "nginx:latest"
|
||||
container_name: ${CONTAINER_NAME}
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
volumes:
|
||||
- ./nginx/nginx.conf.template:/etc/nginx/nginx.conf.template
|
||||
- ./nginx/proxy.conf.template:/etc/nginx/proxy.conf.template
|
||||
- ./nginx/https.conf.template:/etc/nginx/https.conf.template
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d
|
||||
- ./nginx/docker-entrypoint.sh:/docker-entrypoint-mount.sh
|
||||
- ${APP_DATA_DIR}/nginx/ssl:/etc/ssl
|
||||
- ${APP_DATA_DIR}/certbot/conf/live:/etc/letsencrypt/live
|
||||
- ${APP_DATA_DIR}/certbot/conf:/etc/letsencrypt
|
||||
- ${APP_DATA_DIR}/certbot/www:/var/www/html
|
||||
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
|
||||
environment:
|
||||
- NGINX_SERVER_NAME=_
|
||||
- NGINX_HTTPS_ENABLED=false
|
||||
- NGINX_SSL_PORT=443
|
||||
- NGINX_PORT=80
|
||||
- NGINX_SSL_CERT_FILENAME=dify.crt
|
||||
- NGINX_SSL_CERT_KEY_FILENAME=dify.key
|
||||
- NGINX_SSL_PROTOCOLS=TLSv1.2 TLSv1.3
|
||||
- NGINX_WORKER_PROCESSES=auto
|
||||
- NGINX_CLIENT_MAX_BODY_SIZE=100M
|
||||
- NGINX_KEEPALIVE_TIMEOUT=65
|
||||
- NGINX_PROXY_READ_TIMEOUT=3600s
|
||||
- NGINX_PROXY_SEND_TIMEOUT=3600s
|
||||
- NGINX_ENABLE_CERTBOT_CHALLENGE=false
|
||||
- NGINX_SOCKET_IO_UPSTREAM=api_websocket:5001
|
||||
- CERTBOT_DOMAIN=
|
||||
depends_on:
|
||||
- api
|
||||
- api_websocket
|
||||
- web
|
||||
- plugin_daemon
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:80"
|
||||
networks:
|
||||
- default
|
||||
- 1panel-network
|
||||
|
||||
weaviate:
|
||||
image: "semitechnologies/weaviate:1.27.0"
|
||||
container_name: ${CONTAINER_NAME}-weaviate
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
restart: always
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/weaviate:/var/lib/weaviate
|
||||
environment:
|
||||
- PERSISTENCE_DATA_PATH=/var/lib/weaviate
|
||||
- QUERY_DEFAULTS_LIMIT=25
|
||||
- AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=false
|
||||
- DEFAULT_VECTORIZER_MODULE=none
|
||||
- CLUSTER_HOSTNAME=node1
|
||||
- AUTHENTICATION_APIKEY_ENABLED=true
|
||||
- AUTHENTICATION_APIKEY_ALLOWED_KEYS=${WEAVIATE_API_KEY}
|
||||
- AUTHENTICATION_APIKEY_USERS=dify@local
|
||||
- AUTHORIZATION_ADMINLIST_ENABLED=true
|
||||
- AUTHORIZATION_ADMINLIST_USERS=dify@local
|
||||
- DISABLE_TELEMETRY=false
|
||||
- ENABLE_TOKENIZER_GSE=false
|
||||
- ENABLE_TOKENIZER_KAGOME_JA=false
|
||||
- ENABLE_TOKENIZER_KAGOME_KR=false
|
||||
networks:
|
||||
- default
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
ssrf_proxy_network:
|
||||
internal: true
|
||||
local_sandbox_proxy_network:
|
||||
internal: true
|
||||
agent_sandbox_network:
|
||||
internal: true
|
||||
@@ -0,0 +1,73 @@
|
||||
# Please do not directly edit this file. Instead, modify the .env variables related to NGINX configuration.
|
||||
|
||||
server {
|
||||
listen ${NGINX_PORT};
|
||||
server_name ${NGINX_SERVER_NAME};
|
||||
|
||||
location /console/api {
|
||||
proxy_pass http://api:5001;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://api:5001;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /socket.io/ {
|
||||
resolver 127.0.0.11 valid=30s ipv6=off;
|
||||
set $socket_io_upstream ${NGINX_SOCKET_IO_UPSTREAM};
|
||||
proxy_pass http://$socket_io_upstream;
|
||||
include proxy.conf;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
location /v1 {
|
||||
proxy_pass http://api:5001;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /openapi {
|
||||
proxy_pass http://api:5001;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /files {
|
||||
proxy_pass http://api:5001;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /explore {
|
||||
proxy_pass http://web:3000;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /e/ {
|
||||
proxy_pass http://plugin_daemon:5002;
|
||||
proxy_set_header Dify-Hook-Url $scheme://$host$request_uri;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://web:3000;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /mcp {
|
||||
proxy_pass http://api:5001;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location /triggers {
|
||||
proxy_pass http://api:5001;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
# placeholder for acme challenge location
|
||||
${ACME_CHALLENGE_LOCATION}
|
||||
|
||||
# placeholder for https config defined in https.conf.template
|
||||
${HTTPS_CONFIG}
|
||||
}
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
HTTPS_CONFIG=''
|
||||
|
||||
if [ "${NGINX_HTTPS_ENABLED}" = "true" ]; then
|
||||
# Check if the certificate and key files for the specified domain exist
|
||||
if [ -n "${CERTBOT_DOMAIN}" ] && \
|
||||
[ -f "/etc/letsencrypt/live/${CERTBOT_DOMAIN}/${NGINX_SSL_CERT_FILENAME}" ] && \
|
||||
[ -f "/etc/letsencrypt/live/${CERTBOT_DOMAIN}/${NGINX_SSL_CERT_KEY_FILENAME}" ]; then
|
||||
SSL_CERTIFICATE_PATH="/etc/letsencrypt/live/${CERTBOT_DOMAIN}/${NGINX_SSL_CERT_FILENAME}"
|
||||
SSL_CERTIFICATE_KEY_PATH="/etc/letsencrypt/live/${CERTBOT_DOMAIN}/${NGINX_SSL_CERT_KEY_FILENAME}"
|
||||
else
|
||||
SSL_CERTIFICATE_PATH="/etc/ssl/${NGINX_SSL_CERT_FILENAME}"
|
||||
SSL_CERTIFICATE_KEY_PATH="/etc/ssl/${NGINX_SSL_CERT_KEY_FILENAME}"
|
||||
fi
|
||||
export SSL_CERTIFICATE_PATH
|
||||
export SSL_CERTIFICATE_KEY_PATH
|
||||
|
||||
# set the HTTPS_CONFIG environment variable to the content of the https.conf.template
|
||||
HTTPS_CONFIG=$(envsubst < /etc/nginx/https.conf.template)
|
||||
export HTTPS_CONFIG
|
||||
# Substitute the HTTPS_CONFIG in the default.conf.template with content from https.conf.template
|
||||
envsubst '${HTTPS_CONFIG}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
fi
|
||||
export HTTPS_CONFIG
|
||||
|
||||
if [ "${NGINX_ENABLE_CERTBOT_CHALLENGE}" = "true" ]; then
|
||||
ACME_CHALLENGE_LOCATION='location /.well-known/acme-challenge/ { root /var/www/html; }'
|
||||
else
|
||||
ACME_CHALLENGE_LOCATION=''
|
||||
fi
|
||||
export ACME_CHALLENGE_LOCATION
|
||||
|
||||
env_vars=$(printenv | cut -d= -f1 | sed 's/^/$/g' | paste -sd, -)
|
||||
|
||||
envsubst "$env_vars" < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
||||
envsubst "$env_vars" < /etc/nginx/proxy.conf.template > /etc/nginx/proxy.conf
|
||||
|
||||
envsubst "$env_vars" < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Start Nginx using the default entrypoint
|
||||
exec nginx -g 'daemon off;'
|
||||
@@ -0,0 +1,9 @@
|
||||
# Please do not directly edit this file. Instead, modify the .env variables related to NGINX configuration.
|
||||
|
||||
listen ${NGINX_SSL_PORT} ssl;
|
||||
ssl_certificate ${SSL_CERTIFICATE_PATH};
|
||||
ssl_certificate_key ${SSL_CERTIFICATE_KEY_PATH};
|
||||
ssl_protocols ${NGINX_SSL_PROTOCOLS};
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
@@ -0,0 +1,34 @@
|
||||
# Please do not directly edit this file. Instead, modify the .env variables related to NGINX configuration.
|
||||
|
||||
user nginx;
|
||||
worker_processes ${NGINX_WORKER_PROCESSES};
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout ${NGINX_KEEPALIVE_TIMEOUT};
|
||||
|
||||
#gzip on;
|
||||
client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE};
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
# Please do not directly edit this file. Instead, modify the .env variables related to NGINX configuration.
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_buffering off;
|
||||
proxy_read_timeout ${NGINX_PROXY_READ_TIMEOUT};
|
||||
proxy_send_timeout ${NGINX_PROXY_SEND_TIMEOUT};
|
||||
Executable
+270
@@ -0,0 +1,270 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
ENV_FILE="${ENV_FILE:-$ROOT_DIR/.env}"
|
||||
|
||||
get_env_value() {
|
||||
local key="$1"
|
||||
local default="$2"
|
||||
local value=""
|
||||
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
value="$(sed -n -E "s/^${key}=//p" "$ENV_FILE" | tail -n 1)"
|
||||
value="${value%\"}"
|
||||
value="${value#\"}"
|
||||
value="${value%\'}"
|
||||
value="${value#\'}"
|
||||
fi
|
||||
|
||||
if [[ -n "$value" ]]; then
|
||||
printf '%s\n' "$value"
|
||||
else
|
||||
printf '%s\n' "$default"
|
||||
fi
|
||||
}
|
||||
|
||||
set_env_value() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
||||
touch "$ENV_FILE"
|
||||
sed -i -E "/^${key}=/d" "$ENV_FILE"
|
||||
printf '%s=%s\n' "$key" "$value" >>"$ENV_FILE"
|
||||
}
|
||||
|
||||
generate_random_secret() {
|
||||
if command -v openssl >/dev/null 2>&1; then
|
||||
openssl rand -hex 32
|
||||
else
|
||||
od -An -N32 -tx1 /dev/urandom | tr -d ' \n'
|
||||
fi
|
||||
}
|
||||
|
||||
generate_agent_server_secret() {
|
||||
local value
|
||||
|
||||
if command -v openssl >/dev/null 2>&1; then
|
||||
value="$(openssl rand -base64 32)"
|
||||
elif command -v base64 >/dev/null 2>&1; then
|
||||
value="$(head -c 32 /dev/urandom | base64)"
|
||||
else
|
||||
echo "[dify:init] cannot generate DIFY_AGENT_SERVER_SECRET_KEY: openssl or base64 is required" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf '%s' "$value" | tr '+/' '-_' | tr -d '=\n'
|
||||
}
|
||||
|
||||
is_valid_agent_server_secret() {
|
||||
local value="$1"
|
||||
local normalized
|
||||
local decoded_length
|
||||
|
||||
[[ "$value" =~ ^[A-Za-z0-9_-]+={0,2}$ ]] || return 1
|
||||
normalized="${value//-/+}"
|
||||
normalized="${normalized//_/\/}"
|
||||
case $((${#normalized} % 4)) in
|
||||
0) ;;
|
||||
2) normalized="${normalized}==" ;;
|
||||
3) normalized="${normalized}=" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
|
||||
if command -v base64 >/dev/null 2>&1; then
|
||||
decoded_length="$(printf '%s' "$normalized" | base64 -d 2>/dev/null | wc -c | tr -d '[:space:]')" || return 1
|
||||
elif command -v openssl >/dev/null 2>&1; then
|
||||
decoded_length="$(printf '%s' "$normalized" | openssl base64 -d -A 2>/dev/null | wc -c | tr -d '[:space:]')" || return 1
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
[[ "$decoded_length" == "32" ]]
|
||||
}
|
||||
|
||||
ensure_env_secret() {
|
||||
local key="$1"
|
||||
local value
|
||||
|
||||
value="$(get_env_value "$key" "")"
|
||||
if [[ -n "$value" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
value="${!key:-}"
|
||||
if [[ -z "$value" ]]; then
|
||||
value="$(generate_random_secret)"
|
||||
fi
|
||||
set_env_value "$key" "$value"
|
||||
echo "[dify:init] generated missing ${key}"
|
||||
}
|
||||
|
||||
ensure_agent_server_secret() {
|
||||
local value
|
||||
local reason="missing"
|
||||
|
||||
value="$(get_env_value "DIFY_AGENT_SERVER_SECRET_KEY" "")"
|
||||
if [[ -z "$value" ]]; then
|
||||
value="${DIFY_AGENT_SERVER_SECRET_KEY:-}"
|
||||
fi
|
||||
if [[ -n "$value" ]] && is_valid_agent_server_secret "$value"; then
|
||||
set_env_value "DIFY_AGENT_SERVER_SECRET_KEY" "$value"
|
||||
return
|
||||
fi
|
||||
if [[ -n "$value" ]]; then
|
||||
reason="invalid"
|
||||
fi
|
||||
|
||||
value="$(generate_agent_server_secret)"
|
||||
set_env_value "DIFY_AGENT_SERVER_SECRET_KEY" "$value"
|
||||
echo "[dify:init] replaced ${reason} DIFY_AGENT_SERVER_SECRET_KEY with a generated 32-byte Base64URL key"
|
||||
}
|
||||
|
||||
resolve_app_path() {
|
||||
local raw="$1"
|
||||
if [[ "$raw" = /* ]]; then
|
||||
printf '%s\n' "$raw"
|
||||
else
|
||||
printf '%s\n' "$ROOT_DIR/${raw#./}"
|
||||
fi
|
||||
}
|
||||
|
||||
trim_trailing_slash() {
|
||||
local raw="$1"
|
||||
if [[ "$raw" == "/" ]]; then
|
||||
printf '/\n'
|
||||
else
|
||||
printf '%s\n' "${raw%/}"
|
||||
fi
|
||||
}
|
||||
|
||||
to_ws_url() {
|
||||
local raw="$1"
|
||||
case "$raw" in
|
||||
https://*)
|
||||
printf 'wss://%s\n' "${raw#https://}"
|
||||
;;
|
||||
http://*)
|
||||
printf 'ws://%s\n' "${raw#http://}"
|
||||
;;
|
||||
*)
|
||||
printf '\n'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
extract_host() {
|
||||
local raw="$1"
|
||||
raw="${raw#http://}"
|
||||
raw="${raw#https://}"
|
||||
raw="${raw%%/*}"
|
||||
if [[ "$raw" == *:* ]]; then
|
||||
raw="${raw%%:*}"
|
||||
fi
|
||||
printf '%s\n' "$raw"
|
||||
}
|
||||
|
||||
extract_origin() {
|
||||
local raw="$1"
|
||||
local scheme="http"
|
||||
local remainder="$raw"
|
||||
|
||||
if [[ "$raw" == https://* ]]; then
|
||||
scheme="https"
|
||||
remainder="${raw#https://}"
|
||||
elif [[ "$raw" == http://* ]]; then
|
||||
scheme="http"
|
||||
remainder="${raw#http://}"
|
||||
fi
|
||||
|
||||
remainder="${remainder%%/*}"
|
||||
if [[ -n "$remainder" ]]; then
|
||||
printf '%s://%s\n' "$scheme" "$remainder"
|
||||
else
|
||||
printf '\n'
|
||||
fi
|
||||
}
|
||||
|
||||
rewrite_managed_custom_env() {
|
||||
local file="$1"
|
||||
local public_base_url="$2"
|
||||
local enable_collaboration="$3"
|
||||
|
||||
local begin_marker="# --- BEGIN 1PANEL DIFY MANAGED BLOCK ---"
|
||||
local end_marker="# --- END 1PANEL DIFY MANAGED BLOCK ---"
|
||||
local tmp_file
|
||||
tmp_file="$(mktemp)"
|
||||
|
||||
if [[ -f "$file" ]]; then
|
||||
awk -v begin="$begin_marker" -v end="$end_marker" '
|
||||
$0 == begin {skip=1; next}
|
||||
$0 == end {skip=0; next}
|
||||
!skip {print}
|
||||
' "$file" >"$tmp_file"
|
||||
fi
|
||||
|
||||
if [[ -n "$public_base_url" ]]; then
|
||||
local normalized_url
|
||||
local public_origin
|
||||
local websocket_url
|
||||
local public_host
|
||||
|
||||
normalized_url="$(trim_trailing_slash "$public_base_url")"
|
||||
public_origin="$(extract_origin "$normalized_url")"
|
||||
websocket_url="$(to_ws_url "$public_origin")"
|
||||
public_host="$(extract_host "$normalized_url")"
|
||||
|
||||
{
|
||||
[[ -s "$tmp_file" ]] && printf '\n'
|
||||
printf '%s\n' "$begin_marker"
|
||||
printf 'TRIGGER_URL=%s\n' "$normalized_url"
|
||||
printf 'ENDPOINT_URL_TEMPLATE=%s/e/{hook_id}\n' "$normalized_url"
|
||||
if [[ -n "$public_host" ]]; then
|
||||
printf 'PLUGIN_REMOTE_INSTALL_HOST=%s\n' "$public_host"
|
||||
fi
|
||||
if [[ "$enable_collaboration" == "true" ]]; then
|
||||
if [[ -n "$websocket_url" ]]; then
|
||||
printf 'NEXT_PUBLIC_SOCKET_URL=%s\n' "$websocket_url"
|
||||
else
|
||||
printf 'NEXT_PUBLIC_SOCKET_URL=/\n'
|
||||
fi
|
||||
fi
|
||||
printf '%s\n' "$end_marker"
|
||||
} >>"$tmp_file"
|
||||
fi
|
||||
|
||||
mv "$tmp_file" "$file"
|
||||
}
|
||||
|
||||
APP_DATA_DIR_RAW="${APP_DATA_DIR:-$(get_env_value "APP_DATA_DIR" "./data")}"
|
||||
CUSTOM_ENV_FILE_RAW="${CUSTOM_ENV_FILE:-$(get_env_value "CUSTOM_ENV_FILE" "./data/custom.env")}"
|
||||
PUBLIC_BASE_URL_RAW="${PUBLIC_BASE_URL:-$(get_env_value "PUBLIC_BASE_URL" "")}"
|
||||
ENABLE_COLLABORATION_MODE_RAW="${ENABLE_COLLABORATION_MODE:-$(get_env_value "ENABLE_COLLABORATION_MODE" "false")}"
|
||||
|
||||
ensure_env_secret "DIFY_AGENT_SHELLCTL_AUTH_TOKEN"
|
||||
ensure_agent_server_secret
|
||||
|
||||
APP_DATA_DIR_ABS="$(resolve_app_path "$APP_DATA_DIR_RAW")"
|
||||
CUSTOM_ENV_FILE_ABS="$(resolve_app_path "$CUSTOM_ENV_FILE_RAW")"
|
||||
|
||||
mkdir -p \
|
||||
"$APP_DATA_DIR_ABS/app/storage" \
|
||||
"$APP_DATA_DIR_ABS/plugin_daemon" \
|
||||
"$APP_DATA_DIR_ABS/agent_local_sandbox/home" \
|
||||
"$APP_DATA_DIR_ABS/agent_local_sandbox/workspace" \
|
||||
"$APP_DATA_DIR_ABS/sandbox/dependencies" \
|
||||
"$APP_DATA_DIR_ABS/weaviate" \
|
||||
"$APP_DATA_DIR_ABS/nginx/ssl" \
|
||||
"$APP_DATA_DIR_ABS/certbot/conf/live" \
|
||||
"$APP_DATA_DIR_ABS/certbot/conf" \
|
||||
"$APP_DATA_DIR_ABS/certbot/www"
|
||||
mkdir -p "$(dirname "$CUSTOM_ENV_FILE_ABS")"
|
||||
touch "$CUSTOM_ENV_FILE_ABS"
|
||||
|
||||
rewrite_managed_custom_env "$CUSTOM_ENV_FILE_ABS" "$PUBLIC_BASE_URL_RAW" "$ENABLE_COLLABORATION_MODE_RAW"
|
||||
|
||||
echo "[dify:init] initialized persistent directories under ${APP_DATA_DIR_ABS}"
|
||||
echo "[dify:init] custom env file: ${CUSTOM_ENV_FILE_ABS}"
|
||||
if [[ -n "$PUBLIC_BASE_URL_RAW" ]]; then
|
||||
echo "[dify:init] derived public callback settings from PUBLIC_BASE_URL=${PUBLIC_BASE_URL_RAW}"
|
||||
fi
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
docker compose down --volumes
|
||||
else
|
||||
docker-compose down --volumes
|
||||
fi
|
||||
Executable
+303
@@ -0,0 +1,303 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
ENV_FILE="${ENV_FILE:-$ROOT_DIR/.env}"
|
||||
|
||||
get_env_value() {
|
||||
local key="$1"
|
||||
local default="$2"
|
||||
local value=""
|
||||
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
value="$(sed -n -E "s/^${key}=//p" "$ENV_FILE" | tail -n 1)"
|
||||
value="${value%\"}"
|
||||
value="${value#\"}"
|
||||
value="${value%\'}"
|
||||
value="${value#\'}"
|
||||
fi
|
||||
|
||||
if [[ -n "$value" ]]; then
|
||||
printf '%s\n' "$value"
|
||||
else
|
||||
printf '%s\n' "$default"
|
||||
fi
|
||||
}
|
||||
|
||||
set_env_value() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
||||
touch "$ENV_FILE"
|
||||
sed -i -E "/^${key}=/d" "$ENV_FILE"
|
||||
printf '%s=%s\n' "$key" "$value" >>"$ENV_FILE"
|
||||
}
|
||||
|
||||
generate_random_secret() {
|
||||
if command -v openssl >/dev/null 2>&1; then
|
||||
openssl rand -hex 32
|
||||
else
|
||||
od -An -N32 -tx1 /dev/urandom | tr -d ' \n'
|
||||
fi
|
||||
}
|
||||
|
||||
generate_agent_server_secret() {
|
||||
local value
|
||||
|
||||
if command -v openssl >/dev/null 2>&1; then
|
||||
value="$(openssl rand -base64 32)"
|
||||
elif command -v base64 >/dev/null 2>&1; then
|
||||
value="$(head -c 32 /dev/urandom | base64)"
|
||||
else
|
||||
echo "[dify:upgrade] cannot generate DIFY_AGENT_SERVER_SECRET_KEY: openssl or base64 is required" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf '%s' "$value" | tr '+/' '-_' | tr -d '=\n'
|
||||
}
|
||||
|
||||
is_valid_agent_server_secret() {
|
||||
local value="$1"
|
||||
local normalized
|
||||
local decoded_length
|
||||
|
||||
[[ "$value" =~ ^[A-Za-z0-9_-]+={0,2}$ ]] || return 1
|
||||
normalized="${value//-/+}"
|
||||
normalized="${normalized//_/\/}"
|
||||
case $((${#normalized} % 4)) in
|
||||
0) ;;
|
||||
2) normalized="${normalized}==" ;;
|
||||
3) normalized="${normalized}=" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
|
||||
if command -v base64 >/dev/null 2>&1; then
|
||||
decoded_length="$(printf '%s' "$normalized" | base64 -d 2>/dev/null | wc -c | tr -d '[:space:]')" || return 1
|
||||
elif command -v openssl >/dev/null 2>&1; then
|
||||
decoded_length="$(printf '%s' "$normalized" | openssl base64 -d -A 2>/dev/null | wc -c | tr -d '[:space:]')" || return 1
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
[[ "$decoded_length" == "32" ]]
|
||||
}
|
||||
|
||||
ensure_env_secret() {
|
||||
local key="$1"
|
||||
local value
|
||||
|
||||
value="$(get_env_value "$key" "")"
|
||||
if [[ -n "$value" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
value="${!key:-}"
|
||||
if [[ -z "$value" ]]; then
|
||||
value="$(generate_random_secret)"
|
||||
fi
|
||||
|
||||
set_env_value "$key" "$value"
|
||||
echo "[dify:upgrade] generated missing ${key}"
|
||||
}
|
||||
|
||||
ensure_agent_server_secret() {
|
||||
local value
|
||||
local reason="missing"
|
||||
|
||||
value="$(get_env_value "DIFY_AGENT_SERVER_SECRET_KEY" "")"
|
||||
if [[ -z "$value" ]]; then
|
||||
value="${DIFY_AGENT_SERVER_SECRET_KEY:-}"
|
||||
fi
|
||||
if [[ -n "$value" ]] && is_valid_agent_server_secret "$value"; then
|
||||
set_env_value "DIFY_AGENT_SERVER_SECRET_KEY" "$value"
|
||||
return
|
||||
fi
|
||||
if [[ -n "$value" ]]; then
|
||||
reason="invalid"
|
||||
fi
|
||||
|
||||
value="$(generate_agent_server_secret)"
|
||||
set_env_value "DIFY_AGENT_SERVER_SECRET_KEY" "$value"
|
||||
echo "[dify:upgrade] replaced ${reason} DIFY_AGENT_SERVER_SECRET_KEY with a generated 32-byte Base64URL key"
|
||||
}
|
||||
|
||||
resolve_app_path() {
|
||||
local raw="$1"
|
||||
if [[ "$raw" = /* ]]; then
|
||||
printf '%s\n' "$raw"
|
||||
else
|
||||
printf '%s\n' "$ROOT_DIR/${raw#./}"
|
||||
fi
|
||||
}
|
||||
|
||||
trim_trailing_slash() {
|
||||
local raw="$1"
|
||||
if [[ "$raw" == "/" ]]; then
|
||||
printf '/\n'
|
||||
else
|
||||
printf '%s\n' "${raw%/}"
|
||||
fi
|
||||
}
|
||||
|
||||
to_ws_url() {
|
||||
local raw="$1"
|
||||
case "$raw" in
|
||||
https://*)
|
||||
printf 'wss://%s\n' "${raw#https://}"
|
||||
;;
|
||||
http://*)
|
||||
printf 'ws://%s\n' "${raw#http://}"
|
||||
;;
|
||||
*)
|
||||
printf '\n'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
extract_host() {
|
||||
local raw="$1"
|
||||
raw="${raw#http://}"
|
||||
raw="${raw#https://}"
|
||||
raw="${raw%%/*}"
|
||||
if [[ "$raw" == *:* ]]; then
|
||||
raw="${raw%%:*}"
|
||||
fi
|
||||
printf '%s\n' "$raw"
|
||||
}
|
||||
|
||||
extract_origin() {
|
||||
local raw="$1"
|
||||
local scheme="http"
|
||||
local remainder="$raw"
|
||||
|
||||
if [[ "$raw" == https://* ]]; then
|
||||
scheme="https"
|
||||
remainder="${raw#https://}"
|
||||
elif [[ "$raw" == http://* ]]; then
|
||||
scheme="http"
|
||||
remainder="${raw#http://}"
|
||||
fi
|
||||
|
||||
remainder="${remainder%%/*}"
|
||||
if [[ -n "$remainder" ]]; then
|
||||
printf '%s://%s\n' "$scheme" "$remainder"
|
||||
else
|
||||
printf '\n'
|
||||
fi
|
||||
}
|
||||
|
||||
rewrite_managed_custom_env() {
|
||||
local file="$1"
|
||||
local public_base_url="$2"
|
||||
local enable_collaboration="$3"
|
||||
|
||||
local begin_marker="# --- BEGIN 1PANEL DIFY MANAGED BLOCK ---"
|
||||
local end_marker="# --- END 1PANEL DIFY MANAGED BLOCK ---"
|
||||
local tmp_file
|
||||
tmp_file="$(mktemp)"
|
||||
|
||||
if [[ -f "$file" ]]; then
|
||||
awk -v begin="$begin_marker" -v end="$end_marker" '
|
||||
$0 == begin {skip=1; next}
|
||||
$0 == end {skip=0; next}
|
||||
!skip {print}
|
||||
' "$file" >"$tmp_file"
|
||||
fi
|
||||
|
||||
if [[ -n "$public_base_url" ]]; then
|
||||
local normalized_url
|
||||
local public_origin
|
||||
local websocket_url
|
||||
local public_host
|
||||
|
||||
normalized_url="$(trim_trailing_slash "$public_base_url")"
|
||||
public_origin="$(extract_origin "$normalized_url")"
|
||||
websocket_url="$(to_ws_url "$public_origin")"
|
||||
public_host="$(extract_host "$normalized_url")"
|
||||
|
||||
{
|
||||
[[ -s "$tmp_file" ]] && printf '\n'
|
||||
printf '%s\n' "$begin_marker"
|
||||
printf 'TRIGGER_URL=%s\n' "$normalized_url"
|
||||
printf 'ENDPOINT_URL_TEMPLATE=%s/e/{hook_id}\n' "$normalized_url"
|
||||
if [[ -n "$public_host" ]]; then
|
||||
printf 'PLUGIN_REMOTE_INSTALL_HOST=%s\n' "$public_host"
|
||||
fi
|
||||
if [[ "$enable_collaboration" == "true" ]]; then
|
||||
if [[ -n "$websocket_url" ]]; then
|
||||
printf 'NEXT_PUBLIC_SOCKET_URL=%s\n' "$websocket_url"
|
||||
else
|
||||
printf 'NEXT_PUBLIC_SOCKET_URL=/\n'
|
||||
fi
|
||||
fi
|
||||
printf '%s\n' "$end_marker"
|
||||
} >>"$tmp_file"
|
||||
fi
|
||||
|
||||
mv "$tmp_file" "$file"
|
||||
}
|
||||
|
||||
APP_DATA_DIR_RAW="${APP_DATA_DIR:-$(get_env_value "APP_DATA_DIR" "./data")}"
|
||||
CUSTOM_ENV_FILE_RAW="${CUSTOM_ENV_FILE:-$(get_env_value "CUSTOM_ENV_FILE" "./data/custom.env")}"
|
||||
PUBLIC_BASE_URL_RAW="${PUBLIC_BASE_URL:-$(get_env_value "PUBLIC_BASE_URL" "")}"
|
||||
ENABLE_COLLABORATION_MODE_RAW="${ENABLE_COLLABORATION_MODE:-$(get_env_value "ENABLE_COLLABORATION_MODE" "false")}"
|
||||
CONTAINER_NAME_RAW="${CONTAINER_NAME:-$(get_env_value "CONTAINER_NAME" "dify")}"
|
||||
|
||||
migrate_local_sandbox_directory() {
|
||||
local source_path="$1"
|
||||
local destination="$2"
|
||||
local owner_id="$3"
|
||||
local container="${CONTAINER_NAME_RAW}-local-sandbox"
|
||||
local temporary_directory
|
||||
|
||||
if find "$destination" -mindepth 1 -maxdepth 1 -print -quit | grep -q .; then
|
||||
return
|
||||
fi
|
||||
if ! command -v docker >/dev/null 2>&1 || ! docker container inspect "$container" >/dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
|
||||
temporary_directory="$(mktemp -d "${destination}.migration.XXXXXX")"
|
||||
if ! docker cp "${container}:${source_path}/." "$temporary_directory" >/dev/null 2>&1; then
|
||||
rmdir "$temporary_directory" 2>/dev/null || true
|
||||
echo "[dify:upgrade] cannot preserve existing ${source_path} data from ${container}; aborting upgrade" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
chown -R "${owner_id}:${owner_id}" "$temporary_directory"
|
||||
if find "$destination" -mindepth 1 -maxdepth 1 -print -quit | grep -q .; then
|
||||
echo "[dify:upgrade] ${destination} changed during migration; preserving copy at ${temporary_directory} and aborting" >&2
|
||||
return 1
|
||||
fi
|
||||
rmdir "$destination"
|
||||
mv "$temporary_directory" "$destination"
|
||||
echo "[dify:upgrade] migrated ${source_path} into ${destination}"
|
||||
}
|
||||
|
||||
ensure_env_secret "DIFY_AGENT_SHELLCTL_AUTH_TOKEN"
|
||||
ensure_agent_server_secret
|
||||
|
||||
APP_DATA_DIR_ABS="$(resolve_app_path "$APP_DATA_DIR_RAW")"
|
||||
CUSTOM_ENV_FILE_ABS="$(resolve_app_path "$CUSTOM_ENV_FILE_RAW")"
|
||||
|
||||
mkdir -p \
|
||||
"$APP_DATA_DIR_ABS/app/storage" \
|
||||
"$APP_DATA_DIR_ABS/plugin_daemon" \
|
||||
"$APP_DATA_DIR_ABS/agent_local_sandbox/home" \
|
||||
"$APP_DATA_DIR_ABS/agent_local_sandbox/workspace" \
|
||||
"$APP_DATA_DIR_ABS/sandbox/dependencies" \
|
||||
"$APP_DATA_DIR_ABS/weaviate" \
|
||||
"$APP_DATA_DIR_ABS/nginx/ssl" \
|
||||
"$APP_DATA_DIR_ABS/certbot/conf/live" \
|
||||
"$APP_DATA_DIR_ABS/certbot/conf" \
|
||||
"$APP_DATA_DIR_ABS/certbot/www"
|
||||
mkdir -p "$(dirname "$CUSTOM_ENV_FILE_ABS")"
|
||||
touch "$CUSTOM_ENV_FILE_ABS"
|
||||
|
||||
migrate_local_sandbox_directory "/home/dify" "$APP_DATA_DIR_ABS/agent_local_sandbox/home" 1000
|
||||
migrate_local_sandbox_directory "/workspace" "$APP_DATA_DIR_ABS/agent_local_sandbox/workspace" 1000
|
||||
|
||||
rewrite_managed_custom_env "$CUSTOM_ENV_FILE_ABS" "$PUBLIC_BASE_URL_RAW" "$ENABLE_COLLABORATION_MODE_RAW"
|
||||
|
||||
echo "[dify:upgrade] ensured persistent directories under ${APP_DATA_DIR_ABS}"
|
||||
echo "[dify:upgrade] refreshed managed custom env block in ${CUSTOM_ENV_FILE_ABS}"
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
tail -F /var/log/squid/access.log 2>/dev/null &
|
||||
tail -F /var/log/squid/error.log 2>/dev/null &
|
||||
tail -F /var/log/squid/store.log 2>/dev/null &
|
||||
tail -F /var/log/squid/cache.log 2>/dev/null &
|
||||
|
||||
ALLOW_PRIVATE_CONF=/etc/squid/dify_allow_private.conf
|
||||
|
||||
write_optional_private_allowlist() {
|
||||
local env_name="$1"
|
||||
local acl_name="$2"
|
||||
local acl_type="$3"
|
||||
local raw_values="${!env_name:-}"
|
||||
local -a tokens=()
|
||||
|
||||
raw_values="${raw_values//,/ }"
|
||||
raw_values="${raw_values//$'\n'/ }"
|
||||
raw_values="${raw_values//$'\r'/ }"
|
||||
|
||||
if [ -z "${raw_values//[[:space:]]/}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
read -r -a tokens <<< "$raw_values"
|
||||
|
||||
printf 'acl %s %s' "$acl_name" "$acl_type" >> "$ALLOW_PRIVATE_CONF"
|
||||
for value in "${tokens[@]}"; do
|
||||
[ -z "${value//[[:space:]]/}" ] && continue
|
||||
printf ' %s' "$value" >> "$ALLOW_PRIVATE_CONF"
|
||||
done
|
||||
printf '\nhttp_access allow client_localnet %s\n' "$acl_name" >> "$ALLOW_PRIVATE_CONF"
|
||||
}
|
||||
|
||||
{
|
||||
echo "# Generated by docker-agent-entrypoint.sh."
|
||||
echo "# Allows selected private targets before the default private-network deny rule."
|
||||
} > "$ALLOW_PRIVATE_CONF"
|
||||
write_optional_private_allowlist "SSRF_PROXY_ALLOW_PRIVATE_IPS" "dify_allowed_private_networks" "dst"
|
||||
write_optional_private_allowlist "SSRF_PROXY_ALLOW_PRIVATE_DOMAINS" "dify_allowed_private_domains" "dstdomain"
|
||||
|
||||
expand_env() {
|
||||
awk '{
|
||||
while(match($0, /\${[A-Za-z_][A-Za-z_0-9]*}/)) {
|
||||
var = substr($0, RSTART+2, RLENGTH-3)
|
||||
val = ENVIRON[var]
|
||||
$0 = substr($0, 1, RSTART-1) val substr($0, RSTART+RLENGTH)
|
||||
}
|
||||
print
|
||||
}' "$1"
|
||||
}
|
||||
|
||||
echo "[ENTRYPOINT] replacing environment variables in the templates"
|
||||
expand_env /etc/squid/squid.conf.template > /etc/squid/squid.conf
|
||||
expand_env /etc/squid/dify_common.conf.template > /etc/squid/dify_common.conf
|
||||
|
||||
/usr/sbin/squid -Nz
|
||||
echo "[ENTRYPOINT] starting squid"
|
||||
/usr/sbin/squid -f /etc/squid/squid.conf -NYC 1
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Modified based on Squid OCI image entrypoint
|
||||
|
||||
# This entrypoint aims to forward the squid logs to stdout to assist users of
|
||||
# common container related tooling (e.g., kubernetes, docker-compose, etc) to
|
||||
# access the service logs.
|
||||
|
||||
# Moreover, it invokes the squid binary, leaving all the desired parameters to
|
||||
# be provided by the "command" passed to the spawned container. If no command
|
||||
# is provided by the user, the default behavior (as per the CMD statement in
|
||||
# the Dockerfile) will be to use Ubuntu's default configuration [1] and run
|
||||
# squid with the "-NYC" options to mimic the behavior of the Ubuntu provided
|
||||
# systemd unit.
|
||||
|
||||
# [1] The default configuration is changed in the Dockerfile to allow local
|
||||
# network connections. See the Dockerfile for further information.
|
||||
|
||||
echo "[ENTRYPOINT] re-create snakeoil self-signed certificate removed in the build process"
|
||||
if [ ! -f /etc/ssl/private/ssl-cert-snakeoil.key ]; then
|
||||
/usr/sbin/make-ssl-cert generate-default-snakeoil --force-overwrite > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
tail -F /var/log/squid/access.log 2>/dev/null &
|
||||
tail -F /var/log/squid/error.log 2>/dev/null &
|
||||
tail -F /var/log/squid/store.log 2>/dev/null &
|
||||
tail -F /var/log/squid/cache.log 2>/dev/null &
|
||||
|
||||
ALLOW_PRIVATE_CONF=/etc/squid/dify_allow_private.conf
|
||||
SANDBOX_PROXY_CONF=/etc/squid/dify_sandbox_proxy.conf
|
||||
|
||||
write_optional_private_allowlist() {
|
||||
local env_name="$1"
|
||||
local acl_name="$2"
|
||||
local acl_type="$3"
|
||||
local raw_values="${!env_name:-}"
|
||||
|
||||
raw_values="${raw_values//,/ }"
|
||||
|
||||
if [ -z "${raw_values//[[:space:]]/}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
printf 'acl %s %s' "$acl_name" "$acl_type" >> "$ALLOW_PRIVATE_CONF"
|
||||
for value in $raw_values; do
|
||||
printf ' %s' "$value" >> "$ALLOW_PRIVATE_CONF"
|
||||
done
|
||||
printf '\nhttp_access allow client_localnet %s\n' "$acl_name" >> "$ALLOW_PRIVATE_CONF"
|
||||
}
|
||||
|
||||
{
|
||||
echo "# Generated by docker-entrypoint.sh."
|
||||
echo "# Allows selected private targets before the default private-network deny rule."
|
||||
} > "$ALLOW_PRIVATE_CONF"
|
||||
write_optional_private_allowlist "SSRF_PROXY_ALLOW_PRIVATE_IPS" "dify_allowed_private_networks" "dst"
|
||||
write_optional_private_allowlist "SSRF_PROXY_ALLOW_PRIVATE_DOMAINS" "dify_allowed_private_domains" "dstdomain"
|
||||
|
||||
{
|
||||
echo "# Generated by docker-entrypoint.sh."
|
||||
echo "# Enables the middleware-only sandbox host bridge when configured."
|
||||
} > "$SANDBOX_PROXY_CONF"
|
||||
|
||||
if [ -n "${SSRF_SANDBOX_PROXY_PORT:-}" ]; then
|
||||
sandbox_proxy_host="${SSRF_SANDBOX_PROXY_HOST:-sandbox}"
|
||||
sandbox_proxy_target_port="${SANDBOX_PORT:-8194}"
|
||||
|
||||
{
|
||||
printf 'http_port %s accel vhost\n' "$SSRF_SANDBOX_PROXY_PORT"
|
||||
printf 'cache_peer %s parent %s 0 no-query originserver name=dify_sandbox\n' \
|
||||
"$sandbox_proxy_host" \
|
||||
"$sandbox_proxy_target_port"
|
||||
printf 'acl dify_sandbox_proxy_port localport %s\n' "$SSRF_SANDBOX_PROXY_PORT"
|
||||
printf 'http_access allow dify_sandbox_proxy_port\n'
|
||||
} >> "$SANDBOX_PROXY_CONF"
|
||||
fi
|
||||
|
||||
# Replace environment variables in the template and output to the squid.conf
|
||||
echo "[ENTRYPOINT] replacing environment variables in the template"
|
||||
awk '{
|
||||
while(match($0, /\${[A-Za-z_][A-Za-z_0-9]*}/)) {
|
||||
var = substr($0, RSTART+2, RLENGTH-3)
|
||||
val = ENVIRON[var]
|
||||
$0 = substr($0, 1, RSTART-1) val substr($0, RSTART+RLENGTH)
|
||||
}
|
||||
print
|
||||
}' /etc/squid/squid.conf.template > /etc/squid/squid.conf
|
||||
|
||||
/usr/sbin/squid -Nz
|
||||
echo "[ENTRYPOINT] starting squid"
|
||||
/usr/sbin/squid -f /etc/squid/squid.conf -NYC 1
|
||||
@@ -0,0 +1,22 @@
|
||||
# Dedicated Squid config for the dify-agent local_sandbox SSRF proxy.
|
||||
# All traffic on this proxy is restricted to:
|
||||
# - agent_backend /agent-stub/* endpoints
|
||||
# - Dify API /files/* endpoints (signed upload/download URLs)
|
||||
# External internet is allowed; all other private-network destinations are denied.
|
||||
|
||||
include /etc/squid/dify_common.conf
|
||||
|
||||
acl dst_agent_backend dstdomain agent_backend
|
||||
acl dst_dify_api dstdomain api
|
||||
acl path_files urlpath_regex -i ^/files/
|
||||
acl path_agent_stub urlpath_regex -i ^/agent-stub/
|
||||
|
||||
http_port ${HTTP_PORT}
|
||||
|
||||
http_access deny !Safe_ports
|
||||
http_access deny CONNECT !SSL_ports
|
||||
http_access allow dst_agent_backend path_agent_stub
|
||||
http_access allow dst_dify_api path_files
|
||||
include /etc/squid/dify_allow_private.conf
|
||||
http_access deny to_private_networks
|
||||
http_access allow all
|
||||
@@ -0,0 +1,90 @@
|
||||
# Shared Squid configuration used by both ssrf_proxy and agent_ssrf_proxy.
|
||||
|
||||
################################## ACL Definitions ################################
|
||||
acl client_localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
|
||||
acl client_localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)
|
||||
acl client_localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
|
||||
acl client_localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
|
||||
acl client_localnet src 172.16.0.0/12 # RFC 1918 local private network (LAN)
|
||||
acl client_localnet src 192.168.0.0/16 # RFC 1918 local private network (LAN)
|
||||
acl client_localnet src fc00::/7 # RFC 4193 local private network range
|
||||
acl client_localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
|
||||
|
||||
acl to_private_networks dst 0.0.0.0/8
|
||||
acl to_private_networks dst 10.0.0.0/8
|
||||
acl to_private_networks dst 100.64.0.0/10
|
||||
acl to_private_networks dst 127.0.0.0/8
|
||||
acl to_private_networks dst 169.254.0.0/16
|
||||
acl to_private_networks dst 172.16.0.0/12
|
||||
acl to_private_networks dst 192.168.0.0/16
|
||||
acl to_private_networks dst 224.0.0.0/4
|
||||
acl to_private_networks dst 240.0.0.0/4
|
||||
acl to_private_networks dst ::/128
|
||||
acl to_private_networks dst ::1/128
|
||||
acl to_private_networks dst ::ffff:0:0/96 # IPv4-mapped
|
||||
acl to_private_networks dst ::/96 # deprecated IPv4-compatible
|
||||
acl to_private_networks dst fc00::/7
|
||||
acl to_private_networks dst fe80::/10
|
||||
|
||||
acl SSL_ports port 443
|
||||
acl Safe_ports port 80 # http
|
||||
acl Safe_ports port 21 # ftp
|
||||
acl Safe_ports port 443 # https
|
||||
acl Safe_ports port 70 # gopher
|
||||
acl Safe_ports port 210 # wais
|
||||
acl Safe_ports port 1025-65535 # unregistered ports
|
||||
acl Safe_ports port 280 # http-mgmt
|
||||
acl Safe_ports port 488 # gss-http
|
||||
acl Safe_ports port 591 # filemaker
|
||||
acl Safe_ports port 777 # multiling http
|
||||
acl CONNECT method CONNECT
|
||||
|
||||
################################## Common Parameters ################################
|
||||
|
||||
tcp_outgoing_address 0.0.0.0
|
||||
|
||||
################################## Proxy Server ################################
|
||||
coredump_dir ${COREDUMP_DIR}
|
||||
refresh_pattern ^ftp: 1440 20% 10080
|
||||
refresh_pattern ^gopher: 1440 0% 1440
|
||||
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
|
||||
refresh_pattern \/(Packages|Sources)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
|
||||
refresh_pattern \/Release(|\.gpg)$ 0 0% 0 refresh-ims
|
||||
refresh_pattern \/InRelease$ 0 0% 0 refresh-ims
|
||||
refresh_pattern \/(Translation-.*)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
|
||||
refresh_pattern . 0 20% 4320
|
||||
|
||||
################################## Request Buffer ################################
|
||||
client_request_buffer_max_size 100 MB
|
||||
|
||||
################################## Performance & Concurrency ###############################
|
||||
max_filedescriptors 65536
|
||||
connect_timeout 30 seconds
|
||||
request_timeout 2 minutes
|
||||
read_timeout 2 minutes
|
||||
client_lifetime 5 minutes
|
||||
shutdown_lifetime 30 seconds
|
||||
|
||||
server_persistent_connections on
|
||||
client_persistent_connections on
|
||||
persistent_request_timeout 30 seconds
|
||||
pconn_timeout 1 minute
|
||||
|
||||
client_db on
|
||||
server_idle_pconn_timeout 2 minutes
|
||||
client_idle_pconn_timeout 2 minutes
|
||||
|
||||
quick_abort_min 16 KB
|
||||
quick_abort_max 16 MB
|
||||
quick_abort_pct 95
|
||||
|
||||
memory_cache_mode disk
|
||||
cache_mem 256 MB
|
||||
maximum_object_size_in_memory 512 KB
|
||||
|
||||
dns_timeout 30 seconds
|
||||
dns_retransmit_interval 5 seconds
|
||||
|
||||
logformat dify_log %ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %[un %Sh/%<a %mt
|
||||
access_log daemon:/var/log/squid/access.log dify_log
|
||||
logfile_rotate 10
|
||||
@@ -0,0 +1,121 @@
|
||||
acl client_localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
|
||||
acl client_localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)
|
||||
acl client_localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
|
||||
acl client_localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
|
||||
acl client_localnet src 172.16.0.0/12 # RFC 1918 local private network (LAN)
|
||||
acl client_localnet src 192.168.0.0/16 # RFC 1918 local private network (LAN)
|
||||
acl client_localnet src fc00::/7 # RFC 4193 local private network range
|
||||
acl client_localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
|
||||
acl to_private_networks dst 0.0.0.0/8
|
||||
acl to_private_networks dst 10.0.0.0/8
|
||||
acl to_private_networks dst 100.64.0.0/10
|
||||
acl to_private_networks dst 127.0.0.0/8
|
||||
acl to_private_networks dst 169.254.0.0/16
|
||||
acl to_private_networks dst 172.16.0.0/12
|
||||
acl to_private_networks dst 192.168.0.0/16
|
||||
acl to_private_networks dst 224.0.0.0/4
|
||||
acl to_private_networks dst 240.0.0.0/4
|
||||
acl to_private_networks dst ::/128
|
||||
acl to_private_networks dst ::1/128
|
||||
acl to_private_networks dst ::ffff:0:0/96 # IPv4-mapped
|
||||
acl to_private_networks dst ::/96 # deprecated IPv4-compatible
|
||||
acl to_private_networks dst fc00::/7
|
||||
acl to_private_networks dst fe80::/10
|
||||
acl SSL_ports port 443
|
||||
# acl SSL_ports port 1025-65535 # Enable the configuration to resolve this issue: https://github.com/langgenius/dify/issues/12792
|
||||
acl Safe_ports port 80 # http
|
||||
acl Safe_ports port 21 # ftp
|
||||
acl Safe_ports port 443 # https
|
||||
acl Safe_ports port 70 # gopher
|
||||
acl Safe_ports port 210 # wais
|
||||
acl Safe_ports port 1025-65535 # unregistered ports
|
||||
acl Safe_ports port 280 # http-mgmt
|
||||
acl Safe_ports port 488 # gss-http
|
||||
acl Safe_ports port 591 # filemaker
|
||||
acl Safe_ports port 777 # multiling http
|
||||
acl CONNECT method CONNECT
|
||||
acl allowed_domains dstdomain .marketplace.dify.ai
|
||||
|
||||
http_port ${HTTP_PORT}
|
||||
|
||||
http_access deny !Safe_ports
|
||||
http_access deny CONNECT !SSL_ports
|
||||
http_access allow localhost manager
|
||||
http_access deny manager
|
||||
include /etc/squid/dify_sandbox_proxy.conf
|
||||
include /etc/squid/dify_allow_private.conf
|
||||
http_access deny to_private_networks
|
||||
http_access allow allowed_domains
|
||||
http_access allow client_localnet
|
||||
http_access allow localhost
|
||||
http_access deny all
|
||||
tcp_outgoing_address 0.0.0.0
|
||||
|
||||
################################## Proxy Server ################################
|
||||
coredump_dir ${COREDUMP_DIR}
|
||||
refresh_pattern ^ftp: 1440 20% 10080
|
||||
refresh_pattern ^gopher: 1440 0% 1440
|
||||
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
|
||||
refresh_pattern \/(Packages|Sources)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
|
||||
refresh_pattern \/Release(|\.gpg)$ 0 0% 0 refresh-ims
|
||||
refresh_pattern \/InRelease$ 0 0% 0 refresh-ims
|
||||
refresh_pattern \/(Translation-.*)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
|
||||
refresh_pattern . 0 20% 4320
|
||||
|
||||
|
||||
# cache_dir ufs /var/spool/squid 100 16 256
|
||||
# upstream proxy, set to your own upstream proxy IP to avoid SSRF attacks
|
||||
# cache_peer 172.1.1.1 parent 3128 0 no-query no-digest no-netdb-exchange default
|
||||
|
||||
################################## Request Buffer ################################
|
||||
|
||||
# Unless the option's size is increased, an error will occur when uploading more than two files.
|
||||
client_request_buffer_max_size 100 MB
|
||||
|
||||
################################## Performance & Concurrency ###############################
|
||||
# Increase file descriptor limit for high concurrency
|
||||
max_filedescriptors 65536
|
||||
|
||||
# Timeout configurations for image requests
|
||||
connect_timeout 30 seconds
|
||||
request_timeout 2 minutes
|
||||
read_timeout 2 minutes
|
||||
client_lifetime 5 minutes
|
||||
shutdown_lifetime 30 seconds
|
||||
|
||||
# Persistent connections - improve performance for multiple requests
|
||||
server_persistent_connections on
|
||||
client_persistent_connections on
|
||||
persistent_request_timeout 30 seconds
|
||||
pconn_timeout 1 minute
|
||||
|
||||
# Connection pool and concurrency limits
|
||||
client_db on
|
||||
server_idle_pconn_timeout 2 minutes
|
||||
client_idle_pconn_timeout 2 minutes
|
||||
|
||||
# Quick abort settings - don't abort requests that are mostly done
|
||||
quick_abort_min 16 KB
|
||||
quick_abort_max 16 MB
|
||||
quick_abort_pct 95
|
||||
|
||||
# Memory and cache optimization
|
||||
memory_cache_mode disk
|
||||
cache_mem 256 MB
|
||||
maximum_object_size_in_memory 512 KB
|
||||
|
||||
# DNS resolver settings for better performance
|
||||
dns_timeout 30 seconds
|
||||
dns_retransmit_interval 5 seconds
|
||||
# By default, Squid uses the system's configured DNS resolvers.
|
||||
# If you need to override them, set dns_nameservers to appropriate servers
|
||||
# for your environment (for example, internal/corporate DNS). The following
|
||||
# is an example using public DNS and SHOULD be customized before use:
|
||||
# dns_nameservers 8.8.8.8 8.8.4.4
|
||||
|
||||
# Logging format for better debugging
|
||||
logformat dify_log %ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %[un %Sh/%<a %mt
|
||||
access_log daemon:/var/log/squid/access.log dify_log
|
||||
|
||||
# Access log to track concurrent requests and timeouts
|
||||
logfile_rotate 10
|
||||
Reference in New Issue
Block a user