Skip to content

Self-host n8n in France, with its PostgreSQL database, from your AI agent

Self-hosted n8n, with no server to maintain. Connected to while over MCP, your AI agent deploys your instance in France, with its workflows in a PostgreSQL database backed up every day and its webhooks over HTTPS.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 3, 2026.

View as Markdown

Prerequisites

  • A new instance, or your workflows exported from your current n8n.
  • Your AI agent: Claude Code, Codex, Cursor or Gemini CLI.

Step 1: Ask your agent for n8n

You, to your agent: Connect to while with my account (while.sh/agents), then deploy n8n with its PostgreSQL database.

Your agent adds while’s MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn’t open, type /mcp, choose while, then Authenticate. On that page, choose “A new app”, then click Authorize.

Step 2: Create your n8n account

Your agent gives you your instance’s address, for example https://n8n.while.cloud. Open it right away: the first visitor creates the owner account. You then create your first workflows there.

What your agent does

n8n doesn’t read its database address as a single URL: it expects the host, port, name, user and password in its own variables1. So your agent writes a Dockerfile on the official n8n image, and a small startup script that derives those variables from the database’s:

Dockerfile
FROM docker.io/n8nio/n8n:latest
USER root
COPY --chmod=755 entry.sh /entry.sh
USER 1000:1000
ENTRYPOINT ["/entry.sh"]
entry.sh
#!/bin/sh
# Gives n8n while's PostgreSQL database, variable by variable.
set -e
u="${DB_MAIN_URL#*://}"
rest="${u#*@}"
hostport="${rest%%/*}"
db="${rest#*/}"
db="${db%%\?*}"
host="${hostport%%:*}"
port="${hostport##*:}"
[ "$port" = "$hostport" ] && port=5432
export DB_TYPE=postgresdb
export DB_POSTGRESDB_HOST="$host"
export DB_POSTGRESDB_PORT="$port"
export DB_POSTGRESDB_DATABASE="$db"
export DB_POSTGRESDB_USER="$DB_MAIN_USER"
export DB_POSTGRESDB_PASSWORD="$DB_MAIN_PASSWORD"
export N8N_PORT="${PORT:-5678}"
exec /docker-entrypoint.sh "$@"

Then while.yaml:

while.yaml
apiVersion: while/v1
project: n8n
services:
  - name: n8n
    dockerfile: Dockerfile
    port: 5678
    health:
      path: /healthz
      initial_delay_seconds: 20
    resources:
      cpu: 500m
      memory: 768Mi
    scale:
      min: 1
      max: 1
    sleep: never
    env:
      N8N_ENCRYPTION_KEY: { secret: N8N_ENCRYPTION_KEY }
      N8N_PROXY_HOPS: 1
      N8N_PROTOCOL: https
      N8N_HOST: n8n.while.cloud
      WEBHOOK_URL: https://n8n.while.cloud/
      N8N_EDITOR_BASE_URL: https://n8n.while.cloud/
network:
  egress: all
databases:
  - name: main

n8n keeps its workflows, its encrypted credentials and its executions in the PostgreSQL database. It runs as a single instance, always awake, to start its scheduled workflows and receive its webhooks at the public address your agent gives it2. The key that encrypts your credentials is a secret your agent sets in while3. N8N_PROXY_HOPS tells n8n it answers behind while’s HTTPS entry point, and the /healthz route tells while that n8n is ready4.

egress: all opens the internet to n8n: its workflows call your tools and your APIs, and n8n reaches its own services, like api.n8n.io. A person in your organization approves that opening on the first deployment.

Bring over your workflows

You, to your agent: Import our workflows from our old n8n.

Your agent imports your exported workflows. You enter your credentials again in n8n: they stay encrypted by your key.

Put n8n on your domain

You, to your agent: Put n8n on n8n.acme.com.

Your agent declares the domain and updates the webhook address. You add the DNS records it gives you, and the HTTPS certificate follows.

Put your workflows back the way they were yesterday

You, to your agent: Restore n8n’s database to yesterday at 6 pm.

Your agent prepares the restore, and you approve it: a safety backup is taken first.

Upgrade to the latest version of n8n

You, to your agent: Upgrade n8n to the latest version.

Your agent deploys the latest n8n image. If the new version disappoints, it rolls back to the previous one.

In the docs: PostgreSQL databases and Variables and secrets.

Next steps

Sources

  1. n8n, database environment variables, accessed November 2, 2026
  2. n8n, the webhook URL, accessed November 2, 2026
  3. n8n, the encryption key, accessed November 2, 2026
  4. n8n, the health check (/healthz), accessed November 2, 2026

Questions

Are my workflows backed up?

Yes: they live in the PostgreSQL database, with their executions, which is backed up every day and can go back to a precise moment.

Can n8n call my tools and my APIs?

Yes: your agent opens the internet to n8n in while.yaml, and a person in your organization approves that opening.

What about the files n8n writes to its disk?

They start from scratch when n8n restarts. Your workflows, your encrypted credentials and your executions are in the database.

Where is my instance hosted?

In France, by Nextmap, a French company.

Connect your agent, it takes care of the rest

To paste into your agent

Read while.sh/agents, then deploy my app with while.

Copy the instructions

No account needed to try: your app is live right away. To keep it, sign in.

A project for your company? Talk to the team: hello@while.sh