---
title: Deploy n8n
url: "/guides/n8n/"
canonical_url: https://docs.blossom88.com/guides/n8n/
markdown_url: https://docs.blossom88.com/guides/n8n.md
summary: Deploy n8n with your AI agent, managed PostgreSQL and Redis, a private editor,
  authenticated webhooks, and scalable queue workers.
categories:
- deployment
- automation
---

# Deploy n8n

Run [n8n](https://n8n.io/) on Blossom and turn incoming webhooks into working
automations. Keep workflows and credentials in managed PostgreSQL, and send
executions through Redis to separate workers.

[Install the Blossom CLI and skill](/learn/getting-started/install/)
on your agent's machine and choose a Blossom Cloud Location when you log in.
You can also use
[Blossom BYOC (bring your own cloud)](/learn/getting-started/choose-your-cloud/#blossom-byoc).

## Ask Your Agent


> **Ask your AI agent:** Deploy n8n on Blossom with PostgreSQL, Redis, and queue workers. Keep the
> editor private and help me run an authenticated webhook workflow. Show me
> the setup before deploying.



| Choice | Setup in this guide |
|---|---|
| Image | Official n8n 2.48.4 image, pinned for the deployment |
| Main Service | One Medium Container for the editor, API, and triggers |
| Worker Service | One Small Container, running `n8n worker --concurrency=5` |
| Saved data | Shared PostgreSQL 18 and Shared Redis 8 |
| Editor access | Account members, then your n8n login |
| External calls | `/webhook/*`, with authentication configured in n8n |
| Scaling | Add worker replicas; keep one main Container |

Create your n8n owner account when the editor first opens. Your agent saves
one `N8N_ENCRYPTION_KEY` as a runtime Environment variable and keeps it across
updates. Main and worker Containers use the same key to read saved credentials.

**Scale workers for more workflow execution capacity.** Keep the main Service
at one replica. n8n's
[multi-main setup](https://docs.n8n.io/hosting/scaling/queue-mode/#multi-main-setup)
requires its self-hosted Enterprise feature. Additional workers do not make
this single-main setup highly available.

<details class="optional-reading" markdown="1">
<summary>Commands behind the deployment</summary>

Use the resource IDs returned by Blossom in place of the examples below.

### Create the App and Data

    blossom profile:show
    blossom app:create --data '{"app":{"name":"n8n"}}'

Create environment.yml with the returned App ID:

```yaml
environment:
  app_id: app-100
  name: production
  source_type: prebuilt_image
  prebuilt_image: docker.n8n.io/n8nio/n8n@sha256:63c4682d0ef068051ef9beca9b0db0597696a5958470ee1f3583e53c5b81943a
  access_mode: members
  access_public_paths:
    - /webhook/*
```

    blossom environment:create --data environment.yml

Create database_instance.yml:

```yaml
database_instance:
  name: n8n-postgres
  engine: postgres
  engine_version: "18"
  availability: shared
  size: small
  storage_gib: 10
  database_name: n8n
  backup_storage_id: blossom_cloud
```

    blossom database_instance:create --data database_instance.yml --follow
    blossom database:list --database_instance database_instance-100

Create cache_instance.yml:

```yaml
cache_instance:
  name: n8n-redis
  engine: redis
  engine_version: "8"
  availability: shared
  size: small
  storage_gib: 10
  backup_storage_id: blossom_cloud
```

    blossom cache_instance:create --data cache_instance.yml --follow

Link the PostgreSQL **Database** and Redis **Cache instance** to the Environment:

    blossom environment_link:create --data '{"environment_link":{"environment_id":"environment-100","target_type":"Database","target_id":"database-100","var_name":"DATABASE_URL"}}'
    blossom environment_link:create --data '{"environment_link":{"environment_id":"environment-100","target_type":"CacheInstance","target_id":"cache_instance-100","var_name":"REDIS_URL"}}'

### Save Runtime Settings

Have your agent generate the encryption key once and save it in a private
.env.production file. The settings for this recipe are:

```dotenv
N8N_ENCRYPTION_KEY=<generated key, retained across deployments>
EXECUTIONS_MODE=queue
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true
QUEUE_HEALTH_CHECK_ACTIVE=true
N8N_DEFAULT_BINARY_DATA_MODE=database
N8N_PROXY_HOPS=1
N8N_PROTOCOL=https
N8N_PORT=5678
N8N_LISTEN_ADDRESS=0.0.0.0
GENERIC_TIMEZONE=America/Los_Angeles
TZ=America/Los_Angeles
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
```

Choose your own workflow timezone. Database-backed binary storage keeps this
recipe's workflow files available to its workers. The encryption key is a
runtime secret; keep the file out of your application repository.

    blossom env_var:push --environment environment-100 --file .env.production

### Configure Main and Worker Services

Blossom supplies the linked connection URLs. This startup command maps them
into n8n's database and queue settings, then starts the requested process.
The readiness check uses Node, which is present in the official image.

web.yml:

```yaml
service:
  environment_id: environment-100
  name: web
  entrypoint: /usr/local/bin/node
  command: >-
    -e 'const {spawn}=require("node:child_process");
    const d=new URL(process.env.DATABASE_URL),r=new URL(process.env.REDIS_URL);
    Object.assign(process.env,{
      DB_TYPE:"postgresdb",DB_POSTGRESDB_HOST:d.hostname,
      DB_POSTGRESDB_PORT:d.port||"5432",
      DB_POSTGRESDB_DATABASE:decodeURIComponent(d.pathname.slice(1)),
      DB_POSTGRESDB_USER:decodeURIComponent(d.username),
      DB_POSTGRESDB_PASSWORD:decodeURIComponent(d.password),
      QUEUE_BULL_REDIS_HOST:r.hostname,QUEUE_BULL_REDIS_PORT:r.port||"6379",
      QUEUE_BULL_REDIS_USERNAME:decodeURIComponent(r.username),
      QUEUE_BULL_REDIS_PASSWORD:decodeURIComponent(r.password)
    });
    const c=spawn("n8n",["start"],{stdio:"inherit"});
    for(const s of ["SIGTERM","SIGINT"])process.on(s,()=>c.kill(s));
    c.on("exit",code=>process.exit(code??1));'
  port: 5678
  publicly_exposed: true
  desired_size: 1
  resources:
    preset: medium
  health_check:
    enabled: true
    kind: command
    command: >-
      node -e 'fetch("http://127.0.0.1:5678/healthz/readiness")
      .then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))'
    start_period: 60s
```

Copy web.yml to worker.yml. Set `name: worker`, `publicly_exposed: false`,
and `preset: small`. In the startup command, replace `["start"]` with
`["worker","--concurrency=5"]`. Keep the connection mapping and readiness
check the same.

    blossom service:create --data web.yml
    blossom service:create --data worker.yml
    blossom environment:deploy --id environment-100 --follow
    blossom environment:show --id environment-100

Use the returned HTTPS URL for `N8N_EDITOR_BASE_URL` and
`N8N_WEBHOOK_URL` in .env.production; end the webhook URL with `/`.
For a custom domain, use that domain for both settings.

    blossom env_var:push --environment environment-100 --file .env.production
    blossom environment:deploy --id environment-100 --follow

</details>

## Run Your First Workflow


> **Ask your AI agent:** Help me create and publish an n8n workflow that accepts a POST webhook,
> returns the request ID, and requires Header Auth. Save the credential in n8n
> and test the Production URL with and without authentication.



Use a **Webhook** node with **Header Auth**, followed by **Respond to Webhook**.
Publish the workflow and send a test request to its **Production URL**.
`/webhook/*` bypasses Blossom's member sign-in; n8n checks the webhook's own
authentication. Keep the editor and `/rest/*` behind Account-member access.

![A published n8n workflow connecting a Webhook node to Respond to Webhook.](/assets/images/n8n/workflow.png)

The agent follows the deployment and can inspect the running Services:

    blossom service:list --environment environment-100
    blossom logs --environment environment-100 --lines 30

## Add Workers


> **Ask your AI agent:** Scale the n8n worker Service to two replicas. Keep the main Service at one,
> run my webhook workflow again, then return the workers to one replica.



The worker count changes independently of the editor:

    blossom service:scale --id service-WORKER --desired-size 2 --follow
    blossom service:scale --id service-WORKER --desired-size 1 --follow

## What You Get

- A private n8n editor and authenticated production webhooks
- Workflows and encrypted credentials in managed PostgreSQL
- Redis-backed queue workers you can scale separately
- A stable encryption key across app updates
