Levelrail
Skip to content

Self-host n8n (Postgres) with Docker ​

n8n backed by Postgres instead of its default SQLite file, for production workflow volumes.

This page describes the Levelrail template for n8n (Postgres) (Automation). It deploys the services below as one Docker Compose app on your own server.

Project site: https://docs.n8n.io/hosting/installation/server-setups/postgresql/.

Recommended memory: about 1024 MiB.

Services, ports and volumes ​

ServiceImageContainer portsVolumes
n8nn8nio/n8n:2.10.25678
n8n_postgres_data -> /home/node/.n8n
postgrespostgres:16-alpinenone
n8n_postgres_db_data -> /var/lib/postgresql/data

Environment variables ​

ServiceVariableValue
n8nDB_POSTGRESDB_DATABASEPreset in the template
n8nDB_POSTGRESDB_HOSTPreset in the template
n8nDB_POSTGRESDB_PASSWORDGenerated at deploy
n8nDB_POSTGRESDB_PORTPreset in the template
n8nDB_POSTGRESDB_USERPreset in the template
n8nDB_TYPEPreset in the template
n8nN8N_ENCRYPTION_KEYGenerated at deploy
n8nN8N_PORTPreset in the template
n8nN8N_PROTOCOLPreset in the template
n8nWEBHOOK_URLPreset in the template
postgresPOSTGRES_DBPreset in the template
postgresPOSTGRES_PASSWORDGenerated at deploy
postgresPOSTGRES_USERPreset in the template

Passwords and keys marked as generated are created for you when the app is deployed and stored as secrets. Values are not shown here.

Deploy n8n (Postgres) with Levelrail ​

In the dashboard, open Apps, choose New app, then Browse templates, and select n8n (Postgres). Review the Compose body and deploy.

With the CLI:

levelrail-cli templates deploy n8n-postgres --name my-n8n-postgres

See Service template catalog for how templates work, and Getting started if you have not installed Levelrail yet.

More Automation templates ​

All templates are listed in the self-host gallery.

Released under the Apache 2.0 License.