EthioDeploy
DocsPricingDomainsBlogToolsChangelog
Deploy guides/n8n

Self-host n8n with Postgres

n8n deploys from a repo with a Dockerfile that uses the official image and a short start script that points n8n at the Postgres addon. Set N8N_ENCRYPTION_KEY and WEBHOOK_URL before the first deploy. It needs Pro: in our test n8n used about 540 MB right after starting.

Last updated November 27, 2026

What we run by default
Detected by
Dockerfile
Install
none (the official n8n image)
Build
docker build from your Dockerfile
Start
the image's own entrypoint, via start.sh

These run automatically, so leave the command fields blank. Only override them in Settings → Build if you need something different.

Fix this first: Set N8N_ENCRYPTION_KEY yourself, before the first deploy

n8n encrypts every saved credential with this key. If you don't set it, n8n makes one up and writes it to a file in the container, and the next deploy starts a new container without that file. Your workflows are still in Postgres, but every credential fails with “Credentials could not be decrypted”. Generate a key once with openssl rand -hex 32 and never change it.

Prepare the repo

Make a GitHub repo with two files. The Dockerfile uses the official image, pinned to a version so an update only happens when you change it:

FROM n8nio/n8n:2.49.7
COPY --chmod=755 start.sh /start.sh
ENTRYPOINT ["tini", "--", "/start.sh"]

The Postgres addon gives your app one DATABASE_URL, and n8n doesn't read that. It wants the host, user, password and database as separate variables. start.sh splits the URL, tells n8n to listen on the PORT the platform gives it, and then starts n8n the way the image normally does:

