Skip to content

Commit 79852df

Browse files
committed
Update README & Add N8N start options
1 parent f530370 commit 79852df

File tree

5 files changed

+55
-8
lines changed

5 files changed

+55
-8
lines changed

.env.template

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,10 @@ DOCKER_UID=1000
55
DOCKER_GID=1000
66

77
# Public URL of the server
8-
PUBLIC_URL=http://n8n.localhost
8+
PUBLIC_URL=http://localhost
9+
10+
# N8N encryption key
11+
N8N_ENCRYPTION_KEY=
12+
13+
# Options to forward to N8N
14+
N8N_OPTIONS="--tunnel"

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Self-hosted N8N
2+
3+
This repository is a starter-pack to get a self-hosted N8N instance with:
4+
- A containerized setup (docker)
5+
- An export/import workflow to export/import current workflows and credentials to local folders
6+
- A persistent encryption key to keep your credentials across losing your container
7+
8+
## Install
9+
10+
```bash
11+
# 1. Clone the repository
12+
git clone https://github.com/7PH/n8n-self-hosted.git
13+
cd n8n-self-hosted
14+
15+
# 2. Copy `.env.template` to `.env` and tweak the environment variables
16+
# In particular, ensure `N8N_ENCRYPTION_KEY` is set
17+
cp .env.template .env
18+
19+
# 3. Run `docker compose up`
20+
docker compose up
21+
```

docker-compose.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ version: '3.8'
22

33

44
services:
5-
# /n8n
65
n8n:
76
container_name: n8n
7+
cap_drop:
8+
- ALL
89
ports:
910
- 80:80
1011
build:
@@ -13,8 +14,8 @@ services:
1314
DOCKER_USER: "${DOCKER_USER}"
1415
DOCKER_UID: "${DOCKER_UID}"
1516
DOCKER_GID: "${DOCKER_GID}"
16-
labels:
17-
- "traefik.enable=true"
17+
env_file:
18+
- .env
1819
volumes:
1920
- ./credentials/:/app/credentials:rw
2021
- ./workflows/:/app/workflows:rw

start.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
n8n import:credentials --separate --input=credentials
44
n8n import:workflow --separate --input=workflows
5-
n8n start --tunnel
5+
n8n start $N8N_OPTIONS

workflows/2.json

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"createdAt": "2023-01-02T10:29:34.090Z",
3-
"updatedAt": "2023-01-05T01:12:55.194Z",
3+
"updatedAt": "2023-01-05T01:14:44.000Z",
44
"id": 2,
55
"name": "internal/import",
66
"active": false,
@@ -28,6 +28,19 @@
2828
],
2929
"typeVersion": 1,
3030
"id": "699de5bc-17fc-4383-b060-3890fa70bf67"
31+
},
32+
{
33+
"parameters": {
34+
"command": "npx n8n import:credentials --separate --input=credentials"
35+
},
36+
"name": "Import Credentials",
37+
"type": "n8n-nodes-base.executeCommand",
38+
"position": [
39+
860,
40+
340
41+
],
42+
"typeVersion": 1,
43+
"id": "51a48ad2-1744-4a60-a3f3-78c11b8fefe8"
3144
}
3245
],
3346
"connections": {
@@ -44,15 +57,21 @@
4457
},
4558
"Import Workflows": {
4659
"main": [
47-
[]
60+
[
61+
{
62+
"node": "Import Credentials",
63+
"type": "main",
64+
"index": 0
65+
}
66+
]
4867
]
4968
}
5069
},
5170
"settings": {},
5271
"staticData": null,
5372
"dataLoaded": false,
5473
"pinData": {},
55-
"versionId": "f79b1bbb-ad69-4ef9-8e11-786289a59e05",
74+
"versionId": "ee13fa9e-3eef-4745-a33b-5b67fa5b5deb",
5675
"triggerCount": 0,
5776
"tags": [
5877
{

0 commit comments

Comments
 (0)