1

Problem

In general, there have been a ton of issues in connecting a remote service to a PostgreSQL database. The documentation for most services doesn't really have documentation for this since the task of connecting to a PostgreSQL database requires the Admin to modify both the postgresql.conf and pg_hba.conf files.

The current scenario is giving AppSmith remote access to the given server.

  • PostgreSQL needs to allow the following IP addresses at the pg_hba.conf: 18.223.74.85 and 3.131.104.27
  • Research SSL Connections and if one would be required in this case

Success Criteria:

  1. Appsmith is able to connect to given database
  2. Appsmith is able to read/write data to given database

Resolution Research

  • Allowing the above IP addresses to connect to the PostgreSQL database in the pg_hba.conf file and changing the postgresql.conf file to allow remote connections using listening_addresses = '*' did not resolve the issue. Appsmith is unable to connect to the database.

SSL Connection: SSL stands for Secure Sockets Layer and, in short, it's the standard technology for keeping an internet connection secure and safeguarding any sensitive data that is being sent between two systems, preventing criminals from reading and modifying any information transferred, including potential personal details.

SSL proved to be a dead-end for this issue with no resolution.

Error in all cases on Appsmith: Failed to initialize pool: The connection attempt failed

Next-steps

  • Consult with the Stackoverflow community to see if anyone else is having a similar issue.
  • Similar issues have been found, but Appsmith documentation and the Stackoverflow community did not have the information needed to fulfill this issue. I will post the full case to the community.
  • 1
    So what exactly is the error message you get when you try to connect? That typically contains hints on where the problems lies –  Jun 08 '22 at 19:58

1 Answers1

0

I resolved this problem using ngrok to make a tcp tunnel on your localhost.

Donwload and conifg ngrok and create a new tunnel on terminal, just run ngrok tcp 5432 at terminal

After this, get the host/port and insert at Appsmith PostgreSQL Connection.

make sure your username/password is correct.

Image from host/port create on ngrok

Image to how config this host/port on Appsmith

  • I would like to raise a warning regarding using ngrok as a solution to connect AppSmith to a local PostgreSQL server. While it may work in resolving the issue, it could also pose security risks to your database as it opens up a public-facing tunnel to your localhost. Before proceeding with this solution, it is important to thoroughly evaluate the security implications and weigh the benefits against the risks involved. –  Feb 15 '23 at 03:07