#!/bin/sh
# The Postgres addon sets DATABASE_URL. n8n wants the parts.
if [ -n "$DATABASE_URL" ]; then
  rest=${DATABASE_URL#*://}
  creds=${rest%%@*}
  hostpart=${rest#*@}
  hostport=${hostpart%%/*}
  export DB_TYPE=postgresdb
  export DB_POSTGRESDB_USER=${creds%%:*}
  export DB_POSTGRESDB_PASSWORD=${creds#*:}
  export DB_POSTGRESDB_HOST=${hostport%%:*}
  export DB_POSTGRESDB_PORT=${hostport##*:}
  db=${hostpart#*/}
  export DB_POSTGRESDB_DATABASE=${db%%\?*}
fi
export N8N_PORT=${PORT:-5678}
exec /docker-entrypoint.sh "$@"

Without a database, n8n falls back to SQLite in a file inside the container, and that file is gone after the next deploy, along with every workflow.

Database and env vars

  1. Add a Postgres addon to the project. It sets DATABASE_URL, which start.sh reads. Workflows, credentials and execution history all live there.
  2. Add these env vars in the project's settings:
    N8N_ENCRYPTION_KEY=<output of openssl rand -hex 32>
    WEBHOOK_URL=https://<project-slug>.ethiodeploy.app/
    N8N_PROXY_HOPS=1
    GENERIC_TIMEZONE=Africa/Addis_Ababa

WEBHOOK_URL is the address n8n prints on every Webhook node and registers with services like Telegram or Stripe. Without it n8n shows http://localhost:5678/, which no outside service can reach. Use your own domain here if you add one. N8N_PROXY_HOPS=1 tells n8n it sits behind one proxy, so it reads the visitor's real IP and protocol. GENERIC_TIMEZONE sets the timezone that Schedule triggers use; change it to yours.

Keep a copy of the encryption key somewhere safe outside EthioDeploy. With the database backup and the key you can move n8n anywhere; with the backup alone, every credential has to be entered again.

Create the owner account right away

The first person to open a new n8n gets to create the owner account. As soon as the first deploy is live, open https://<project-slug>.ethiodeploy.app and set it up yourself. The default health check path works as it is: both / and /healthz return 200.

Webhooks and schedules

Each Webhook node has a test URL (/webhook-test/…), which only works while you click “Listen for test event” in the editor, and a production URL (/webhook/…), which works once the workflow is published. Give outside services the production URL.

Schedule triggers and polling triggers run inside the n8n process, so the app has to stay awake. On Pro it never sleeps. Right after a deploy, give n8n a few seconds to register published workflows: in our test one webhook call returned 404 just after a restart, and the next ones worked.

Updating n8n

Change the version in the FROM line and push. n8n runs its database migrations when it starts, so take a backup from the project's Database tab first, and read n8n's release notes before a major version jump. The old version keeps serving until the new one passes its health check.

Can n8n run on the Free plan?

No. We ran n8n 2.49 with the Free plan's exact limits: 256 MB of memory and half a CPU. It used the whole 256 MB while starting, and after four minutes the editor still didn't load. With Pro's 1 GB it was ready in under a minute, used about 540 MB after starting and peaked at 645 MB while running 200 webhook executions, 10 at a time.

Free apps also sleep after 30 minutes without traffic, which stops Schedule triggers. Pro is $10 or 1,399 ETB a month: always on, 1 GB of memory and a 5 GB database, which is enough for n8n with room for heavier workflows.

Deploy

  1. Sign in with GitHub and install the EthioDeploy app on the repo.
  2. Click “New Project” and pick the repo.
  3. Watch the build in the dashboard. When the health check passes, your app is live at <project-slug>.ethiodeploy.app. Every push to the default branch redeploys, and the old version keeps serving until the new one is healthy.

Troubleshooting

Credentials could not be decrypted+

Cause: N8N_ENCRYPTION_KEY wasn't set, or it changed, so n8n generated a new key in the new container.

Fix: Set N8N_ENCRYPTION_KEY to the original key and redeploy. If the original is lost, set a new one and enter each credential again.

Webhook nodes show http://localhost:5678/webhook/…+

Cause: WEBHOOK_URL isn't set, so n8n builds URLs from its own port.

Fix: Set WEBHOOK_URL=https://<project-slug>.ethiodeploy.app/ and redeploy, then re-publish workflows that registered a webhook elsewhere.

Workflows and the owner account are gone after a deploy+

Cause: n8n used SQLite inside the container because it didn't get database settings.

Fix: Add a Postgres addon and make sure the Dockerfile's ENTRYPOINT runs start.sh.

The deploy times out or the container restarts on the Free plan+

Cause: n8n needs more than the Free plan's 256 MB of memory.

Fix: Move the project to Pro for 1 GB.

A production webhook returns 404+

Cause: The workflow isn't published, or n8n is still registering webhooks right after a restart.

Fix: Publish the workflow and use the /webhook/ URL, not /webhook-test/. After a deploy, retry after a few seconds.

Schedule triggers fire at the wrong hour+

Cause: GENERIC_TIMEZONE isn't set, so n8n uses its default timezone.

Fix: Set GENERIC_TIMEZONE, for example Africa/Addis_Ababa, and redeploy.

Still stuck? Check the deployment's build log in the dashboard, or see Troubleshooting.

Questions

Not on EthioDeploy's Free plan. In our test n8n 2.49 needed about 540 MB of memory just to start, and the Free container has 256 MB. Pro ($10 or 1,399 ETB a month) has 1 GB, never sleeps and includes a 5 GB Postgres database.

In our test with Postgres, n8n 2.49 used about 540 MB right after starting, about 520 MB idle, and peaked at 645 MB while running 200 webhook executions, 10 at a time. Plan for 1 GB, more if workflows handle large files.

On a platform where the container is replaced on every deploy, yes. n8n's default SQLite database is a file inside the container, so it disappears on the next deploy. With Postgres, workflows, credentials and executions survive deploys.

n8n encrypts credentials with N8N_ENCRYPTION_KEY. If that variable isn't set, n8n generates a key inside the container, and a new container gets a different one. Set the key as an env var before the first deploy and keep it.

The production URL from the Webhook node, which starts with your WEBHOOK_URL, for example https://<project-slug>.ethiodeploy.app/webhook/<path>. The workflow has to be published for it to work.

Ready to deploy?

Sign in with GitHub and pick your repo. No Dockerfile, no YAML.

More guides

Firebase StudioReplitv0

All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.

On this page
Prepare the repoDatabase and env varsCreate the owner account right awayWebhooks and schedulesUpdating n8nCan n8n run on the Free plan?DeployTroubleshootingQuestions
Deploying with an agent?Point it at llms.txt. Every guide is in one file there.Open llms-full.txt →
EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiPayload CMSDjangoFastAPIFlaskStreamlitExpressNestJSLaravelRailsGoSpring BootASP.NET CoreTelegram botDiscord botWhatsApp botLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy