CommunityToolkit / CommunityToolkit/Aspire
Add n8n Integration
- Dominant language
- C#
- Stars
- 627
- Forks
- 196
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 35
Description
### Aspire issue link
_No response_
### Overview
Add an Integration for [n8n](https://n8n.io/) to run and configure a self-hosted n8n environment.
I have already built this extension and happy to integrate into the CommunityToolkit. I can provide a PR Draft any time.
It supports the following scenarios:
- Simple hosted n8n environment (uses SQLite)
- Persistence with postgres (WithPostgresDatabase)
- Distributed Worker Container (AddWorker / WithQueueMode) using redis
- Isolated TaskRunner Container (AddTaskRunner) to support full scripting support. For deployments, the TaskRunner should be a sidecar of the worker.
- Setup of some parameters (WithLicenseKey. WithInstanceOwner, WithTimeZone, WithCommunityPackages, WithMetrics)
I have tested and tuned the extension by deploying environments on Azure Container Apps.
### Usage example
Simple setup with SQLite:
```csharp
var builder = DistributedApplication.CreateBuilder(args);
var n8n = builder.AddN8n("n8n");
builder.Build().Run();
```
Complex scenario with postgres db for persitence, worker (queues for scaling) and task runner (for isolation and support for pyhton script) and owner and licence key config:
```csharp
var builder = DistributedApplication.CreateBuilder(args);
var ownerPassword = builder.AddParameter("owner-password", "Pass$Word1");
var licenseKey = builder.AddParameter("license-key", "[license-key]");
var postgres = builder.AddPostgres("postgres")
.WithDataVolume();
var db = postgres.AddDatabase("n8n-db");
var redis = builder.AddRedis("redis");
var n8n = builder.AddN8n("n8n", port: 5678)
.WithDataBindMount("./.n8n_data")
.WithPostgresDatabase(db)
.WithQueueMode(redis)
.WithInstanceOwner("admin@dev.local", "Admin", "Local", ownerPassword)
.WithLicenseKey(licenseKey);
var worker = n8n.AddWorker("worker", port: 5679)
.WithPostgresDatabase(db)
.WithQueueMode(redis);
worker.AddTaskRunner("runner");
builder.Build().Run();
```
Remark: The password needs to be encrypted using BCrypt. I have used BCrypt.Net-Next library to make that work.
### Additional context
_No response_
### Help us help you
Yes, I'd like to be assigned to work on this item
Contributor guide
Research direction
Start from the DistributedApplication.CreateBuilder usage examples and review existing CommunityToolkit Aspire integrations for the expected entry points and testing conventions. The integration should cover the SQLite setup, PostgreSQL persistence, Redis queue mode, worker and task-runner scenarios, and the listed configuration options, with the examples working as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, postgresql, redis
- Domain
- backend, cloud, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100