Upload folder using huggingface_hub
Browse files- Dockerfile +62 -0
- README.md +75 -10
Dockerfile
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:20-alpine
|
| 2 |
+
|
| 3 |
+
# Set user to root for installation
|
| 4 |
+
USER root
|
| 5 |
+
|
| 6 |
+
# Arguments that can be passed at build time
|
| 7 |
+
ARG N8N_PATH=/usr/local/lib/node_modules/n8n
|
| 8 |
+
ARG BASE_PATH=/root/.n8n
|
| 9 |
+
ARG DATABASE_PATH=$BASE_PATH/database
|
| 10 |
+
ARG CONFIG_PATH=$BASE_PATH/config
|
| 11 |
+
ARG WORKFLOWS_PATH=$BASE_PATH/workflows
|
| 12 |
+
ARG LOGS_PATH=$BASE_PATH/logs
|
| 13 |
+
ARG N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=$N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS
|
| 14 |
+
ARG N8N_RUNNERS_ENABLED=true
|
| 15 |
+
ARG allowVulnerableTags=true
|
| 16 |
+
ARG N8N_HOST=$N8N_HOST
|
| 17 |
+
ARG N8N_PORT=$N8N_PORT
|
| 18 |
+
ARG N8N_PROTOCOL=https
|
| 19 |
+
ARG N8N_EDITOR_BASE_URL=$N8N_EDITOR_BASE_URL
|
| 20 |
+
ARG WEBHOOK_URL=$WEBHOOK_URL
|
| 21 |
+
ARG GENERIC_TIMEZONE=$GENERIC_TIMEZONE
|
| 22 |
+
ARG TZ=$TZ
|
| 23 |
+
ARG N8N_ENCRYPTION_KEY=$N8N_ENCRYPTION_KEY
|
| 24 |
+
ARG DB_TYPE=$DB_TYPE
|
| 25 |
+
ARG DB_POSTGRESDB_SCHEMA=$DB_POSTGRESDB_SCHEMA
|
| 26 |
+
ARG DB_POSTGRESDB_HOST=$DB_POSTGRESDB_HOST
|
| 27 |
+
ARG DB_POSTGRESDB_DATABASE=$DB_POSTGRESDB_DATABASE
|
| 28 |
+
ARG DB_POSTGRESDB_PORT=$DB_POSTGRESDB_PORT
|
| 29 |
+
ARG DB_POSTGRESDB_USER=$DB_POSTGRESDB_USER
|
| 30 |
+
ARG DB_POSTGRESDB_PASSWORD=$DB_POSTGRESDB_PASSWORD
|
| 31 |
+
ARG NODE_FUNCTION_ALLOW_BUILTIN=*
|
| 32 |
+
ARG NODE_FUNCTION_ALLOW_EXTERNAL=*
|
| 33 |
+
# Install system dependencies
|
| 34 |
+
RUN apk add --no-cache \
|
| 35 |
+
git \
|
| 36 |
+
python3 \
|
| 37 |
+
py3-pip \
|
| 38 |
+
make \
|
| 39 |
+
g++ \
|
| 40 |
+
build-base \
|
| 41 |
+
cairo-dev \
|
| 42 |
+
pango-dev \
|
| 43 |
+
chromium \
|
| 44 |
+
postgresql-client
|
| 45 |
+
|
| 46 |
+
# Set environment variables
|
| 47 |
+
ENV PUPPETEER_SKIP_DOWNLOAD=true
|
| 48 |
+
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
| 49 |
+
|
| 50 |
+
# Install n8n globally
|
| 51 |
+
RUN npm install -g n8n
|
| 52 |
+
|
| 53 |
+
# Create necessary directories (<<<<< this is the line that was modified)
|
| 54 |
+
RUN mkdir -p $BASE_PATH \
|
| 55 |
+
&& chmod -R 777 $BASE_PATH
|
| 56 |
+
|
| 57 |
+
# Set working directory
|
| 58 |
+
WORKDIR /data
|
| 59 |
+
|
| 60 |
+
# Start n8n
|
| 61 |
+
|
| 62 |
+
CMD ["n8n", "start"]
|
README.md
CHANGED
|
@@ -1,10 +1,75 @@
|
|
| 1 |
-
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: N8n
|
| 3 |
+
emoji: ⚡
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
+
short_description: n8n free hosted with supebase
|
| 10 |
+
---
|
| 11 |
+
Created by **[ABCDO](https://abcdo.tn/)** & [EnzGamers](https://huggingface.co/EnzGamers) .
|
| 12 |
+
Check out the configuration reference at [spaces-config-reference](https://huggingface.co/docs/hub/spaces-config-reference) .
|
| 13 |
+
--
|
| 14 |
+
|
| 15 |
+
# n8n - Extended Workflow Automation on Hugging Face Spaces
|
| 16 |
+
|
| 17 |
+
This Hugging Face Space runs a powerful, extended instance of [n8n](https://n8n.io/), an open-source, fair-code, and self-hostable workflow automation tool.
|
| 18 |
+
|
| 19 |
+
This isn't just the standard n8n. This custom Docker image comes pre-loaded with a wide range of system dependencies, designed to support a vast array of community nodes and complex workflows right out of the box, without any extra configuration.
|
| 20 |
+
|
| 21 |
+
## ✨ Key Features of This Custom Image
|
| 22 |
+
|
| 23 |
+
- **Based on Node.js 20**: Built on a modern and efficient `node:20-alpine` base image.
|
| 24 |
+
- **Chromium Included**: Full support for browser automation, web scraping, and PDF generation nodes thanks to the pre-installed `chromium`.
|
| 25 |
+
- **Python & Git Ready**: Comes with `python3`, `pip`, and `git` installed, allowing you to run scripts and interact with repositories directly within your workflows.
|
| 26 |
+
- **Build Tools Pre-installed**: Includes `build-base`, `g++`, and `make` to ensure compatibility with nodes that require compiling native addons.
|
| 27 |
+
- **Database Clients**: `postgresql-client` is included for easy connection to external PostgreSQL databases.
|
| 28 |
+
- **Graphics Libraries**: `cairo-dev` and `pango-dev` are available for nodes that perform canvas or image manipulation.
|
| 29 |
+
|
| 30 |
+
## 🚀 How to Use
|
| 31 |
+
|
| 32 |
+
1. **Launch the Space**: This Space will build the Docker container and start n8n automatically. Please be patient during the initial startup.
|
| 33 |
+
2. **Access n8n**: Once the application is running, the n8n editor will be available to use.
|
| 34 |
+
3. **Start Automating**: Begin building your workflows! You can now use many community nodes that would typically fail in a standard setup.
|
| 35 |
+
|
| 36 |
+
### Data Persistence
|
| 37 |
+
|
| 38 |
+
By default, this Space uses SQLite to store your workflows and credentials, which are saved to the container's local filesystem (`/root/.n8n`).
|
| 39 |
+
|
| 40 |
+
**Important**: The filesystem of a Hugging Face Space is ephemeral. To ensure your workflows are not lost when the Space restarts, you should:
|
| 41 |
+
1. **Download Your Workflows**: Regularly download your important workflows as JSON files from the n8n UI.
|
| 42 |
+
2. **Commit to Repository**: For a more advanced setup, you can configure a process to commit your workflow files (`/root/.n8n/workflows/*.json`) back to the Space's Git repository.
|
| 43 |
+
|
| 44 |
+
## ⚙️ Configuration (Using Space Secrets)
|
| 45 |
+
|
| 46 |
+
For a secure and customized setup, you should configure n8n using Hugging Face Space Secrets. You can find these in your Space's **Settings** tab.
|
| 47 |
+
|
| 48 |
+
| Secret Key | Description | Example Value |
|
| 49 |
+
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
|
| 50 |
+
| `N8N_ENCRYPTION_KEY` | **(Highly Recommended)** A long, random, and secret key to encrypt your credentials. If not set, credentials are less secure. | `your_very_secret_and_long_encryption_key` |
|
| 51 |
+
| `GENERIC_TIMEZONE` | Sets the server timezone to ensure CRON nodes and date-based triggers run at the correct time. A list of timezones can be found [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). | `Europe/Berlin` |
|
| 52 |
+
| `NODE_FUNCTION_ALLOW_EXTERNAL` | Comma-separated list of external npm modules to allow in the Function and Edit Fields nodes (e.g., `axios,lodash`). | `axios,moment` |
|
| 53 |
+
| `WEBHOOK_URL` | **(Required for Production)** Manually set the public-facing webhook URL. It should be the URL of your Hugging Face Space. | `https://your-space-name.hf.space/` |
|
| 54 |
+
|
| 55 |
+
### Connecting to an External Database
|
| 56 |
+
|
| 57 |
+
While SQLite is fine for testing, you can connect to an external PostgreSQL database (ex: Supabase 😉) for a more robust, production-ready setup. Simply set the following secrets:
|
| 58 |
+
|
| 59 |
+
- `DB_TYPE`: `postgresdb`
|
| 60 |
+
- `DB_POSTGRESDB_HOST`: Your database host
|
| 61 |
+
- `DB_POSTGRESDB_DATABASE`: Your database name
|
| 62 |
+
- `DB_POSTGRESDB_USER`: Your database user
|
| 63 |
+
- `DB_POSTGRESDB_PASSWORD`: Your database password
|
| 64 |
+
- `DB_POSTGRESDB_PORT`: `5432`
|
| 65 |
+
|
| 66 |
+
## 🐳 About the Dockerfile
|
| 67 |
+
|
| 68 |
+
This instance is built from the provided `Dockerfile`. Here is a summary of its setup:
|
| 69 |
+
|
| 70 |
+
- **Base Image**: `node:20-alpine`
|
| 71 |
+
- **n8n Version**: `Latset`
|
| 72 |
+
- **System Dependencies**: Installs `git`, `python3`, `chromium`, `build-base`, `postgresql-client`, and more using `apk`.
|
| 73 |
+
- **Environment**: Sets up `PUPPETEER_EXECUTABLE_PATH` to work with the bundled Chromium.
|
| 74 |
+
- **Directories**: Creates and sets appropriate permissions for the n8n data directory at `/root/.n8n`.
|
| 75 |
+
- **Execution**: Starts n8n using the default `n8n start` command.
|