Installing n8n on Hetzner: GDPR-compliant automation server
Installing n8n on Hetzner: server type, Docker Compose with Caddy, and why the German server location matters for GDPR-compliant automation.
How to install n8n with Docker Compose: Postgres instead of SQLite, .env, volumes and updates step by step.
n8n can be installed on your own server with Docker Compose in a few steps: you create a compose file and an .env file with the credentials, define a volume for the persistent data, and start the stack with a single command. For production use, most operators switch from the bundled SQLite database to PostgreSQL, because multiple simultaneously running workflows and regular backups work more reliably with it. This article shows the structure of the compose file, the required environment variables, the volumes, and the update process. As of: July 2026.
The installation runs through a compose.yaml file that starts the n8n container, combined with an .env file for the server-specific values. On a Linux server, first check whether Docker and Docker Compose are installed, for example with the commands docker --version and docker compose version. Then create a project directory with the compose.yaml, the .env file, and a subfolder local-files for file exchange between n8n and the host. The start is done with the command docker compose up -d, after which n8n is reachable via the configured domain or, for a simple single-container installation without a reverse proxy, at http://localhost:5678. The official n8n documentation provides a ready-made setup for this with Docker Compose, which also includes Traefik as a reverse proxy for TLS certificates.
By default, n8n uses SQLite and stores credentials, workflows, and the execution history without additional configuration in the file database.sqlite in the .n8n directory. To switch to PostgreSQL, set the appropriate environment variables in the compose file, as described in the documentation on database selection.
Important: Even with PostgreSQL, the volume for the directory /home/node/.n8n remains necessary, because the encryption key for credentials is still stored there.
The .env file bundles all the values that differ from server to server, so that the compose.yaml itself remains unchanged. According to the official guide on Docker installation, at least the following variables belong there.
Since this file contains passwords and credentials, it does not belong in a public Git repository.
For permanent operation, several storage locations are relevant, which must be preserved on every restart.
Without these volumes, workflows, credentials, and certificates are lost every time the container is rebuilt.
An update runs through three commands in the directory of the compose file: docker compose pull downloads the new image version, docker compose down stops the running stack, and docker compose up -d restarts it with the current image. The volumes remain unaffected, so workflows and credentials are preserved. Anyone who wants to pin a specific version instead of automatically updating to the latest stable version can specify a concrete version tag in the compose.yaml, according to the documentation for example docker.n8n.io/n8nio/n8n:1.81.0, instead of the tag next for unstable beta versions. Anyone who wants a clean configuration from the start is better off planning thoroughly once instead of fixing server problems later. NordFlux takes care of exactly that as part of the n8n setup at a fixed price, including the decision between SQLite and PostgreSQL matching actual usage.
No, that is not mandatory. For a simple single-container installation, a mapped volume and port 5678 are sufficient, n8n is then reachable locally at http://localhost:5678. A domain only becomes necessary if you want to use the setup described in the official guide with Traefik as a reverse proxy and an automatic TLS certificate.
Everything is located in the mounted volume that points to the directory /home/node/.n8n in the container. When using SQLite, the database file is located there, and regardless of the database choice, so is the encryption key for stored credentials. Without this volume, all data is lost at the next container restart.
The sequence docker compose pull, docker compose down, and docker compose up -d updates the image without touching the volumes. Since workflows, credentials, and the database are located in the volumes, they are preserved during the update. Before larger version jumps, it is nevertheless worth checking the release notes, because environment variables can change between versions.
Yes, the Docker images are published with different tags. A specific version tag such as 1.81.0 pins a stable version, while the tag next provides the unstable beta version for anyone who wants to test new features in advance. For production servers, a pinned version tag is the more reliable choice.
Founder of NordFlux. Spent four years automating processes at enterprise scale at Dräger, and now brings that depth to the mid-market — pragmatic and with full data sovereignty.
Certifications
Installing n8n on Hetzner: server type, Docker Compose with Caddy, and why the German server location matters for GDPR-compliant automation.
The Self-hosted AI Starter Kit from n8n starts n8n, Ollama, Qdrant and PostgreSQL via Docker Compose for local AI workflows without cloud APIs.
npm, Docker or desktop app: how to test n8n locally, what differs in persistence and effort, and why the desktop app no longer exists.
Postgres instead of SQLite, a clean .env file, and correctly set volumes are the foundation, but only ongoing operation with updates and backups determines actual reliability. NordFlux runs managed n8n operation on your Docker infrastructure, with monitoring, updates, and tested backups instead of ad hoc maintenance. In an initial conversation, we review your current setup and show the biggest operational risks.