Remote access to PostgreSQL Instance Server

Login to server from local machine using your username@server_ip_address

ssh username@server_ip_address

Go to postgresql directory and find existing version

cd /etc/postgresql/9.5/main

In postgresql.conf add the following line at the bottom of the file

listen_addresses = '*' end of the file

In pg_hba.conf add the following line at the bottom of the file

host   all   all   0.0.0.0/0   md5
host   all   all   ::/0        md5

Allow port default postgres port 5432 in the firewall to be able to connect

ufw allow 5432/tcp

Restart postgres service

sudo service postgresql restart

On local machine, try to connect to database on postgres server using your server_ip_address

psql -h server_ip_address -U postgres

Demo

type-orm

TypeORM Generate New Migration From Entity