Deploy n8n on Hetzner with Coolify, Recoverably
Deploy n8n on Hetzner with Coolify, then verify HTTPS, persistence, backups, upgrades, webhooks, and recovery before relying on it in production.
To deploy n8n on Hetzner with Coolify, start with one n8n container. Give it a persistent /home/node/.n8n volume, HTTPS, a fixed N8N_ENCRYPTION_KEY, and a backup you have restored successfully. Choose PostgreSQL when the installation is business-critical or likely to grow. Add queue mode when separate workers fit the workload. This guide covers deployment, testing, upgrades, and recovery.
Choose the n8n setup before opening Coolify
Start with the smallest design that meets your workload and availability needs. A single container is easiest to operate, but it still needs durable storage and backups. PostgreSQL provides a separate database foundation. Queue mode separates the editor from workers, but it also needs Redis, PostgreSQL, shared settings, and more monitoring.
| Setup | Use it when | You need to manage |
|---|---|---|
| Single n8n container | Personal automations and low volume | Persistent n8n data, encryption key, backups |
| n8n with PostgreSQL | Business workflows or a larger database workload | PostgreSQL storage, credentials, backups, compatibility |
| Queue mode | Heavy or bursty executions or separate workers | Redis, workers, PostgreSQL, shared configuration, monitoring |
For a first deployment, use one n8n container unless the workflows already justify PostgreSQL. SQLite can work for a small installation. However, it keeps more of the system inside the application container. Queue mode changes the architecture. It does not improve every installation automatically.
Before creating credentials, generate a strong N8N_ENCRYPTION_KEY. Store it in a password manager or protected secret store. Keep the same key through restarts, redeployments, restores, and upgrades. n8n uses it to protect stored credentials. A database can survive while those credentials become unusable if the key changes.
Prepare Hetzner, DNS, access, and Coolify
Before installation, prepare your Hetzner account, SSH key, domain, and hostname. Choose a current server size that can run Coolify, n8n, the selected database, and other services. Product prices, locations, resource sizes, images, and Coolify requirements can change. Check the current Hetzner product pages and Coolify documentation. Use a Linux release currently supported by Coolify.
- Create the Hetzner server with an SSH key. Keep a separate administrative key for recovery. Record the server's public IP.
- Point a DNS A record, such as n8n.example.com, to the server's public IPv4 address. Add an AAAA record only if IPv6 is configured and reachable through the whole path. Wait for the record to resolve before requesting HTTPS.
- Restrict the host firewall to the ports you need. Allow SSH for administration and HTTP and HTTPS for certificates and web traffic. Keep PostgreSQL and Redis private. Review Hetzner's network firewall, Docker's published ports, and Coolify's proxy rules together. Do not open every port by habit.
- Connect over SSH and apply the operating-system updates recommended for the chosen distribution. Do not change Docker networking or disable SSH protections unless you understand the effect on Coolify and its proxy.
- Install Coolify using the current procedure in its official documentation. When installation finishes, it displays the dashboard URL. Open it, create the administrator account, and attach the server. Installation commands and screen names can change, so do not reuse an old blog command. The retrieved Coolify walkthrough also tells the operator to use the displayed URL and create the admin account.
- Confirm that Coolify can reach the server and that its proxy is running. A healthy Coolify deployment does not prove that the public application route works.
Deploy n8n with durable storage, HTTPS, and correct URLs
Deploy n8n through Coolify with durable storage and the public HTTPS settings in place. Create a Coolify project, then add n8n as a service or Docker Compose application. Before deployment, set the encryption key, public webhook URL, image version, volume, and domain. These settings determine whether the instance survives redeployments and creates usable callback URLs.
- Create a Coolify project for this installation. Add n8n as a service or Compose application. Give it a clear name so its logs and backups are easy to identify.
- Attach a persistent volume to n8n's data directory, normally /home/node/.n8n for the official image. Match the mount path in the current Coolify template. This directory holds file-based n8n data, including workflows, credentials, execution data, and local instance configuration. A redeploy without an attached volume can start an apparently healthy but empty instance.
- Add these stable environment values in Coolify before the first launch. Use the hostname and HTTPS scheme you will publish:
- N8N_HOST=n8n.example.com
- N8N_PROTOCOL=https
- N8N_PORT=5678
- WEBHOOK_URL=https://n8n.example.com/
- N8N_EDITOR_BASE_URL=https://n8n.example.com/
- N8N_ENCRYPTION_KEY=<your-generated-secret>
- GENERIC_TIMEZONE=<your-IANA-timezone>
Variables and their behavior can change between versions. Check the current n8n environment-variable reference and the values supplied by the Coolify template. Do not put the encryption key in a public Compose file. Do not change it after credentials are in use.
- Configure the Coolify domain for the service. Enable HTTPS through its proxy. Request the certificate only after DNS points to the server and the required ports are reachable. The proxy can be Traefik, Caddy, or another supported component, depending on the Coolify installation. Use the settings exposed by that installation.
- If you chose PostgreSQL, create it as a separate durable resource or define it in the same Compose stack. Configure n8n with the database type, host, port, database name, user, and password specified by the current n8n documentation. Mount PostgreSQL storage separately from n8n storage. Keep the database on a private network. Back up both the database and n8n's data directory. With PostgreSQL, workflows, credentials, and execution records are held in the configured database. The n8n directory and encryption key still matter operationally.
- If you chose queue mode, add Redis, PostgreSQL, and at least one worker according to the current n8n deployment documentation. Give the editor and workers compatible settings, including the same encryption key. Keep their data services private. Plan for worker logs, Redis, database backups, and failure recovery before switching modes.
- Deploy and inspect the n8n, proxy, and database logs. Open the public HTTPS address in a private browser window. You should see the n8n login page at the intended hostname, without a certificate warning or redirect to an internal address.
Prove the deployment works before calling it production-ready
Test the deployment from outside the server's network where possible. These checks show whether the application works, rather than merely whether its container runs. Test the public URL, login, workflows, webhooks, credentials, persistence, and any queue components before calling the deployment production-ready.
- Open the HTTPS URL. Confirm the certificate hostname, redirect behavior, and editor URL.
- Log in and create a small test workflow. Run it manually and confirm that the execution appears in n8n. With PostgreSQL, check the database logs for a successful connection. Do not assume the application used the intended database.
- Create a webhook workflow and call its production webhook URL from an external network. Confirm that the expected workflow receives the request. Use the production URL shown by n8n, not only the browser domain. If the URL is wrong, compare DNS, WEBHOOK_URL, N8N_PROTOCOL, forwarded headers, and the proxy route.
- Run a test outbound action. This checks the required egress connection and whether the stored credential decrypts correctly.
- Restart the n8n container through Coolify. Log in, open the workflow, inspect its credentials, and run it again. This checks the current volume and encryption key. It is not a backup test.
- Redeploy without deleting persistent resources. Confirm that workflows, credentials, execution history, and public URLs remain intact. If the editor is empty, stop. Identify the detached or newly named volume or database before recreating anything.
- If queue mode is enabled, check Redis connectivity, worker registration, worker logs, execution pickup, and failure behavior separately. An available editor does not prove that workers process jobs.
Back up, restore, upgrade, and troubleshoot by layer
Protect the storage used by the deployment and test recovery separately. For a file-based installation, back up the persistent n8n directory. For PostgreSQL, create consistent database backups and protect the n8n volume too. Keep copies away from the Hetzner server, such as on S3-compatible storage. Store the encryption key in disaster-recovery records with protection separate from ordinary application files.
A successful backup job proves only that data was copied. Restore it to a separate Coolify project or isolated server. Confirm that workflows open, credentials decrypt with the original key, executions behave normally, and a webhook runs. Do not perform the first restore test during an outage.
For an upgrade, first record the current n8n image version. Then confirm a recent backup and read the current n8n release notes. If the workflows matter, test the new version separately. Upgrade one component at a time when possible. Keep the previous image version available. Do not remove volumes during the change.
If a migration fails or credentials cannot decrypt, stop the rollout. Preserve logs and the current data before attempting recovery.
Restore the database and n8n storage to an isolated target before deciding whether to roll back. Treat rollback as a tested recovery procedure. Do not use it as a reason to delete the current deployment.
Troubleshoot from the outside in:
- DNS: Check the record from an external network. Confirm that it reaches the intended server. Check that stale proxy or IPv6 records are not sending traffic elsewhere.
- TLS and proxy: Check the certificate hostname, port reachability, proxy route, and Coolify proxy logs. A green Coolify state does not guarantee a working public route.
- Application: Read the n8n container logs. Compare the effective environment values with the public hostname. Check protocol, port, URL settings, timezone, and encryption key.
- Storage: Inspect the mounted path and volume name. An empty editor after redeployment usually indicates a missing, newly named, or incorrectly mounted volume.
- Database: Check hostnames, credentials, network membership, migrations, and PostgreSQL logs. Keep the database unexposed while testing.
- Webhooks: Test from an external network. Inspect the production URL and verify that the workflow is active. Loading the editor does not test inbound webhook delivery.
- Queue mode: Check Redis, worker registration, shared encryption settings, and worker logs. The editor and workers need compatible settings.
When the failing layer is unclear, do not change several settings at once. Capture the current configuration, logs, and backup state. Then isolate one connection at a time.
Conclusion
The practical baseline is a pinned n8n container, a durable data volume, a documented encryption key, correct HTTPS URL settings, and backups that passed a separate restore. Add PostgreSQL or queue mode when the workload or availability requirement justifies the extra services. Before calling the deployment ready, verify the public webhook, restart persistence, credential decryption, database behavior, and recovery procedure. Do not rely only on Coolify's green status.
Frequently Asked Questions
Can I run n8n on Hetzner with one container?
Yes. One container is a reasonable starting point for low-volume work. Its data directory must be persistent, the encryption key must stay fixed, HTTPS must be configured, and backups must be tested. Move to PostgreSQL when the instance is business-critical or the database needs a stronger growth path. Use queue mode when separate workers address a demonstrated workload or availability need.
Why does n8n show the wrong webhook URL?
Check DNS, the reverse-proxy scheme, forwarded headers, WEBHOOK_URL, N8N_PROTOCOL, N8N_HOST, and N8N_EDITOR_BASE_URL. Test the production URL from an external network. Correct DNS alone does not prove that n8n can construct the right callback URL.
Will a Coolify redeploy delete my n8n workflows?
It should not when the n8n data directory and, if used, PostgreSQL storage are attached to durable resources. A redeploy can still start an empty instance if the mount path or volume name changed. Verify the mounts before deployment. Then test a restart and redeploy without deleting persistent resources.
Sources
- N8n Self-Hosted Tutorial On Coolify 2026: Step-by-Step (ranksquire.com)