Database Connection Error
ghoui
PROOP

2 months ago

Just tried to self host n8n with workers and when looking at my database.
I am getting this error
Database Connection

We are unable to connect to the database over the public network.

getaddrinfo ENOTFOUND postgres.railway.internal

how to resolve?

Solved$10 Bounty

0 Replies

Can you confirm that the service named postgres is up and running?


ghoui
PROOP

2 months ago

1423379789032718600


We are unable to connect to the database over the public network

Actually, this implies it's trying over public with the private domain


Have you modified the template's variables? I'll have to look at what the potential variables are


dev
MODERATOR

2 months ago

what does the red box say below the "Database Connection" ?


ghoui
PROOP

2 months ago

1423380107975721000


dev
MODERATOR

2 months ago

oh okay


brody
EMPLOYEE

2 months ago

In this context, the n8n template sets up the variables on the Postgres database slightly incorrectly, and then it inadvertently results in this error.


ghoui
PROOP

2 months ago

DATABASE_URL="postgres://${{POSTGRES_USER}}:${{POSTGRES_PASSWORD}}@${{PGHOST}}:${{PGPORT}}/${{POSTGRES_DB}}"
PGDATA="/var/lib/postgresql/data/pgdata"
PGDATABASE="${{POSTGRES_DB}}"
PGHOST="${{RAILWAY_PRIVATE_DOMAIN}}"
PGPASSWORD="${{POSTGRES_PASSWORD}}"
PGPORT="5432"
PGUSER="${{POSTGRES_USER}}"
POSTGRES_DB="railway"
POSTGRES_PASSWORD="YbgRNWjKDhMOKrF5HsS5zSAwBssSPwl~"
POSTGRES_USER="railway"
SSL_CERT_DAYS="820"

Ooop please don't share your postgres password :P


ghoui
PROOP

2 months ago

my bad sorry this is my first time when it comes to hosting


ghoui
PROOP

2 months ago

not really experienced in devops


brody
EMPLOYEE

2 months ago

That password is now permanently public.


ghoui
PROOP

2 months ago

🤦 sorry.


ghoui
PROOP

2 months ago

Do i have to redoploy the templates again?


I'm deploying the template myself to see if I can find the issue


ghoui
PROOP

2 months ago

I see.


You're seeing these logs in the worker container? Or in the interface?


ghoui
PROOP

2 months ago

Railway interface I am seeing that error.


ghoui
PROOP

2 months ago

For example

1423381667761881000


ghoui
PROOP

2 months ago

even on my redis I have this issue.


Works fine for me with no modifications <:hmm_noted:1383623507509903420>

Are you using the first template that shows up when you search n8n?

Redis shouldn't even have the REDIS_PASSWORD with my deployment.

1423381890487812400



ghoui
PROOP

2 months ago

The only modification as you can see I followed that required variable to put it in redis. I have put in a random string


ghoui
PROOP

2 months ago

That is correct that is the one.


brody
EMPLOYEE

2 months ago

Who's in your PFP


ghoui
PROOP

2 months ago

uhh not to be rude


ghoui
PROOP

2 months ago

but how does this help resolve our current issue. <:AE_confused:864885656638980117>


I see your issue now. 1 sec.


brody
EMPLOYEE

2 months ago

I was curious 🙁


Your issue won't actually cause issues with N8N I believe, just the built in UI


ghoui
PROOP

2 months ago

Oh I see.


ghoui
PROOP

2 months ago

In my n8n flows I do plan on using the DB itself. Should it work if I provided the correct connection string?


brody
EMPLOYEE

2 months ago

Please don't use N8N's own database in your flows, the database the template deploys with is for N8N to use internally.


ghoui
PROOP

2 months ago

Oh make sense.


But just in case you do want to view it:

DATABASE_PUBLIC_URL="postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"

You can create that variable and the UI will work.


ghoui
PROOP

2 months ago

Amazing!


ghoui
PROOP

2 months ago

Thank you Gentlemen.


Out of curiosity, why does Railway even try the internal domain? Is DATABASE_URL the backup to DATABASE_PUBLIC_URL?

-# Wow I really cannot spell today


brody
EMPLOYEE

2 months ago

Correct.


brody
EMPLOYEE

2 months ago

Historical context would be that DATABASE_URL used to be the public url


brody
EMPLOYEE

2 months ago

So for very old database deploys, the data tab will still work.


ghoui
PROOP

2 months ago

Before I close this thread. Buckets are currently out but for Feature Flags. Does that mean there some techinical bugs to be fixed before full deployment or is just looking feedback from the community?


I believe both of those but Brody will have a better response


It's fairly stable but I wouldn't recommend putting any production apps on it (yet) because it's technically "subject to change"


brody
EMPLOYEE

2 months ago

Besides having to use path style syntax, and there not being any billing for it yet, there are no known technical issues.


brody
EMPLOYEE

2 months ago

But of course, beta is beta, so what Sam said.


ghoui
PROOP

2 months ago

Great.
Thank you both Sam and Brody. I hope you guys have a great evening/night.


brody
EMPLOYEE

2 months ago

So who is the PFP? 🙂


ghoui
PROOP

2 months ago

The Eminence in Shadow - Beta Season 2 Episode 09 14:02.


brody
EMPLOYEE

2 months ago

Knew it looks familiar.


brody
EMPLOYEE

2 months ago

All the best devs have an anime PFP


Status changed to Solved brody 2 months ago


Loading...