How to make the database (or part of it) accessible to a cloud data processor?

Ok. I finally figured it out :tada:

I changed this:

to this - "127.0.0.1:5433:5432" because I got an error saying the port was already used.

I rebuilt the container and checked that the port was indeed open:

$ sudo docker ps
CONTAINER ID        IMAGE                           COMMAND             CREATED             STATUS              PORTS                      NAMES
whatever_id        local_discourse/app             "/sbin/boot"        20 minutes ago      Up 20 minutes       127.0.0.1:5433->5432/tcp   app

I am now able to create an SSH tunnel and connect from my remote server using a user with password:

# create the tunnel (you could also use ssh -f to run it in the background)
ssh -v -N -L 5433:localhost:5433 SERVER_IP_ADDRESS

# connect in another tab and enter the password 
psql -h localhost -d discourse -U whatever_user -p 5433

If anyone is trying to do this and runs into any issues, let me know.

4 个赞