Skip to content

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.

RequirementMinimum
Server memory1.5 GB free (1024 MB n8n + 512 MB PostgreSQL)
Server disk2 GB free
CPU1.5 cores (1 n8n + 0.5 PostgreSQL)
Agent versionv0.6.18 or later (persistent volume support)
ServiceImagePortCPU limitMemory limit
n8nn8nio/n8n:latest56781 core1024 MB
PostgreSQLpostgres:1654320.5 cores512 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.

VariableValueDescription
DB_TYPEpostgresdbTells n8n to use PostgreSQL instead of the default SQLite.
DB_POSTGRESDB_HOSTAuto-set (companion host)Hostname of the PostgreSQL container. Configured automatically by Clank.
DB_POSTGRESDB_PORTAuto-set (companion port)PostgreSQL port. Defaults to 5432.
DB_POSTGRESDB_DATABASEn8nName of the n8n database.
DB_POSTGRESDB_USERn8nPostgreSQL user for n8n.
DB_POSTGRESDB_PASSWORDAuto-generated secretShared with the PostgreSQL POSTGRES_PASSWORD variable.
N8N_ENCRYPTION_KEYAuto-generated secretEncrypts stored credentials. See the warning below.
WEBHOOK_URLEmpty (user sets)The public URL where n8n receives webhook triggers.
VariableValueDescription
POSTGRES_DBn8nDatabase created on first start.
POSTGRES_USERn8nPostgreSQL superuser for this database.
POSTGRES_PASSWORDAuto-generated secretShared with DB_POSTGRESDB_PASSWORD.
ServiceMount pathContents
n8n/home/node/.n8nWorkflow files, credential encryption keys, custom nodes, and local configuration
PostgreSQL/var/lib/postgresql/dataDatabase 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.

  1. Open the n8n service URL in your browser. The n8n setup screen appears.
  2. Create your owner account by entering an email and password. This account has full admin access.
  3. You are taken to the workflow canvas. Click the + button to create your first workflow.
  4. Add trigger and action nodes to connect your services. Use the built-in node library to search for integrations.
  5. Activate the workflow by toggling the switch in the top-right corner.

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.com

Without 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.

n8n defaults to UTC for cron and schedule triggers. To use your local timezone, add the GENERIC_TIMEZONE environment variable:

VariableExample value
GENERIC_TIMEZONEAmerica/New_York

By default, n8n keeps all execution history in PostgreSQL, which can consume significant disk space over time. Configure automatic pruning with these environment variables:

VariableDefaultDescription
EXECUTIONS_DATA_PRUNEfalseSet to true to enable automatic pruning.
EXECUTIONS_DATA_MAX_AGE336Hours to keep execution data (default: 14 days).

n8n can send email notifications on workflow errors. Add these environment variables to configure SMTP:

VariableDescription
N8N_EMAIL_MODESet to smtp
N8N_SMTP_HOSTSMTP server hostname
N8N_SMTP_PORTSMTP port (typically 587)
N8N_SMTP_USERSMTP username
N8N_SMTP_PASSSMTP password
N8N_SMTP_SENDERSender email address

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.

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 across major versions (e.g., 16 to 17) requires a dump and restore:

  1. Create a database dump from the running container:
    Terminal window
    docker exec -it <postgres_container> pg_dump -U n8n n8n > n8n_backup.sql
  2. Update the PostgreSQL image tag in Clank and redeploy.
  3. 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

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.