Skip to content

DefangSamples/sample-n8n-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

n8n

1-click-deploy

This sample shows how to get a n8n app up using PostgreSQL as a database and running with Defang. We based it in part on the original sample from the n8n team, but we have adapted it to be consistent with the way our other samples are configured.

Video Tutorial

n8n Tutorial

Prerequisites

  1. Download Defang CLI
  2. (Optional) If you are using Defang BYOC authenticate with your cloud provider account
  3. (Optional for local development) Docker CLI

Development

To run the application locally for development, use the development compose file:

docker compose -f compose.dev.yaml up

This will:

  • Start PostgreSQL with volume persistence for local development
  • Expose PostgreSQL on port 5432 for direct access if needed
  • Start n8n on port 5678 with volume persistence

You can access n8n at http://localhost:5678 once the containers are running.

Configuration

For this sample, you will need to provide the following configuration. Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.

POSTGRES_PASSWORD

The password for your Postgres database. You need to set this before deploying for the first time.

You can easily set this to a random string using defang config set POSTGRES_PASSWORD --random

N8N_ENCRYPTION_KEY

The encryption key for your n8n instance. This is used to encrypt sensitive data in the database.

You can easily set this to a random string using defang config set N8N_ENCRYPTION_KEY --random

DB_POSTGRESDB_SSL_ENABLED

Set to true to enable SSL. Set to false to disable SSL.

DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED

Set to true to reject unauthorized certificates. Set to false to accept unauthorized certificates. Counterintuitive, but leave this as true to disable SSL (required for local dev and playground).

Deployment

Note

Download Defang CLI

Defang Playground

Deploy your application to the Defang Playground by opening up your terminal and typing:

defang compose up

BYOC (Deploy to you own AWS or GCP cloud account)

If you want to deploy to your own cloud account, you can use Defang BYOC.

Warning

Extended deployment time: This sample creates a managed PostgreSQL database which may take upwards of 20 minutes to provision on first deployment. Subsequent deployments are much faster (2-5 minutes).


Title: n8n

Short Description: A n8n app running on Defang.

Tags: n8n, PostgreSQL, Docker

Languages: Docker, Shell

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •