I’m having trouble setting up N8N using a Jelastic JPS configuration file. The main issue is that the PostgreSQL database host IP isn’t being properly assigned to the environment variable.
The Problem:
I need to pass the postgres node IP to the DB_POSTGRESDB_HOST variable using ${nodes.sqldb[0].address}, but it seems like Jelastic can’t detect this variable during deployment. When I manually set this variable through the web interface after deployment, everything works fine.
What I’ve Tried:
DB_POSTGRESDB_HOST: ${nodes.sqldb[0].address}
DB_POSTGRESDB_HOST: ${nodes.sqldb.first.address}
DB_POSTGRESDB_HOST: ${nodes.sqldb.master.address}
Here’s my current JPS setup:
type: install
id: workflow-automation
version: 1.0
name: Workflow Automation Platform
globals:
database_user: automation-${fn.random(1000)}
database_pass: ${fn.password}
secret_key: workflow${fn.password}
nodes:
- nodeType: nginx
displayName: Proxy Server
cloudlets: 16
nodeGroup: lb
- image: n8nio/n8n:latest
displayName: Automation Engine
cloudlets: 16
nodeGroup: app
links: database:db
env:
N8N_BASIC_AUTH_ACTIVE: true
N8N_BASIC_AUTH_USER: ${globals.database_user}
N8N_BASIC_AUTH_PASSWORD: ${globals.database_pass}
N8N_ENCRYPTION_KEY: ${globals.secret_key}
DB_TYPE: postgresdb
DB_POSTGRESDB_DATABASE: automation
DB_POSTGRESDB_HOST: ${nodes.database[0].address}
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_USER: ${globals.database_user}
DB_POSTGRESDB_PASSWORD: ${globals.database_pass}
- image: postgres:16.2
cloudlets: 16
nodeGroup: database
displayName: Database Server
env:
POSTGRES_USER: ${globals.database_user}
POSTGRES_PASSWORD: ${globals.database_pass}
POSTGRES_DB: automation
Root Cause:
I think the issue is timing related. When the environment variables are being set, the PostgreSQL node hasn’t been created yet, so there’s no IP address to reference.
Has anyone dealt with this before? How can I dynamically assign the database IP after the nodes are fully deployed?