Skip to content

Commit e55b9e6

Browse files
feat(video): Self-Host Your Own Automation Platform with n8n + Docker
1 parent d94cc6c commit e55b9e6

File tree

2 files changed

+185
-0
lines changed

2 files changed

+185
-0
lines changed

_posts/2025-07-11-n8n-self-hosted.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
---
2+
layout: post
3+
title: "Self-Host Your Own Automation Platform with n8n + Docker"
4+
date: 2025-07-11 08:00:00 -0500
5+
categories: self-hosted
6+
tags: homelab n8n self-hosted workflow automation
7+
image:
8+
path: /assets/img/headers/n8n-self-hosted-hero.webp
9+
lqip: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAUACgMBEQACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APwPsvGXiPwJ+ylpPiy1bRtQ0m9+Out+CbzQ7nTLoX9xoGheEPDPirUNGbWX1WewGi+IdU8Vrd3kI8Of21p1/pFtd6N4hsIri4szrRjGnXp1KvNiacKnNUoVHGnGrCVZT9k50IU6kFGmnQhOMuf2b5pudVe0M8RNVqsalGnTwcVhqNB0cP7SdKdWlQpUp4ybxVTE1vrGIqU54mtCFaGEVavVjh8Lh8PGhQofmhqVzbT6hfzWVkNPs5r26ltLAXEt0LG2knd4LQXM4864FtEUhE8372bZ5knzsaqrVg6lR06XsqbnNwp87n7ODk+WHPJc0uSNo80tZWu9WZK6STd2kru1rvq7LRX3sj//2Q==
10+
---
11+
12+
n8n is a powerful self-hosted workflow automation tool. In this tutorial, I’ll show you how to self-host n8n on Linux using Docker. You’ll learn how to set up the environment, configure it with a .env file, and build workflows that connect to services like Google Sheets and Discord.
13+
14+
We’ll start with a simple manual trigger, then create a scheduled workflow, and move on to a more advanced automation that pulls in data from external services and processes it through n8n’s visual workflow editor. Whether you’re just exploring n8n or ready to start building, this guide will help you get up and running with a flexible, powerful automation platform.
15+
16+
{% include embed/youtube.html id='gyn8bcOLdcA' %}
17+
📺 [Watch Video](https://www.youtube.com/watch?v=gyn8bcOLdcA)
18+
19+
## Info
20+
21+
For this setup, I’ll be using **Docker Compose on Ubuntu Linux**—specifically the latest Ubuntu LTS and the latest version of Docker with Compose support. This makes the setup clean, consistent, and easy to repeat.
22+
23+
To to learn more about n8n, [check out the GitHub repo](https://github.com/n8n-io/n8n)
24+
25+
## Install Docker
26+
27+
To install docker, see [this post](/posts/docker-compose-install/)
28+
29+
## Setting Up
30+
31+
Let’s walk through the initial setup.
32+
33+
### Check Docker Installation
34+
35+
First, make sure Docker is installed and working by running:
36+
37+
```shell
38+
docker -v
39+
```
40+
41+
If that returns a version, you're good to go.
42+
43+
### Create the Project Folder
44+
45+
I like to keep things organized under `/opt/stacks`, but you can adjust this to fit your structure:
46+
47+
```shell
48+
sudo mkdir -p /opt/stacks/n8n
49+
sudo chown serveradmin:serveradmin -R /opt/stacks
50+
cd /opt/stacks/n8n
51+
```
52+
53+
### Create the Docker Compose File
54+
55+
Create the file:
56+
57+
```shell
58+
nano compose.yaml
59+
```
60+
61+
Paste in the following yaml:
62+
63+
```yaml
64+
services:
65+
n8n:
66+
image: n8nio/n8n:latest
67+
restart: always
68+
ports:
69+
- "5678:5678"
70+
env_file:
71+
- .env
72+
volumes:
73+
- ./data:/home/node/.n8n
74+
- ./files:/files
75+
depends_on:
76+
- postgres
77+
# labels:
78+
# - "traefik.enable=true"
79+
# - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.rule=Host(`${TRAEFIK_DOMAIN}`)"
80+
# - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.entrypoints=websecure"
81+
# - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.tls.certresolver=${TRAEFIK_CERT_RESOLVER}"
82+
# - "traefik.http.services.${TRAEFIK_ROUTER_NAME}.loadbalancer.server.port=5678"
83+
84+
# If you're running your own external PostgreSQL instance, you can comment out this service
85+
postgres:
86+
image: postgres:15
87+
restart: always
88+
env_file:
89+
- .env
90+
volumes:
91+
- ./postgres-data:/var/lib/postgresql/data
92+
```
93+
94+
This gives us a working setup using Docker Compose, with support for environment variables, volumes for persistence, and optional Traefik labels if you want to enable TLS down the line.
95+
96+
## Create the `.env` File
97+
98+
Create and edit the environment file:
99+
100+
```shell
101+
nano .env
102+
```
103+
104+
Paste in your values:
105+
106+
```shell
107+
# n8n Settings
108+
DOMAIN_NAME=example.com
109+
SUBDOMAIN=n8n
110+
GENERIC_TIMEZONE=America/New_York
111+
N8N_HOST=n8n.example.com
112+
N8N_PROTOCOL=https
113+
WEBHOOK_URL=https://n8n.example.com/
114+
N8N_SECURE_COOKIE=false
115+
116+
# Traefik (optional)
117+
TRAEFIK_ROUTER_NAME=n8n
118+
TRAEFIK_DOMAIN=n8n.example.com
119+
TRAEFIK_CERT_RESOLVER=mytlschallenge
120+
121+
# PostgreSQL
122+
POSTGRES_DB=n8n
123+
POSTGRES_USER=n8n
124+
POSTGRES_PASSWORD=changeme123
125+
```
126+
127+
This file lets us easily manage settings, especially if you're running multiple stacks. If you’re using Traefik, the optional labels in `compose.yaml` will pull values from here automatically.
128+
129+
## Starting the Stack
130+
131+
Navigate to your project directory:
132+
133+
```shell
134+
cd /opt/stacks/n8n
135+
```
136+
137+
Then bring everything up in the background:
138+
139+
```shell
140+
docker compose up -d
141+
```
142+
143+
Docker will pull the required images and spin up your containers. Once that’s done, n8n should be up and running—by default on port **5678**, or at the domain you configured if you're using a reverse proxy like Traefik.
144+
145+
## Confirm It’s Running
146+
147+
To confirm everything started correctly, run:
148+
149+
```shell
150+
docker ps
151+
```
152+
153+
You should see both the `n8n` and `postgres` containers listed and running. If not, check the logs with:
154+
155+
```shell
156+
docker compose logs
157+
```
158+
159+
This can help troubleshoot any startup issues.
160+
161+
## Exploring n8n
162+
163+
With everything up and running, open your browser and go to:
164+
165+
```
166+
http://localhost:5678
167+
```
168+
169+
or use your domain if you’ve set up a reverse proxy. You’ll be prompted to create an admin account the first time you log in.
170+
171+
From here, you’re ready to start building workflows.
172+
173+
## More info
174+
175+
If you are looking to combine this stack with an AI/LLM stack, [this post](/posts/ai-stack-tutorial/)
176+
177+
## Links
178+
179+
🛍️ Check out the new Merch Shop at <https://l.technotim.live/shop>
180+
181+
⚙️ See all the hardware I recommend at <https://l.technotim.live/gear>
182+
183+
🚀 Don't forget to check out the [🚀Launchpad repo](https://l.technotim.live/quick-start) with all of the quick start source files
184+
185+
🤝 Support me and [help keep this site ad-free!](/sponsor)
23.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)