A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.dify.ai/getting-started/install-self-hosted/local-source-code below:

Local Source Code Start - Dify Docs

Prerequisites Setup Docker and Docker Compose
Before installing Dify, make sure your machine meets the following minimum system requirements:
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.
Clone Dify RepositoryRun the git command to clone the Dify repository.
git clone https://github.com/langgenius/dify.git
Start Middlewares with Docker ComposeA series of middlewares for storage (e.g. PostgreSQL / Redis / Weaviate (if not locally available)) and extended capabilities (e.g. Dify’s sandbox and plugin-daemon services) are required by Dify backend services. Start the middlewares with Docker Compose by running these commands:
cd docker
cp middleware.env.example middleware.env
docker compose -f docker-compose.middleware.yaml up -d
Setup Backend ServicesThe backend services include
  1. API Service: serving API requests for Frontend service and API accessing
  2. Worker Service: serving the aync tasks for datasets processing, workspaces, cleaning-ups etc.
Environment PreparationPython 3.12 is required. It is recommended to use pyenv for quick installation of the Python environment. To install additional Python versions, use pyenv install. To switch to the “3.12” Python environment, use the following command: Start API service
  1. Navigate to the api directory:
  2. Prepare the environment variable config file
  3. Generate a random secret key and replace the value of SECRET_KEY in the .env file
    awk -v key="$(openssl rand -base64 42)" '/^SECRET_KEY=/ {sub(/=.*/, "=" key)} 1' .env > temp_env && mv temp_env .env
    
  4. Dependencies installation uv is used to manage dependencies. Install the required dependencies with uv by running:
    For macOS: install libmagic with brew install libmagic.
  5. Perform the database migration Perform database migrations to the latest version:
  6. Start the API service
    uv run flask run --host 0.0.0.0 --port=5001 --debug
    
    Expected output:
    * Debug mode: on
    INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
     * Running on all addresses (0.0.0.0)
     * Running on http://127.0.0.1:5001
    INFO:werkzeug:Press CTRL+C to quit
    INFO:werkzeug: * Restarting with stat
    WARNING:werkzeug: * Debugger is active!
    INFO:werkzeug: * Debugger PIN: 695-801-919
    
Start the Worker serviceTo consume asynchronous tasks from the queue, such as dataset file import and dataset document updates, follow these steps to start the Worker service Setup Web ServiceStart the web service is built for frontend pages . Environment PreparationTo start the web frontend service, Node.js v22 (LTS) and PNPM v10 are requied. Start Web Service
  1. Enter the web directory
  2. Dependencies installation
    pnpm install --frozen-lockfile
    
  3. Prepare the environment variable config file Create 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:
    # 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=
    
  4. Build the web service
  5. Start the web service Expected output:
       ▲ Next.js 15
       - Local:        http://localhost:3000
       - Network:      http://0.0.0.0:3000
    
     ✓ Starting...
     ✓ Ready in 73ms
    
Access DifyAccess http://127.0.0.1:3000 via browsers to enjoy all the exciting features of Dify. Cheers ! 🍻 Edit this page | Report an issue

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4