Self-host n8n (Postgres) with Levelrail
n8n backed by Postgres instead of its default SQLite file, for production workflow volumes.
- Authorn8n-io
- LicenceLicenseRef-n8n-SUL
- Memory1 GiB
- Archarm64
- Services2
How to self-host n8n (Postgres)
-
Pull the images
2 images are pulled on your server.
Show images
n8nio/n8n:2.10.2postgres:16-alpine
-
Create the app
2 services start in a single Compose app, with 2 named volume mounts for your data, on port 5678.
-
Fill in the secrets
3 secrets are generated and stored encrypted, 10 settings are preset, you do not have to fill in anything.
-
Open it
Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.
n8n (Postgres) requirements
- Memory
- About 1 GiB
- Architectures
- amd64 image published, arm64 image published
- Ports
- 5678
- Domain
- Optional, an sslip.io address is used without one
- Settings
- none to fill in
- License
- LicenseRef-n8n-SUL, source available
- Listed. It is in the catalog but not verified. Back up the data volume before changing an image tag.
- Host ports. It publishes port 5678 on the host, so open them in the VPS firewall only if you want that.
Install Levelrail first
On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then n8n (Postgres). New to Levelrail? Install it on a fresh VPS first.
docker pull ghcr.io/glincker/levelrail:latest Then levelrail-cli login --device. See Getting started and the n8n (Postgres) docs page.
Deploy n8n (Postgres) your way
Every format below deploys the same pinned images. Pick the one that fits how you work.
Deploy n8n (Postgres) from the CLI
levelrail-cli templates deploy n8n-postgres --name my-n8n-postgres Deploy n8n (Postgres) with the API
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://levelrail.example.com/api/v1/service-templates/n8n-postgres/deploy n8n (Postgres) configuration
n8n (Postgres) services
| Service | Image | Ports | Volumes |
|---|---|---|---|
| n8n | n8nio/n8n:2.10.2 | 5678 | n8n_postgres_data -> /home/node/.n8n |
| postgres | postgres:16-alpine | none | n8n_postgres_db_data -> /var/lib/postgresql/data |
n8n (Postgres) environment variables
| Variable | Service | Value |
|---|---|---|
| DB_POSTGRESDB_DATABASE | n8n | Preset by the template |
| DB_POSTGRESDB_HOST | n8n | Preset by the template |
| DB_POSTGRESDB_PASSWORD | n8n | Generated at deploy |
| DB_POSTGRESDB_PORT | n8n | Preset by the template |
| DB_POSTGRESDB_USER | n8n | Preset by the template |
| DB_TYPE | n8n | Preset by the template |
| N8N_ENCRYPTION_KEY | n8n | Generated at deploy |
| N8N_PORT | n8n | Preset by the template |
Show all 13 variables
- N8N_PROTOCOLn8nPreset by the template
- WEBHOOK_URLn8nPreset by the template
- POSTGRES_DBpostgresPreset by the template
- POSTGRES_PASSWORDpostgresGenerated at deploy
- POSTGRES_USERpostgresPreset by the template
Ports and volumes
- Ports
- 5678
- Volumes
- 2 named mounts: n8n_postgres_data -> /home/node/.n8n, n8n_postgres_db_data -> /var/lib/postgresql/data
n8n (Postgres) FAQ
How much memory does n8n (Postgres) need?
The catalog lists about 1 GiB of memory for n8n (Postgres) across its 2 services.
Does n8n (Postgres) run on arm64?
For n8n (Postgres), an arm64 image is published; amd64 is image published.
What licence is n8n (Postgres) under?
n8n (Postgres) is licensed under LicenseRef-n8n-SUL, which is source-available, so read the terms before commercial use.
Does n8n (Postgres) need configuration before it starts?
No. The template fills in its own defaults and generates secrets at deploy time.
Which database does n8n (Postgres) bundle?
The template includes Postgres, running as its own service.
Which ports does n8n (Postgres) use?
n8n (Postgres) listens on port 5678 inside the stack.
Where does n8n (Postgres) keep its data?
In named volumes: n8n_postgres_data mounted at /home/node/.n8n and n8n_postgres_db_data mounted at /var/lib/postgresql/data.
Can I deploy n8n (Postgres) on Dokploy or Dokku?
The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for n8n (Postgres), so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image n8nio/n8n:2.10.2, postgres:16-alpine is what you deploy there.