How to Self-Host n8n on Cloider
Self-host n8n from its official Docker image as a Cloider app, with a managed PostgreSQL database, your own encryption key and HTTPS on a free subdomain, from the dashboard, the cloider CLI or an AI coding agent, with a screenshot of every step.

On this page
Key takeaways
- n8n runs as a Cloider app straight from the official n8nio/n8n image: no server, no Dockerfile.
- Workflows, credentials, executions and workflow files all live in managed PostgreSQL, so restarts and deploys lose nothing.
- Set N8N_ENCRYPTION_KEY yourself and keep a copy: without it, saved credentials can't be read.
- Run one fixed replica, since n8n's main process fires every schedule itself.
- N8N_EDITOR_BASE_URL, N8N_WEBHOOK_URL and N8N_PROXY_HOPS make webhook URLs use your HTTPS subdomain.
n8n is a workflow automation tool: you connect apps and APIs on a canvas, and n8n runs the flow on a schedule, on a webhook or when something changes. Its Community Edition is free to self-host, so your workflows, credentials and execution history stay in your own database, and there is no limit on how many workflows you run. The usual setup is a server with Docker, a reverse proxy for HTTPS, and a database you back up yourself. On Cloider you skip the server: n8n runs as an app from its official Docker image, with a managed PostgreSQL database and HTTPS on a free subdomain.
In this guide you self-host n8n on Cloider three ways:
From the dashboard: create the database, deploy the n8n image as an app, lock the database to it and set up your account.
With the cloider CLI: the same in a few commands, without a password on screen.
With an AI coding agent: "using cloider cli self-host n8n on cloider".
Options 1 and 2 show the steps with screenshots. n8n ends up on https://<subdomain>.cloider.app, running the official n8nio/n8n image, version 3.4.4, the current stable release.
What you need
A Cloider account. New accounts get a welcome credit.
For option 2, the cloider CLI,
jqandopenssl.
You don't need a Dockerfile, a repository or a server. Cloider runs the image n8n publishes.
How n8n fits on a Cloider app
A Cloider app runs a container, and its filesystem starts fresh on every deploy and restart. n8n keeps its state in /home/node/.n8n unless you tell it otherwise, so a few settings move that state somewhere that lasts:
The data goes to managed PostgreSQL. Workflows, credentials, users and execution history live in the database. n8n's default is a SQLite file in its home folder, which a restart would wipe. n8n supports PostgreSQL 16, 17 and 18, and Cloider offers 18.
You set the encryption key. n8n encrypts every credential you save with a key. Without
N8N_ENCRYPTION_KEYit generates one into its home folder, so the next restart would bring a new key that can't read the saved credentials. You generate the key once, store it as a secret and keep a copy.Files that flow through workflows go to the database too. n8n keeps binary data, such as a downloaded PDF, on disk by default.
N8N_DEFAULT_BINARY_DATA_MODE=databasestores it in PostgreSQL instead, up to 512 MiB per file.It runs one replica. In n8n's regular mode, the main process runs the schedules and triggers itself, so two copies of it would both fire every schedule. New Cloider apps start with 2 to 5 replicas, so you switch this one to a fixed single replica.
It knows its public address. Cloider terminates HTTPS in front of the app. n8n would otherwise build webhook URLs from its own port,
http://...:5678, soN8N_EDITOR_BASE_URLandN8N_WEBHOOK_URLgive it the real address, andN8N_PROXY_HOPS=1tells it to trust the one proxy in front of it for the client's IP and protocol.
These are all the settings, as environment variables:
Variable | What to set, and why |
|---|---|
DB_TYPE |
|
DB_POSTGRESDB_HOST, DB_POSTGRESDB_PORT | The database's private host and port, reached inside Cloider's network |
DB_POSTGRESDB_DATABASE, DB_POSTGRESDB_USER | The database and its user, here |
DB_POSTGRESDB_PASSWORD | The database password, as a secret |
DB_POSTGRESDB_SSL_ENABLED |
|
DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED |
|
N8N_ENCRYPTION_KEY | 64 random hex characters, as a secret. It encrypts saved credentials, so never change it |
N8N_HOST, N8N_PROTOCOL | The public address: |
N8N_EDITOR_BASE_URL, N8N_WEBHOOK_URL |
|
N8N_PROXY_HOPS |
|
N8N_DEFAULT_BINARY_DATA_MODE |
|
GENERIC_TIMEZONE, TZ | Your time zone, here |
Option 1: from the dashboard
Step 1: Create the database
Open Databases and click Create Database. Name it n8n-db with the user n8n, pick PostgreSQL v18, leave SSL Mode on and pick the Hobby plan. Leave Trusted sources on Allow Everything for now: the app doesn't exist yet, and step 4 locks the database to it.

