Self-hosted n8n with PostgreSQL
Moving workflow data from a local database to managed PostgreSQL, and resolving an IPv4/IPv6 connection problem along the way.
- n8n
- Docker
- Google Cloud
- Supabase
- PostgreSQL
- Nginx
My role
I configured the Docker deployment and database connection, investigated startup failures and documented the working setup. n8n provides the workflow engine; Supabase provides managed PostgreSQL.
The problem
My n8n installation needed a database outside the application container. During setup, the direct database connection failed because the available network path did not support the IPv6 endpoint. Limited memory on the virtual machine also caused startup problems.
How it works
HTTPS request reaches Nginx
Nginx forwards it to n8n in Docker
n8n executes the workflow
Workflow data is stored in PostgreSQL through the session pooler
Technical decisions
Separate the workflow engine from its database
I deployed n8n in Docker on Google Cloud and connected it to PostgreSQL in Supabase. This separated application operation from database hosting and replaced the local SQLite setup.
Check the network path before changing credentials
The ENETUNREACH error pointed to connectivity. For this deployment, I used the IPv4-compatible session pooler instead of the direct IPv6 database endpoint. The choice followed the available network path and connection requirements.
Investigate resources as a separate problem
Connection settings did not explain every failure. Increasing the virtual machine’s memory allowed startup and database migrations to complete. I checked the application logs as well as the database configuration.
Outcome and limitations
The installation started successfully with PostgreSQL and activated the AI Websearch workflow. The useful result was a working, documented deployment and a clearer way to distinguish database, network and resource failures.
This describes my May 2026 deployment, not a universal sizing guide. A separate database does not replace backups, restore tests or monitoring. Resource requirements will depend on the workflows and their load.