dify源码启动

Local Source Code Start – Dify Docs

未加粗:初始化

加粗:源码启动升级方式

代码拉取合并

git clone https://github.com/langgenius/dify.git

git config set修改url为kkgithub、gh-proxy或开小猫咪

git stash 暂存修改

docker部署:git checkout main
git pull origin main

git fetch –all 用于从所有远程仓库获取最新提交和分支信息

git checkout +版本号

git stash pop:合并修改+根据日志检查文件是否有需要手动修改的部分

中间件

cd docker
cp middleware.env.example middleware.env
docker compose -f docker-compose.middleware.yaml up -d(vscode配置好docker-desktop右键down+up拉取镜像,开小猫咪)

python环境

pyenv install 3.12

pyenv global 3.12

后端:建议powershell

cd api

cp .env.example .env

awk -v key=”$(openssl rand -base64 42)” ‘/^SECRET_KEY=/ {sub(/=.*/, “=” key)} 1’ .env > temp_env && mv temp_env .env

uv sync(开小猫咪)

uv run flask db upgrade

uv run flask run –host 0.0.0.0 –port=5001 –debug

新窗口

uv run celery -A app.celery worker -P solo –without-gossip –without-mingle -Q dataset,generation,mail,ops_trace –loglevel INFO

前端:建议git bash

Install Node.js v22 (LTS) Please visit https://nodejs.org/en/download

npm i -g pnpm

cd web

先rm -rf node_modules

pnpm install –frozen-lockfile

  1. Prepare the environment variable config fileCreate a file named .env.local in the current directory and copy the contents from .env.example. Modify the values of these environment variables according to your requirements:Copy# For production release, change this to PRODUCTION NEXT_PUBLIC_DEPLOY_ENV=DEVELOPMENT # The deployment edition, SELF_HOSTED or CLOUD NEXT_PUBLIC_EDITION=SELF_HOSTED # The base URL of console application, refers to the Console base URL of WEB service if console domain is # different from api or web app domain. # example: http://cloud.dify.ai/console/api NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from # console or api domain. # example: http://udify.app/api NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api # SENTRY NEXT_PUBLIC_SENTRY_DSN= NEXT_PUBLIC_SENTRY_ORG= NEXT_PUBLIC_SENTRY_PROJECT=

pnpm build

pnpm start

发表评论