--- title: n8n Self-Hosted AI Starter Kit emoji: 🚀 colorFrom: green colorTo: blue sdk: docker app_port: 5678 pinned: true # Add hardware requests if needed, e.g. for Ollama with larger models # hardware: cpu-upgrade # or gpu-small / gpu-a10g-small etc. # For GPU, Ollama should pick it up if drivers are compatible. # This Dockerfile is built for CPU by default for wider compatibility. persistent_storage: # Request persistent storage. Adjust size as needed for models, db, etc. # n8n data, postgres db, qdrant vectors, ollama models # Example: 10Gi for models and data data: type: "disk" size: 10 # GiB mount_path: "/data" # This is where it will be mounted in the container --- # n8n Self-Hosted AI Starter Kit on Hugging Face Spaces This Space deploys the [n8n Self-Hosted AI Starter Kit](https://github.com/n8n-io/self-hosted-ai-starter-kit) in a single container environment. It includes: * **n8n**: Low-code automation platform. * **Ollama**: Run local LLMs. * **Qdrant**: Vector database. * **PostgreSQL**: Database for n8n. ## Setup 1. **Secrets**: Before this Space can run correctly, you **MUST** configure the following secrets in your Space settings: * `N8N_ENCRYPTION_KEY`: A long, random string for encrypting sensitive n8n data. * Generate one with: `openssl rand -hex 32` * `DB_POSTGRESDB_PASSWORD`: Password for the PostgreSQL `n8n` user and database. * Choose a strong password. 2. **Wait for Build**: The first time, the Docker image will build, and services will start. This can take a few minutes. The `start.sh` script will also pull a default Ollama model (`llama3.1:8b` or similar small model), which can take time. 3. **Access n8n**: Once the Space is running, click the "Open app" button or use the direct URL to access n8n on port 5678. ## How to Use 1. **n8n First-Time Setup**: When you first access n8n, you'll be prompted to create an owner account. 2. **Local Services**: * **Ollama**: Running on `http://localhost:11434` (internally within the Space). The default model (`llama3.1:8b` or similar) should be available. You can use the "Ollama" node in n8n and set its "Base URL" to `http://localhost:11434`. * **Qdrant**: Running on `http://localhost:6333` (internally). Use the "Qdrant" node in n8n and set its "URL" to `http://localhost:6333`. * **PostgreSQL**: n8n is already configured to use the internal PostgreSQL instance. 3. **Persistent Storage**: * n8n workflows and credentials are stored in `/data/.n8n`. * PostgreSQL data is stored in `/data/postgres`. * Qdrant vector data is stored in `/data/qdrant_storage`. * Ollama models are stored in `/data/.ollama`. This data will persist across Space restarts if you've configured persistent storage for `/data`. 4. **Accessing Local Files in n8n**: The original starter kit mentions a `/data/shared` directory for n8n to access local files. This directory is available in this Space. When using n8n nodes like "Read/Write Files from Disk", use paths like `/data/shared/yourfile.txt`. ## Important Notes & Limitations * **Single Container**: All services (n8n, Postgres, Qdrant, Ollama) run in a single Docker container. This is less robust than a multi-container `docker-compose` setup but necessary for this Hugging Face Space deployment model. * **Resource Usage**: Running all these services, especially Ollama with LLMs, can be resource-intensive. Ensure your Space has adequate CPU, RAM, and storage. Consider upgrading hardware if performance is slow. * **Ollama Model Management**: * A default model is pulled on startup. * To pull other models, you would typically exec into the container (possible via `hf cli` or other tools, but not directly via the Space UI) and run `ollama pull `. Alternatively, some n8n Ollama nodes might trigger a download if the model isn't present (behavior may vary). * **Initial Startup Time**: The first startup might be slow due to database initialization and model download. Check the logs for progress. * **WEBHOOK_URL / N8N_EDITOR_BASE_URL**: These are automatically configured by the `start.sh` script to use the Hugging Face Space URL. ## OAuth Configuration (ClickUp and Other OAuth Providers) This n8n instance is configured to use `n8n-clickup-oauth-proxy.vercel.app` as the base URL for OAuth callbacks and webhooks. **For ClickUp OAuth setup in n8n:** - **Redirect URL**: `https://n8n-clickup-oauth-proxy.vercel.app/rest/oauth2-credential/callback` - Ensure your proxy at `n8n-clickup-oauth-proxy.vercel.app` forwards requests to the Space's actual n8n endpoint: `https://leon4gr45-n8n.hf.space/rest/oauth2-credential/callback` **Alternative webhook URL** (if needed): - `https://n8n-clickup-oauth-proxy.vercel.app/rest/workflow-callback-url` ## Troubleshooting * Check the Space logs for any errors during startup or operation. * Ensure secrets are correctly set. * If n8n is inaccessible, one of the backend services might have failed to start.