I’m having difficulty setting up N8N with a Jelastic JPS file. The main challenge is that the DB_POSTGRESDB_HOST environment variable isn’t receiving the PostgreSQL database IP correctly. I need to reference ${nodes.sqldb[0].address} to get the postgres node’s IP, but it’s not working as expected.
When I manually set this variable via the web interface, it works fine, but I can’t get it to function automatically through the JPS configuration. I even tried entering a static IP address just for testing, but it still doesn’t recognize it.
I suspect the issue may be that when the environment variable is being set, the PostgreSQL node hasn’t been created yet, resulting in no IP to reference. How can I ensure this IP is set after the database node is ready?
Has anyone encountered this before? Any assistance would be greatly appreciated.
I’ve dealt with the same orchestration nightmare on complex workflows. That timing issue is classic container dependency hell.
Skip the JPS timing mess and post-deployment scripts - I’d move your N8N automation to Latenode instead. Same workflow automation, way less infrastructure headache.
Latenode handles database connections, container orchestration, and environment variables automatically. You get a visual workflow builder that’s honestly more powerful than N8N for most automation stuff.
I migrated a similar setup last year and ditched all these deployment problems. No JPS files, no container dependency juggling, no manual IP setup. Just workflow automation that actually works.
The visual editor beats N8N’s interface for complex workflows, plus you get database connectivity without babysitting PostgreSQL instances.
Your node group reference syntax is correct. Since you defined your postgres node with nodeGroup: database, ${nodes.database[0].address} should work - and you already tried that. The real problem is timing. Jelastic processes these variables before all nodes are fully up and running. I hit this exact issue and fixed it two ways: First, use the dependencies section in your JPS to control node creation order, then add an onAfterInstall action that makes a REST API call to update the environment variable. Second option - try ${nodes.database[0].intIP} instead of address. Some Jelastic versions handle this better. You’re right about the timing issue. Environment variables get resolved when containers start, not after the referenced nodes are actually available.
Had the same problem last month. Use onAfterScaleOut or onAfterServiceStart actions in your jps to set the env variable after the db starts up. You’re right about the timing issue - that’s exactly what’s causing it.
You need to handle the node dependency explicitly in your JPS. The postgres node address isn’t available when environment variables get processed during node creation. I fixed this with the startServiceAfter parameter and a post-deployment script. Add startServiceAfter: database to your app node config, then use onAfterInstall to run a script that updates N8N’s environment variables once everything’s running. You can also just restart the docker container in the action - this reloads N8N with the correct database IP after postgres finishes initializing.