Accès à une base de donnée via SSH - Database access through SSH

What type of hardware are you using: VPS bought online
What YunoHost version are you running: 12.0.11
What app is this about: Metabase database connexion

Describe your issue

I have 2 different VPS :

  • 1 running YNHST (let’s say IP:111.111.1.1), with all my internal tools
  • 1 running Coolify (let’s say IP 222.222.2.2), used to deploy a next.js webapp and a postgre instance (2 separate container, the postgre instance is not publicly accessible)

I would like to be able to connect the database to a Metabase instance (on my YHNST server).
I’ve tried to setup the ssh tunnel on my own, but I don’t seem to figure it out (I’m a real noob regarding SSH).

Here what I’ve done:
On Coolify’s server
I’ve figured out the internal IP of my docker running postgre: 192.168.16.2
I want to use port 5454 as 5432, 5433, etc are already used for other puposed

On YHNST server
I’ve installed autossh on YHNST.
I’ve run a autossh -M 0 -L 5454:192.168.16.2:5432 user@222.222.2.2 that connected me correctly to my Coolify server.

On both server
I’ve shared the public key through YNHST and Coolify’s servers

However, when I try to add the database in Metabase, I can’t make it work… I have errors saying “The connection attempt failed.”

I’ve tried several configuration, but none work so far.

I have no problem configuring the database that are publicly exposed, but that one cannot and will not be publicly exposed.
I thought it would be good exercise for me to figure this one out.

Anyone of you had this figured out? Anyone would have time to help out newbie like me ?

Thanks for you time anyway ;

Best
Sam

Share relevant logs or error messages

The connection attempt failed.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.