Tomo Wang
commited on
Commit
·
2fa2e0b
1
Parent(s):
5f4a4b3
doc: add steps for supabase db and deployment
Browse files
README.md
CHANGED
@@ -10,9 +10,83 @@ app_port: 5678
|
|
10 |
short_description: n8n hosting using huggingface
|
11 |
---
|
12 |
|
13 |
-
|
14 |
|
15 |
-
n8n
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
short_description: n8n hosting using huggingface
|
11 |
---
|
12 |
|
13 |
+
# Hosting n8n using huggingface space
|
14 |
|
15 |
+
If you don't have a cloud instance or domain, self hosting n8n may be a bit difficult.
|
16 |
+
This repository is a template for hosting n8n using huggingface space.
|
17 |
+
|
18 |
+
## Using Supabase for database
|
19 |
+
|
20 |
+
According to [huggingface space documentation](https://huggingface.co/docs/hub/en/spaces-overview#lifecycle-management),
|
21 |
+
Space will "go to sleep" and stop executing after a period of time if unused.
|
22 |
+
To avoid this, we can use [Supabase](https://supabase.com/) for the database.
|
23 |
+
|
24 |
+
1. Sign up for a free account at <https://supabase.com/dashboard/sign-up>
|
25 |
+
2. Create a new project and fill the form. Save the database password for later use.
|
26 |
+
|
27 |
+

|
28 |
+

|
29 |
+
|
30 |
+
3. View the database connection info by click the **Connect** button on the top left nav bar.
|
31 |
+
|
32 |
+

|
33 |
+
|
34 |
+
4. Select **SQLAlchemy** as Connection String and find the **Transaction pooler** section.
|
35 |
+
|
36 |
+

|
37 |
+

|
38 |
+
|
39 |
+
5. Save the connection info for later use: host, port, user, dbname.
|
40 |
+
|
41 |
+
## Deploying n8n using huggingface space
|
42 |
+
|
43 |
+
Huggingface space provide a free tier with 16GB RAM, 2 CPU cores and 50GB of
|
44 |
+
(not persistent) disk space. This is enough for hosting n8n.
|
45 |
+
|
46 |
+
| **Hardware** | **GPU Memory** | **CPU** | **Memory** | **Disk** | **Hourly Price** |
|
47 |
+
| ------------ | -------------- | ------- | ---------- | -------- | ---------------- |
|
48 |
+
| CPU Basic | - | 2 vCPU | 16 GB | 50 GB | Free! |
|
49 |
+
|
50 |
+
Using this space to duplicate and deploy n8n in the easy way.
|
51 |
+
|
52 |
+
1. Sign up for a free account at <https://huggingface.co/join> and pick a profile name.
|
53 |
+
`tomowang` is the profile in <https://huggingface.co/tomowang> as an example.
|
54 |
+
Remember the profile name for later use.
|
55 |
+
|
56 |
+
2. Access <https://huggingface.co/spaces/tomowang/n8n> and click the menu drop
|
57 |
+
down in top right corner and select **Duplicate this space**.
|
58 |
+
|
59 |
+

|
60 |
+
|
61 |
+
3. Fill or change the variable and secrets in pop-up form and click **Duplicate**.
|
62 |
+
|
63 |
+

|
64 |
+
|
65 |
+
| **Variable** | **Value** |
|
66 |
+
| ------------------------ | -------------------------------------------------------- |
|
67 |
+
| `DB_POSTGRESDB_PASSWORD` | supabase db password |
|
68 |
+
| `DB_POSTGRESDB_USER` | supabase db connection `user` |
|
69 |
+
| `DB_POSTGRESDB_HOST` | supabase db connection `host` |
|
70 |
+
| `DB_POSTGRESDB_PORT` | 6543 |
|
71 |
+
| `N8N_ENCRYPTION_KEY` | Random string. Use `openssl rand -base64 32` to generate |
|
72 |
+
| `WEBHOOK_URL` | Example `https://<profile>-n8n.hf.space/` |
|
73 |
+
| `N8N_EDITOR_BASE_URL` | Example `https://<profile>-n8n.hf.space/` |
|
74 |
+
| `GENERIC_TIMEZONE` | Config by requirement |
|
75 |
+
| `TZ` | Config by requirement |
|
76 |
+
|
77 |
+
4. Click **Duplicate Space** and wait for the deployment to finish. You can
|
78 |
+
find the logs as following
|
79 |
+
|
80 |
+

|
81 |
+
|
82 |
+
5. Once the deployment is finished, you can find the URL as configured in the
|
83 |
+
`N8N_EDITOR_BASE_URL` variable.
|
84 |
+
|
85 |
+

|
86 |
+
|
87 |
+
Now you can access n8n using the URL.
|
88 |
+
|
89 |
+
> n8n use [helmet](https://github.com/helmetjs/helmet) for security headers.
|
90 |
+
> In production mode, it will set `X-Frame-Options` to `sameorigin`, which causes
|
91 |
+
> the n8n site to be blocked by the iframe in the Huggingface Space
|
92 |
+
> (code <https://github.com/n8n-io/n8n/blob/master/packages/cli/src/server.ts#L401-L402>).
|