none
PG::ConnectionBad: could not connect to server: No such file or directory precompilation failed Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? RRS feed

  • Question

  • I am trying to deploy Ruby on Rails app on Azure app service on Linux through Local git deployment method. But the deployment fails with the following error:

    PG::ConnectionBad: could not connect to server: No such file or directory precompilation failed Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

    I have already provisioned Azure Database for Postgresql with firewall rule allowing all IP and Allow access to azure services is turned ON. I can access the database through psql command and also run database migrations successfully.

    I have also entered the database credentials(the same one I used to connect using psql) in my database.yml file.

    Please suggest/tell how to get rid of this error and successfully deploy the app.

    Wednesday, December 4, 2019 6:57 AM

All replies

  • Hi Viren,

    It appears to be attempting to connect to a 'local' instance or is using file based access. Can you please do the following:

    1.  Detail your database.yml file minus any sensitive information (please do not expulse this information but rather change the values).
    2.  Are you using git directly to publish, or using a 3rd party tool?
    3.  This tutorial can be used as a reference: Tutorial: Build a PHP and MySQL app in Azure (replace MySQL for PostgreSQL)

    I realize you have your App and database created, but as you can see the tutorial has you create a local instance and an Azure Database for MySQL (PostgreSQL in your case) instance.

    I believe the issue is that the App Service assumes you have an App Service hosted instance of the database and not a standalone instance of Azure Database for PostgreSQL. Can you also check for your Application Settings to see if there is a setting that is pointing to a local instance of a database instance? 

    The tutorial serves as a reference and does not completely apply to your situation except for the Configure Database settings section. You could use Cloud Shell to update these or do so directly in the Azure Portal. Please let me know what you find.

    Regards,

    Mike

    Thursday, December 5, 2019 6:49 PM
    Moderator