Once it is Ready, its Overview tab shows the Connection Details. n8n needs the password, the Private host and the Port. Apps on Cloider reach the database on its private host, ...db.cloider.internal, which never leaves Cloider's network.

Step 2: Generate the encryption key
Generate a random key on your computer and save it in your password manager. It is the only way to read the credentials n8n stores, so a backup of the database is useless without it:
openssl rand -hex 32Step 3: Deploy the n8n image as an app
Open Apps, click Create App and, under Deploy a Docker image, click Docker image. Enter the image n8nio/n8n and the tag 3.4.4. Pin a version rather than latest, so n8n only changes when you change the tag.

Click Continue. Cloider looks the image up and fills in the name n8n and the port 5678, which the image exposes. Pick a subdomain, then click Paste .env under Environment variables, paste these lines with your private host, port and subdomain filled in, and click Add these:
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=<private-host>
DB_POSTGRESDB_PORT=<port>
DB_POSTGRESDB_DATABASE=n8n-db
DB_POSTGRESDB_USER=n8n
DB_POSTGRESDB_SSL_ENABLED=true
DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED=false
N8N_HOST=<subdomain>.cloider.app
N8N_PROTOCOL=https
N8N_EDITOR_BASE_URL=https://<subdomain>.cloider.app/
N8N_WEBHOOK_URL=https://<subdomain>.cloider.app/
N8N_PROXY_HOPS=1
N8N_DEFAULT_BINARY_DATA_MODE=database
GENERIC_TIMEZONE=Europe/Berlin
TZ=Europe/BerlinThen click Add variable twice for the two secrets: DB_POSTGRESDB_PASSWORD with the database password, and N8N_ENCRYPTION_KEY with the key from step 2. Click the lock on both rows, so their values are never shown again in the dashboard.

Open Advanced settings. Under Compute configuration, pick Fixed resource management with 1 replica, 0.5 vCPU and 1024 MB of memory. Cloider warns that a single replica means downtime when its node goes down: that's the trade-off of n8n's regular mode, and the app comes back on another node within minutes.

Set the Health check path to /healthz/readiness. It answers once n8n is connected to the database and has migrated it, so a new version only gets traffic when it's ready. Keep the default timings: the 300-second grace period covers the first start, when n8n creates its tables.

Click Create App. The first deploy took about two and a half minutes, most of it n8n setting up its database:

The Logs tab ends with the address of the editor. The lines about the Python task runner and the internal runner mode are expected: the image runs JavaScript Code nodes itself, and Python ones need a separate runner container (see Running it day to day).

Step 4: Lock the database to the app
Back in the database, open Settings. In Trusted Sources, pick the n8n app from the list, which replaces Allow Everything, and click Apply changes. From now on only the n8n app can open a connection to the database, and only on the private host. The dashboard's Terminal tab and backups keep working.

Step 5: Create your owner account
Open https://<subdomain>.cloider.app. A new n8n asks for its owner account: the first person to open the address gets it, so do this right away. Enter your email, your name and a password of at least 8 characters with a number and a capital letter.

