1.3 KiB
n8n deployment
This directory runs n8n separately from the news web service. The n8n data
directory and .env stay on the server and must not be committed to Gitea.
First deployment on the server
cd /projects/daily-news-digest/n8n
cp .env.example .env
openssl rand -hex 32
nano .env
chmod 600 .env
mkdir -p data
sudo chown -R 1000:1000 data
docker compose up -d
docker compose ps
docker compose logs --tail=50 n8n
The generated value must be copied to N8N_ENCRYPTION_KEY and must not be
changed later. n8n listens only on the server's loopback address. From a local
computer, create an SSH tunnel and open http://127.0.0.1:5678:
ssh -L 5678:127.0.0.1:5678 root@YOUR_SERVER_IP
Updating from Gitea
cd /projects/daily-news-digest
git pull
cd n8n
docker compose up -d
Do not overwrite n8n/.env or n8n/data during updates.
PostgreSQL credential
In n8n, create a PostgreSQL credential for the existing application database.
Because n8n uses host networking and PostgreSQL is on the same host, use the
host's local PostgreSQL address (127.0.0.1), port 5432, your database/user/
password, and disable SSL when the server reports that it does not support SSL.
The first workflow in workflows/01-test-postgres.json only checks this
connection. It does not fetch news or send email.