n8n
n8n is an open-source workflow automation platform that lets you connect APIs, services, and databases through a visual node-based editor. The Clank n8n template deploys n8n backed by a PostgreSQL 16 database, with persistent storage for workflows, credentials, and database files.
Requirements
Section titled “Requirements”| Requirement | Minimum |
|---|---|
| Server memory | 1.5 GB free (1024 MB n8n + 512 MB PostgreSQL) |
| Server disk | 2 GB free |
| CPU | 1.5 cores (1 n8n + 0.5 PostgreSQL) |
| Agent version | v0.6.18 or later (persistent volume support) |
| Service | Image | Port | CPU limit | Memory limit |
|---|---|---|---|---|
| n8n | n8nio/n8n:latest | 5678 | 1 core | 1024 MB |
| PostgreSQL | postgres:16 | 5432 | 0.5 cores | 512 MB |
n8n runs its web UI and workflow execution engine on port 5678. PostgreSQL stores workflow definitions, execution history, and credential metadata. Only the n8n container is exposed externally; PostgreSQL is not reachable from outside the project network.
Environment variables
Section titled “Environment variables”| Variable | Value | Description |
|---|---|---|
DB_TYPE | postgresdb | Tells n8n to use PostgreSQL instead of the default SQLite. |
DB_POSTGRESDB_HOST | Auto-set (companion host) | Hostname of the PostgreSQL container. Configured automatically by Clank. |
DB_POSTGRESDB_PORT | Auto-set (companion port) | PostgreSQL port. Defaults to 5432. |
DB_POSTGRESDB_DATABASE | n8n | Name of the n8n database. |
DB_POSTGRESDB_USER | n8n | PostgreSQL user for n8n. |
DB_POSTGRESDB_PASSWORD | Auto-generated secret | Shared with the PostgreSQL POSTGRES_PASSWORD variable. |
N8N_ENCRYPTION_KEY | Auto-generated secret | Encrypts stored credentials. See the warning below. |
WEBHOOK_URL | Empty (user sets) | The public URL where n8n receives webhook triggers. |
PostgreSQL
Section titled “PostgreSQL”| Variable | Value | Description |
|---|---|---|
POSTGRES_DB | n8n | Database created on first start. |
POSTGRES_USER | n8n | PostgreSQL superuser for this database. |
POSTGRES_PASSWORD | Auto-generated secret | Shared with DB_POSTGRESDB_PASSWORD. |
Volumes
Section titled “Volumes”| Service | Mount path | Contents |
|---|---|---|
| n8n | /home/node/.n8n | Workflow files, credential encryption keys, custom nodes, and local configuration |
| PostgreSQL | /var/lib/postgresql/data | Database files |
Both volumes are named Docker volumes that persist across redeployments. Deleting the service without opting in to volume cleanup will preserve the data for recovery.
Post-deploy setup
Section titled “Post-deploy setup”- Open the n8n service URL in your browser. The n8n setup screen appears.
- Create your owner account by entering an email and password. This account has full admin access.
- You are taken to the workflow canvas. Click the + button to create your first workflow.
- Add trigger and action nodes to connect your services. Use the built-in node library to search for integrations.
- Activate the workflow by toggling the switch in the top-right corner.
Configuration
Section titled “Configuration”Webhook URL
Section titled “Webhook URL”Webhook-triggered workflows need a publicly reachable URL so external services can send events to n8n. Set the WEBHOOK_URL environment variable to the full public URL of your n8n instance:
https://n8n.example.comWithout this variable, n8n generates webhook URLs using the container’s internal hostname, which external services cannot reach. After changing WEBHOOK_URL, redeploy the service for it to take effect.
Timezone
Section titled “Timezone”n8n defaults to UTC for cron and schedule triggers. To use your local timezone, add the GENERIC_TIMEZONE environment variable:
| Variable | Example value |
|---|---|
GENERIC_TIMEZONE | America/New_York |
Execution data pruning
Section titled “Execution data pruning”By default, n8n keeps all execution history in PostgreSQL, which can consume significant disk space over time. Configure automatic pruning with these environment variables:
| Variable | Default | Description |
|---|---|---|
EXECUTIONS_DATA_PRUNE | false | Set to true to enable automatic pruning. |
EXECUTIONS_DATA_MAX_AGE | 336 | Hours to keep execution data (default: 14 days). |
SMTP for notifications
Section titled “SMTP for notifications”n8n can send email notifications on workflow errors. Add these environment variables to configure SMTP:
| Variable | Description |
|---|---|
N8N_EMAIL_MODE | Set to smtp |
N8N_SMTP_HOST | SMTP server hostname |
N8N_SMTP_PORT | SMTP port (typically 587) |
N8N_SMTP_USER | SMTP username |
N8N_SMTP_PASS | SMTP password |
N8N_SMTP_SENDER | Sender email address |
External access modes
Section titled “External access modes”n8n’s web UI runs on port 5678. Configure an endpoint access mode to make it accessible. Public Direct with a custom domain or BYO Cloudflare Tunnel are the most common choices. If n8n is for internal use only, Tailscale HTTPS or LAN-only modes keep it off the public internet.
Upgrading
Section titled “Upgrading”Upgrading n8n
Section titled “Upgrading n8n”To upgrade n8n, update the image tag in the Clank service settings (e.g., from n8nio/n8n:latest to a specific version like n8nio/n8n:1.70.0) and redeploy. n8n runs its database migrations automatically on startup. Check the n8n release notes for breaking changes before upgrading.
Upgrading PostgreSQL
Section titled “Upgrading PostgreSQL”Upgrading PostgreSQL across major versions (e.g., 16 to 17) requires a dump and restore:
- Create a database dump from the running container:
Terminal window docker exec -it <postgres_container> pg_dump -U n8n n8n > n8n_backup.sql - Update the PostgreSQL image tag in Clank and redeploy.
- Restore the dump if the new major version cannot read the old data directory:
Terminal window docker exec -i <postgres_container> psql -U n8n n8n < n8n_backup.sql
Backing up the encryption key
Section titled “Backing up the encryption key”The N8N_ENCRYPTION_KEY is stored as an environment variable in Clank and also written to the n8n volume at /home/node/.n8n. Keep a copy of this key in a secure location outside of Clank. If the Clank environment variable is ever lost, you can recover it from a volume backup.