I’m having issues with my N8N setup using a JPS manifest in Jelastic. The problem is that the DB_POSTGRESDB_HOST environment variable isn’t getting the PostgreSQL node’s IP address. I’ve tried using ${nodes.sqldb[0].address} and other similar options, but no luck.
It works when I manually set the variable through the GUI after everything is set up. But I can’t seem to do it automatically through the JPS file. I even tried putting in a random IP just to see if it would be detected, but that didn’t work either.
I think the issue might be that when the variable is supposed to be set, the Postgres node hasn’t been created yet, so there’s no IP to grab. Does anyone know how I can get around this and set the IP later in the process?
hey there! i’ve run into similar probs with jelastic before. have u tried using a post-install script? it can grab the postgres IP after everything’s set up and update the n8n env file. just make sure to restart the container after. it’s worked for me in the past. good luck!
I’ve encountered this timing issue on Jelastic before and found that a post-install script can provide a reliable solution. Instead of setting the DB_POSTGRESDB_HOST variable in the JPS file, you can delay the configuration until after all nodes, including PostgreSQL, are up and running. For instance, a script executed after deployment can obtain the PostgreSQL IP and update the N8N environment file, followed by a container restart. This ensures that the variable is set when the necessary components are in place, effectively addressing the issue.
I encountered a similar problem while setting up N8N with PostgreSQL on Jelastic. In my experience, the key was to delay setting the environment variable until after the PostgreSQL node was fully created. I accomplished this by incorporating a post-install script in the JPS manifest. The script executed a command to retrieve the PostgreSQL IP address using a curl call, then appended the appropriate value to the N8N .env file and restarted the container to apply the changes. This approach addressed the timing issue, ensuring the IP was available when needed. I suggest double-checking that all necessary tools, like jq for JSON parsing, are installed so the script runs without issues. This method worked well for me and might help resolve your challenge too.