n8n may then offer a short survey and a free license key that unlocks a few extra features. Both are optional.
Step 6: Run a first workflow
A webhook that answers with a greeting proves that n8n is reachable from the internet and builds its URLs from your subdomain. Create a workflow with two nodes:
A Webhook trigger with the HTTP method
POST, the pathhello, and Respond set to Using 'Respond to Webhook' Node.A Respond to Webhook node that responds with JSON:
{{ { "message": "Hello, " + $json.body.name + "!", "time": $now.toISO() } }}.
Or copy this workflow and paste it onto an empty canvas with Ctrl+V (Cmd+V on a Mac):
{
"name": "Hello webhook",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "hello",
"responseMode": "responseNode",
"options": {}
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
0,
0
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"message\": \"Hello, \" + $json.body.name + \"!\", \"time\": $now.toISO() } }}",
"options": {}
},
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
260,
0
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
}
}Publish the workflow from the top right of the editor, so its production URL goes live. The Webhook node shows that URL, https://<subdomain>.cloider.app/webhook/hello, built from N8N_WEBHOOK_URL. Call it:
curl -s -X POST https://<subdomain>.cloider.app/webhook/hello \
-H 'Content-Type: application/json' -d '{"name": "Jane"}' | jq
The time comes back in Europe/Berlin, the app's GENERIC_TIMEZONE. Production calls don't show on the canvas: you find them in the workflow's Executions.
Option 2: deploy with the cloider CLI
This time every step is in the terminal, and the database password and the encryption key are never printed. Install the CLI and log in first: curl -fsSL https://cloider.com/install.sh | sh, then cloider login. The commands use the names n8n-cli and n8n-cli-db.
Step 1: Create the database
cloider db create n8n-cli-db --engine postgresql --user n8n --wait
Step 2: Write the settings to a file
Set the subdomain you want, read the database's private host, port, name and user with cloider db get -o json, and write every setting that isn't secret to n8n.env:
SUBDOMAIN=your-subdomain
DB=$(cloider db get n8n-cli-db -o json)
cat > n8n.env <<EOF
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=$(jq -r .private_host <<<"$DB")
DB_POSTGRESDB_PORT=$(jq -r .database_port <<<"$DB")
DB_POSTGRESDB_DATABASE=$(jq -r .database_name <<<"$DB")
DB_POSTGRESDB_USER=$(jq -r .database_user <<<"$DB")
DB_POSTGRESDB_SSL_ENABLED=true
DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED=false
N8N_HOST=$SUBDOMAIN.cloider.app
N8N_PROTOCOL=https
N8N_EDITOR_BASE_URL=https://$SUBDOMAIN.cloider.app/
N8N_WEBHOOK_URL=https://$SUBDOMAIN.cloider.app/
N8N_PROXY_HOPS=1
N8N_DEFAULT_BINARY_DATA_MODE=database
GENERIC_TIMEZONE=Europe/Berlin
TZ=Europe/Berlin
EOF
Step 3: Create the app
Create the app from the image with the file. The two secrets go straight from cloider db password and openssl into the app, without showing on screen. The command waits until the first version is running:
cloider app create --image n8nio/n8n:3.4.4 --name n8n-cli --port 5678 --subdomain $SUBDOMAIN \
--env-file n8n.env \
--secret-env DB_POSTGRESDB_PASSWORD="$(cloider db password n8n-cli-db)" \
--secret-env N8N_ENCRYPTION_KEY="$(openssl rand -hex 32)"
Save a copy of the encryption key in your password manager. cloider app env get n8n-cli N8N_ENCRYPTION_KEY prints it.
Step 4: Run one replica and lock the database
A new app starts on automatic compute with two replicas, and its settings can only change once the first deploy is done. Now switch it to one fixed replica with the health check, and let only the app reach the database:
cloider app update n8n-cli --compute fixed --replicas 1 --cpu 0.5 --memory 1024 --health-check-path /healthz/readiness
cloider db trusted-sources n8n-cli-db --set app:n8n-cli
Within a minute the single replica is serving. cloider app get shows the compute and the health check, and the readiness endpoint answers:
cloider app get n8n-cli
curl -s https://$SUBDOMAIN.cloider.app/healthz/readiness
Open https://<subdomain>.cloider.app and create your owner account as in step 5 of option 1.
Option 3: let an AI coding agent deploy it
With the CLI installed and logged in, open your AI coding agent and ask:
using cloider cli self-host n8n on cloidercloider --help points agents to docs.cloider.com/llms.txt, the deployment strategy they follow on Cloider. It tells them to deploy anything that isn't a static site as an app, to use a managed database, and to keep Kubernetes for what needs it, so an agent lands on the setup of option 2. To give it this guide's exact settings, add the guide's Markdown version to the prompt: every post on this blog is also served as Markdown at its address plus .md. The same commands are available as tools through the Cloider MCP server, cloider mcp. See AI coding agents in the docs.
Running it day to day
Update n8n: read the release notes for breaking changes first, then change the tag in the Image section of the app's Settings, or run
cloider app image n8n --tag <version> --wait. n8n migrates its database when the new version starts. During a deploy the new container starts before the old one stops, so for about a minute two copies run and a schedule due in that minute can fire twice: update when nothing important is scheduled.Back up: the managed database keeps point-in-time recovery for 14 days, so you can restore any second of that window into a new database. Keep the encryption key with it, since the credentials in a backup can't be read without it. To keep workflows as files too, export them inside the container and copy the file out:
cloider app exec n8n -- n8n export:workflow --all --output=/tmp/workflows.json, thencloider app exec n8n -- cat /tmp/workflows.json > workflows.json.Watch the database size: n8n deletes executions older than 14 days and keeps at most 10,000, and binary data now lives in the database too. The Hobby plan has 1 GB of storage. The database's Insights tab shows how much is used, and Resize moves it to a bigger plan.
Use your own domain: add it to the app under Domains, then set
N8N_HOST,N8N_EDITOR_BASE_URLandN8N_WEBHOOK_URLto it. Webhook and OAuth callback URLs you registered with other services change with it, so it's easiest to pick the domain before you build many workflows.Install community nodes: they install into n8n's home folder, which the next restart wipes. Set
N8N_REINSTALL_MISSING_PACKAGES=trueso n8n installs them again at startup, which makes starts slower, or let n8n manage them from an environment variable as its docs describe.Python in Code nodes: the image runs JavaScript Code nodes in its built-in task runner. Python needs n8n's separate runner container next to it, which a Cloider app can't run. For that, or to scale out with queue mode, Redis and worker processes, run n8n on Cloider Kubernetes with a managed Redis database.
Email: n8n sends invitations and password resets over SMTP. Without it, invite users by copying the invite link, and keep your own password safe.
Troubleshooting
Webhook URLs show
http://or:5678:N8N_EDITOR_BASE_URLorN8N_WEBHOOK_URLis missing or wrong. Set both tohttps://<subdomain>.cloider.app/.The deploy never goes live and the logs show a database error: the host, port, user or password is wrong, or the app isn't in the database's trusted sources. The private host only works from your Cloider apps and clusters.
Mismatching encryption keys, or credentials that can't be decrypted:
N8N_ENCRYPTION_KEYis not the key the data was saved with. Put the original key back. There is no way to recover credentials saved with a lost key: create them again.The app restarts under load: it ran out of memory. Raise the memory per replica in Settings, for example to 2048 MB.
Failed to start Python task runner in the logs: expected, see above. JavaScript Code nodes work.
Too many connections or a full disk on the database: move it to a bigger plan with Resize.
What it costs
With fixed compute an app pays for all the CPU and memory you give it: 0.5 vCPU and 1 GiB come to $16 per 30 days. The Hobby PostgreSQL plan is $3.99 a month, so this n8n costs about $20 a month, charged by the second, and the subdomain is free. A new account's welcome credit covers the guide. Delete the app and the database when you're done.
Frequently asked questions
Can I self-host n8n without a server?
Yes. On Cloider, n8n runs as an app from its official Docker image, n8nio/n8n, next to a managed PostgreSQL database. Cloider runs the container, serves it over HTTPS on a free subdomain and restarts it if it fails, so there is no server or reverse proxy to maintain.
Why does self-hosted n8n need N8N_ENCRYPTION_KEY?
n8n encrypts every saved credential with this key. If it isn't set, n8n generates one into its home folder, and on a container whose filesystem resets that key is gone after the next restart, leaving credentials unreadable. Generate it once with openssl rand -hex 32, store it as a secret and keep a copy.
Can n8n run with more than one replica?
Not in its regular mode: the main process runs schedules and triggers itself, so two copies would both fire them. Run one replica, or switch to queue mode with Redis and separate worker processes, which on Cloider fits Kubernetes with a managed Redis database.
Which database should self-hosted n8n use?
PostgreSQL. n8n supports PostgreSQL 16, 17 and 18, and its default SQLite file would be lost whenever the container restarts. With N8N_DEFAULT_BINARY_DATA_MODE=database, files that flow through workflows are stored in PostgreSQL too.
How much does it cost to self-host n8n on Cloider?
About $20 a month for the setup in this guide: one replica with 0.5 vCPU and 1 GiB of memory is $16 per 30 days, and the Hobby PostgreSQL plan is $3.99 a month. Both are charged by the second, and a cloider.app subdomain is free.



Comments