Leon, you are right, if your Loraserver and Postgres instances are in different machines, you need to change localhost for the Postgre’s host name or ip. After that, you need to configure Postgres so that it can be remotely accessed (by default it only allows local access). You can achieve this by changing postgresql.conf (its location depends on the installation, but most common ones are /etc/postgressql//main/ and /var/lib/pgsql//data/). You need to modify this line:
listen_addresses = ‘localhost’
Change it to this:
listen_addresses = ‘*’
Also, pg_hba.conf (most likely at the same location as postgresql.conf) needs to be modified to allow user’s remote access (again, by default it only allows local access). Add these lines to the end of the file:
host all all 0.0.0.0/0 md5
host all all ::/0 md5
Now just restart the postgresql service and you should be able to connect to your DB remotely.
EDIT:
Also check the error you got:
Are you sure that you assigned it to POSTGRES_DSN var? I.e., it should be like this:
POSTGRES_DSN=postgres://loraserver_ns:dbpassword@localhost/loraserver?sslmode=disable