From d0270102cadd605237efa77b3f3e40700c068baa Mon Sep 17 00:00:00 2001 From: nrvo <151435968+nrvo@users.noreply.github.com> Date: Sat, 3 Feb 2024 06:39:59 +0100 Subject: [PATCH 1/2] upgrade n8n to 1.27.2 and add pgsql db --- apps/n8n/config.json | 19 ++++++++++++++++--- apps/n8n/data/init-data.sh | 11 +++++++++++ apps/n8n/docker-compose.yml | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 apps/n8n/data/init-data.sh diff --git a/apps/n8n/config.json b/apps/n8n/config.json index cc7aab5c..23994688 100644 --- a/apps/n8n/config.json +++ b/apps/n8n/config.json @@ -5,14 +5,27 @@ "exposable": true, "port": 8094, "id": "n8n", - "tipi_version": 26, - "version": "0.237.0", + "tipi_version": 27, + "version": "1.27.2", "categories": ["automation"], "description": "n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything.", "short_desc": "Workflow Automation Tool. Alternative to Zapier", "author": "n8n.io", "source": "https://github.com/n8n-io/n8n", "website": "https://n8n.io/", - "form_fields": [], + "form_fields": [ + { + "type": "random", + "label": "Database Password", + "min": 32, + "env_variable": "N8N_DB_PASSWORD" + }, + { + "type": "random", + "label": "Database Non Root Password", + "min": 32, + "env_variable": "N8N_NR_DB_PASSWORD" + } + ], "supported_architectures": ["arm64", "amd64"] } diff --git a/apps/n8n/data/init-data.sh b/apps/n8n/data/init-data.sh new file mode 100644 index 00000000..f34e7691 --- /dev/null +++ b/apps/n8n/data/init-data.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e; + +if [ -n "${POSTGRES_NON_ROOT_USER:-}" ] && [ -n "${POSTGRES_NON_ROOT_PASSWORD:-}" ]; then + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL + CREATE USER ${POSTGRES_NON_ROOT_USER} WITH PASSWORD '${POSTGRES_NON_ROOT_PASSWORD}'; + GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_NON_ROOT_USER}; + EOSQL +else + echo "SETUP INFO: No Environment variables given!" +fi diff --git a/apps/n8n/docker-compose.yml b/apps/n8n/docker-compose.yml index db7847de..b3f2c3a9 100644 --- a/apps/n8n/docker-compose.yml +++ b/apps/n8n/docker-compose.yml @@ -3,18 +3,28 @@ version: "3.7" services: n8n: container_name: n8n - image: n8nio/n8n:0.237.0 + image: n8nio/n8n:1.27.2 restart: unless-stopped ports: - ${APP_PORT}:5678 volumes: - ${APP_DATA_DIR}/data/n8n:/home/node/.n8n - command: /bin/sh -c "sleep 5; n8n start" environment: - N8N_EDITOR_BASE_URL=${APP_PROTOCOL:-http}://${APP_DOMAIN} - WEBHOOK_URL=${APP_PROTOCOL:-http}://${APP_DOMAIN} + - DB_TYPE=postgresdb + - DB_POSTGRESDB_HOST=n8n_db + - DB_POSTGRESDB_PORT=5432 + - DB_POSTGRESDB_DATABASE=n8n + - DB_POSTGRESDB_USER=n8n + - DB_POSTGRESDB_PASSWORD=${N8N_NR_DB_PASSWORD} networks: - tipi_main_network + links: + - n8n_db + depends_on: + n8n_db: + condition: service_healthy labels: # Main traefik.enable: true @@ -40,3 +50,24 @@ services: traefik.http.routers.n8n-local.entrypoints: websecure traefik.http.routers.n8n-local.service: n8n traefik.http.routers.n8n-local.tls: true + + n8n_db: + container_name: n8n_db + image: postgres:11 + restart: unless-stopped + networks: + - tipi_main_network + environment: + - POSTGRES_USER=tipi + - POSTGRES_PASSWORD=${N8N_DB_PASSWORD} + - POSTGRES_DB=n8n + - POSTGRES_NON_ROOT_USER=n8n + - POSTGRES_NON_ROOT_PASSWORD=${N8N_NR_DB_PASSWORD} + volumes: + - ${APP_DATA_DIR}/data/postgres:/var/lib/postgresql/data + - ${APP_DATA_DIR}/data/init-data.sh:/docker-entrypoint-initdb.d/init-data.sh + healthcheck: + test: ['CMD-SHELL', 'pg_isready -h localhost -U $$POSTGRES_USER -d $$POSTGRES_DB'] + interval: 5s + timeout: 5s + retries: 10 From 12f2aa3590777e9416e40b5cc5ab89cc0db10a2b Mon Sep 17 00:00:00 2001 From: nrvo <151435968+nrvo@users.noreply.github.com> Date: Sat, 3 Feb 2024 07:04:54 +0100 Subject: [PATCH 2/2] Update description.md --- apps/n8n/metadata/description.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/n8n/metadata/description.md b/apps/n8n/metadata/description.md index a3fccf73..85a7e4ff 100644 --- a/apps/n8n/metadata/description.md +++ b/apps/n8n/metadata/description.md @@ -8,3 +8,9 @@ n8n is an extendable workflow automation tool. With a fair-code distribution mod versatile, enabling you to connect anything to everything. ![Screenshot](https://raw.githubusercontent.com/n8n-io/n8n/master/assets/n8n-screenshot.png) + +## Build with LangChain and AI in n8n +With n8n's LangChain nodes you can build AI-powered functionality within your workflows. The LangChain nodes are configurable, meaning you can choose your preferred agent, LLM, memory, and so on. Alongside the LangChain nodes, you can connect any n8n node as normal: this means you can integrate your LangChain logic with other data sources and services. + +## Available integrations +n8n has 200+ different nodes to automate workflows. The list can be found on: https://n8n.io/integrations