---
title: "Self-host n8n in 2026: PostgreSQL and HTTPS webhooks, in France"
url: https://while.sh/en/guides/self-host-n8n/
author: "Aloïs Oddon, co-founder of Nextmap"
updated: 2026-11-19
---

# Self-host n8n in France, with its PostgreSQL database, with your AI (2026)

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

> **The short version.** Over MCP, your AI deploys n8n with while, in France, with its PostgreSQL database backed up every day and its webhooks over HTTPS. What matters, like deleting a database, waits for a person's approval.

## Prerequisites

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

## Step 1: Ask your AI for n8n

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

Your AI 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 AI 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 AI does

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

```dockerfile titre="Dockerfile"
FROM docker.io/n8nio/n8n:latest
USER root
COPY --chmod=755 entry.sh /entry.sh
USER 1000:1000
ENTRYPOINT ["/entry.sh"]
```

```shellscript titre="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:

```yaml titre="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 AI gives it (source 2). The key that encrypts your credentials is a secret your AI sets in while (source 3). `N8N_PROXY_HOPS` tells n8n it answers behind while's HTTPS entry point, and the `/healthz` route tells while that n8n is ready (source 4).

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


<figure class="illus"><img src="/illustrations/guide-heberger-1200.webp" srcset="/illustrations/guide-heberger-768.webp 768w, /illustrations/guide-heberger-1200.webp 1200w" sizes="(min-width: 48rem) 46rem, 100vw" width="1536" height="1024" loading="lazy" decoding="async" alt="Self-host n8n in France with no server to manage: the open-source tool and its PostgreSQL database backed up every day, served over HTTPS on while, put in production by your AI" /><figcaption>The open-source tool and its PostgreSQL database, backed up every day, in France, with no server to look after.</figcaption></figure>

## Bring over your workflows

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

Your AI 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 AI: Put n8n on n8n.acme.com.

Your AI 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 AI: Restore n8n's database to yesterday at 6 pm.

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

## Upgrade to the latest version of n8n

> You, to your AI: Upgrade n8n to the latest version.

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

## Next steps

- [Restore your database to a precise moment](/en/guides/restore-postgresql/)
- [Put your app on your own domain](/en/guides/custom-domain/)
- [Deploy a Docker container](/en/guides/deploy-docker-container/)

## Sources

1. [n8n, database environment variables](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/database), 2026-11-02
2. [n8n, the webhook URL](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/configuration-examples/configure-webhook-urls-with-reverse-proxy), 2026-11-02
3. [n8n, the encryption key](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/configuration-examples/set-a-custom-encryption-key), 2026-11-02
4. [n8n, the health check (/healthz)](https://docs.n8n.io/deploy/host-n8n/keep-n8n-running/monitor-n8n), 2026-11-02

## 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 AI 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.

### What happens if a version breaks something?

In the 30 minutes after a production release, the previous version comes back in a second, then in a few seconds.
