mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
337 lines
10 KiB
Plaintext
337 lines
10 KiB
Plaintext
---
|
|
title: Local Source Code Start
|
|
---
|
|
|
|
|
|
## Prerequisites
|
|
|
|
> Before installing Dify, make sure your machine meets the following minimum system requirements:
|
|
> - CPU >= 2 Core
|
|
> - RAM >= 4 GiB
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Operating System</th>
|
|
<th>Software</th>
|
|
<th>Explanation</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>macOS 10.14 or later</td>
|
|
<td>Docker Desktop</td>
|
|
<td>Set the Docker virtual machine (VM) to use a minimum of 2 virtual CPUs (vCPUs) and 8 GB of initial memory. Otherwise, the installation may fail. For more information, please refer to the <a href="https://docs.docker.com/desktop/mac/install/">Docker Desktop installation guide for Mac</a>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Linux platforms</td>
|
|
<td>
|
|
<p>Docker 19.03 or later</p>
|
|
<p>Docker Compose 1.25.1 or later</p>
|
|
</td>
|
|
<td>Please refer to the <a href="https://docs.docker.com/engine/install/">Docker installation guide</a> and <a href="https://docs.docker.com/compose/install/">the Docker Compose installation guide</a> for more information on how to install Docker and Docker Compose, respectively.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Windows with WSL 2 enabled</td>
|
|
<td>
|
|
<p>Docker Desktop</p>
|
|
<p></p>
|
|
</td>
|
|
<td>We recommend storing the source code and other data that is bound to Linux containers in the Linux file system rather than the Windows file system. For more information, please refer to the <a href="https://docs.docker.com/desktop/windows/install/#wsl-2-backend">Docker Desktop installation guide for using the WSL 2 backend on Windows.</a></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
> If you need to use OpenAI TTS, `FFmpeg` must be installed on the system for it to function properly. For more details, refer to: [Link](https://docs.dify.ai/getting-started/install-self-hosted/install-faq#id-14.-what-to-do-if-this-error-occurs-in-text-to-speech).
|
|
|
|
### Clone Dify
|
|
|
|
```Bash
|
|
git clone https://github.com/langgenius/dify.git
|
|
```
|
|
|
|
Before enabling business services, we need to first deploy PostgreSQL / Redis / Weaviate (if not locally available). We can start them with the follow`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`pyenv install.
|
|
|
|
```Bash
|
|
pyenv install 3.12
|
|
```
|
|
|
|
To switch to the "3.12" Python environment, use the following command:
|
|
|
|
```Bash
|
|
pyenv global 3.12```Bash
|
|
pyenv install 3.12
|
|
```:
|
|
|
|
1. Navigate to the "api" directory:
|
|
|
|
```
|
|
cd api
|
|
```
|
|
|
|
> For macOS```Bash
|
|
pyenv global 3.12
|
|
``` install libmagic`.
|
|
|
|
1. Copy the environment variable configuration file:
|
|
|
|
CODE_BLOCK`Bash
|
|
pyenv install 3.12
|
|
` `
|
|
|
|
To switch to the "3.12" Python environment, use the following command:
|
|
|
|
`n the .env file:
|
|
|
|
```
|
|
CODE_BLOCK_PLACEHOLDER`Bash
|
|
pyenv global 3.12```Bash
|
|
pyenv install 3.12
|
|
```:
|
|
|
|
1. Navigate to the "api" directory:
|
|
|
|
`. Install the ```
|
|
awk -v key="$(openssl rand -base64 42)" '/^SECRET_KEY=/ {sub(/=.*/, "=" key)} 1' .env > temp_env && mv temp_env .env
|
|
````poetry shell` to activate theINLINE_CODE_PLACEHO`
|
|
|
|
> For macOS```Bash
|
|
pyenv global 3.12
|
|
``` install libmagic` ```
|
|
|
|
4. Perform the database migration:
|
|
|
|
Perform database migration to the latest version:
|
|
|
|
```
|
|
poetry shell
|
|
fl`
|
|
|
|
2. Generate a random secret key and replace the value of SECRET_KEY in the .env file:
|
|
|
|
`OLDER_7 ```
|
|
* Debug mode: on
|
|
INFO:werkzeug:WARNING: This is a de`
|
|
```
|
|
cp .env.example .env
|
|
```2)" '/^SECRET_KEY=/ {sub(/=.*/, "=" key)} 1' .env > temp_env && mv temp_env .env
|
|
` * Running on http://127.0```
|
|
flask run --host 0.0.0.0 --port=5001 --debug
|
|
```rkzeug: * Restarting with stat
|
|
WARN`
|
|
|
|
3. Install the ```
|
|
awk -v key="$(openssl rand -base64 42)" '/^SECRET_KEY=/ {sub(/=.*/, "=" key)} 1' .env > temp_env && mv temp_env .env
|
|
````ws system to start the Worker s`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`0and instead:`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`1--without-gossip --withou`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`2----------- celery@TAKATOST.lan v5.2.7 (dawn-chorus)
|
|
--- ***** -----
|
|
`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`3it 2023-07-31 12:58:`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`4------- [c`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`5x7fb568572a10
|
|
- ** `Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`6k.add_document_to_index_task
|
|
. tasks.clean_dataset_task.clean_dataset_ta```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```3
|
|
|
|
```
|
|
# 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 `Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`7IC_API_PREFIX=http://localhost:5001/console/api
|
|
# The URL for Web APP, refers to the Web App base URL of INLINE_CODE_PLACEHOLDE`Bash
|
|
cd docker
|
|
cp middleware.env.```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```Interface Service
|
|
- Worker Asynchronous Queue Consumption Service
|
|
|
|
#### Installation of the basic environment:
|
|
|
|
Server startup requires Python 3.12. It is recommended to use [pyenv](https://github.com/pyenv/pyenv) for quick installation of the Python environment.
|
|
|
|
To install additional Python versions, use pyenv install.
|
|
|
|
`9your own risk.
|
|
info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
|
|
```
|
|
|
|
### Access Dify
|
|
|
|
Finally, access [http://127.0.0.1:3000](http://127.0.0.1:3000/) to use the locally deployed Dify.
|
|
```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```4```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```5```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```6```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```7```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```8```Bash
|
|
cd docker
|
|
cp middleware.env.example middleware.env
|
|
docker compose -f docker-compose.middleware.yaml up -d
|
|
```9`Bash
|
|
pyenv install 3.12
|
|
`0`Bash
|
|
pyenv install 3.12
|
|
`1`Bash
|
|
pyenv install 3.12
|
|
`2`Bash
|
|
pyenv install 3.12
|
|
`3`Bash
|
|
pyenv install 3.12
|
|
`4`Bash
|
|
pyenv install 3.12
|
|
`5`Bash
|
|
pyenv install 3.12
|
|
`6`Bash
|
|
pyenv install 3.12
|
|
`7 |