Introduction#
Two months ago, I deployed n8n on my own infrastructure — available at https://n8n.zeroinside.id.
n8n has solid documentation for self-hosting that’s available here: https://docs.n8n.io/hosting, but I needed a more pragmatic guide tailored to my infrastructure.
So I created my own step-by-step guide covering the docker-compose.yml
and a workflow example to summarize my home page on https://satrya.zeroinside.id.
The entire setup runs on my home server for minimal cost.
What is n8n?#
n8n lets anyone without a coding background create smart, automated systems by linking together apps and AI services, all with an easy drag-and-drop interface.
Think of n8n as the connector that can make different nodes or programs talk to each other, so you can:
- Save time.
- Avoid boring, manual work.
- Be more productive.
And because n8n is open source and can run on your computer or server, your information stays private, and you're not limited by payments or subscription plans, unless you pay for an enterprise license.
Step-by-Step: Self-hosting n8n using Docker#
I have a server at home that’s connected to a Linode server via VPN. I use WireGuard as the tunnel, so my home network can reach my cloud network.
Home Server Setup#
- Docker.
- PostgreSQL.
It has a static local IP: 192.168.6.8
on the WireGuard interface.
Set up n8n with Docker Compose#
SSH into the home server and run these CLI commands to set up n8n.
- Create a directory:
mkdir n8n
- Go to the n8n directory:
cd n8n
- Create a
.env
file:
nvim .env
- Fill the .env file with these environment variables (replace placeholders with your values).
N8N_RUNNERS_ENABLED=true
WEBHOOK_URL=https://n8n.zeroinside.id/
N8N_EDITOR_BASE_URL=https://n8n.zeroinside.id
N8N_HOST=https://n8n.zeroinside.id
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_HOST=127.0.0.1
DB_POSTGRESDB_USER=xxxx
DB_POSTGRESDB_PASSWORD=xxxx
- Create a
docker-compose.yml
file:
services:
n8n:
image: docker.n8n.io/n8nio/n8n
container_name: n8n
ports:
- "5678:5678"
volumes:
- n8n_data:/home/node/.n8ni
restart: unless-stopped
env_file: .env
volumes:
n8n_data:
- Run the n8n container:
docker compose up -d
- Configure the Nginx reverse proxy:
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name n8n.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
location / {
include /config/nginx/proxy.conf;
resolver 127.0.0.11 valid=30s;
set $upstream_app 192.168.6.8;
set $upstream_port 5678;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- Add a new subdomain.
- n8n will be available at https://n8n.zeroinside.id.
Workflow Example#
I will create a workflow to extract the content of my home page and summarize it using Gemini.
-
Create a new workflow to start with a blank canvas.
-
Add a Manual Trigger node.
-
Add HTTP Request node.
- Set Request URL to
https://satrya.zeroinside.id
.
- Set Request URL to
-
Add HTML node.
- Set Operation to Extract HTML content.
- Configure extraction values based on CSS selectors.
- I use the body CSS selector to extract the content of the website.
- Execute the step to verify the extraction.
-
Add Summarize Chain node.
- Configure the node to use Gemini as the LLM model. You may need to configure the Gemini API key first.
- I use the
gemini-2.5-flash-lite
model for faster responses. - Execute the step to test the node.
-
To test end-to-end, click the
Run Workflow
button. -
The workflow will run and you can see the result on
Logs
tab. -
The output of the final node can be used for another action—for example, saving it to a database or sending it via email.
-
Make sure to rename the workflow to something meaningful! I use
satrya.zeroinside.id summariser
.
Here's the final workflow.
With this workflow, I can get a summary of my home page on https://satrya.zeroinside.id.
Gemini said:
Satrya Budi Pratama is a Product Engineer & Researcher with over 7 years of freelance and 3 years of industry experience. He has developed over 40 products in web, mobile, AI/ML, and application security. He holds a Master of Engineering in Control Engineering and Intelligent Systems from ITB and a B.Sc in Computer Science from Telkom University. Satrya is currently a Product Engineer at InterOpera and CEO of ZeroInside (freelance), with previous roles including Software Engineer at Influx and IT Business Analyst & QA at PT. Ihsan Solusi Informatika. His recent project is "IDX Fundamental Analysis," a Python tool for retrieving and analyzing Indonesian stock data.
Conclusion#
This concludes the guide on how to self-host n8n for AI automation.
I hope you found it helpful! If you have any questions or need further assistance, feel free to reach out to me.
Happy automating!