dify / README.md
Sebastien Campion
Deploy Dify v1.14.2 with persistent storage
3f36032
|
Raw
History Blame Contribute Delete
1.54 kB
metadata
title: Dify
emoji: 🐒
colorFrom: gray
colorTo: red
sdk: docker
pinned: false

Dify on HuggingFace Spaces

Self-hosted Dify (v1.14.2) running as a single Docker container on HuggingFace Spaces.

Setup

  1. Enable Persistent Storage in your Space settings (Settings β†’ Persistent storage). This mounts /data and preserves your database, uploads, and configuration across container restarts.

  2. Set the following Secrets in your Space settings for security:

    • SECRET_KEY β€” a random string (generate with openssl rand -base64 42)
    • INIT_PASSWORD β€” admin account initial password
  3. The Space will build and deploy automatically. First boot takes a few minutes to initialize the database.

Default Credentials

  • URL: https://<your-space>.hf.space
  • Initial admin password: dify123456 (change via INIT_PASSWORD secret)

Architecture

Single container running via supervisord:

  • PostgreSQL 15 β€” application database (data at /data/postgres)
  • Redis β€” cache and Celery broker (data at /data/redis)
  • Dify API β€” Flask/Gunicorn on port 5001
  • Dify Worker β€” Celery async worker
  • Dify Web β€” Next.js frontend on port 3000
  • Nginx β€” reverse proxy on port 7860 (HF Spaces ingress port)

File uploads stored at /data/storage.

Configuration

Override any Dify environment variable via HuggingFace Space Secrets or Variables. Common ones:

  • SECRET_KEY, INIT_PASSWORD
  • LOG_LEVEL (default: INFO)
  • STORAGE_TYPE (default: local)