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
Enable Persistent Storage in your Space settings (Settings β Persistent storage). This mounts
/dataand preserves your database, uploads, and configuration across container restarts.Set the following Secrets in your Space settings for security:
SECRET_KEYβ a random string (generate withopenssl rand -base64 42)INIT_PASSWORDβ admin account initial password
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 viaINIT_PASSWORDsecret)
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_PASSWORDLOG_LEVEL(default: INFO)STORAGE_TYPE(default: local)