First Heroku, Ruby & Postgres App - Local Postgres Error












1















I have been following Heroku's guide to getting started with Ruby on Heroku, and have gotten stuck trying to connect to the postgres database.



When I run:



bundle exec rake db:create db:migrate


I am left with this error:



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


And:



Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"garrett", "username"=>"ruby-getting-started"}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


I have tried editing my database.yml file but I'm not sure if I am changing the correct parameters:



default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5

development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started

test:
<<: *default
database: ruby-getting-started_test

production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>


Do I have my database.yml setup incorrectly or am I completely wrong?










share|improve this question

























  • try this command pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start , then do the db:migrate

    – Ahmad Al-kheat
    Feb 2 '15 at 2:08











  • Hey man, I tried running that command and ended up with this: garrett@garrett-virtual-machine:~/ruby-getting-started$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start pg_ctl: Coordinator or Datanode option not specified (-Z) Try "pg_ctl --help" for more information.

    – GarrettG
    Feb 2 '15 at 18:46













  • The Coordinator or Datanode option part of the message reveals that you don't have postgresql but postgres-xc. Presumably you've chosen the wrong packages at some point of your install. Ubuntu has an unfortunate error message when psql is not found that can lead to that mistake.

    – Daniel Vérité
    Feb 2 '15 at 20:57













  • Thanks for the reply, Daniel. I removed Postgres-xc and ran: sudo apt-get install postgresql-9.3 Now, I receive this error after running bundle exec rake db:create db:migrate could not connect to server: no such file or directory Is the server running locally and accepting connections on unix domain socket "/var/run/postgresql/.s.PSQL.5432

    – GarrettG
    Feb 5 '15 at 4:16


















1















I have been following Heroku's guide to getting started with Ruby on Heroku, and have gotten stuck trying to connect to the postgres database.



When I run:



bundle exec rake db:create db:migrate


I am left with this error:



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


And:



Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"garrett", "username"=>"ruby-getting-started"}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


I have tried editing my database.yml file but I'm not sure if I am changing the correct parameters:



default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5

development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started

test:
<<: *default
database: ruby-getting-started_test

production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>


Do I have my database.yml setup incorrectly or am I completely wrong?










share|improve this question

























  • try this command pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start , then do the db:migrate

    – Ahmad Al-kheat
    Feb 2 '15 at 2:08











  • Hey man, I tried running that command and ended up with this: garrett@garrett-virtual-machine:~/ruby-getting-started$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start pg_ctl: Coordinator or Datanode option not specified (-Z) Try "pg_ctl --help" for more information.

    – GarrettG
    Feb 2 '15 at 18:46













  • The Coordinator or Datanode option part of the message reveals that you don't have postgresql but postgres-xc. Presumably you've chosen the wrong packages at some point of your install. Ubuntu has an unfortunate error message when psql is not found that can lead to that mistake.

    – Daniel Vérité
    Feb 2 '15 at 20:57













  • Thanks for the reply, Daniel. I removed Postgres-xc and ran: sudo apt-get install postgresql-9.3 Now, I receive this error after running bundle exec rake db:create db:migrate could not connect to server: no such file or directory Is the server running locally and accepting connections on unix domain socket "/var/run/postgresql/.s.PSQL.5432

    – GarrettG
    Feb 5 '15 at 4:16
















1












1








1


0






I have been following Heroku's guide to getting started with Ruby on Heroku, and have gotten stuck trying to connect to the postgres database.



When I run:



bundle exec rake db:create db:migrate


I am left with this error:



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


And:



Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"garrett", "username"=>"ruby-getting-started"}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


I have tried editing my database.yml file but I'm not sure if I am changing the correct parameters:



default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5

development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started

test:
<<: *default
database: ruby-getting-started_test

production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>


Do I have my database.yml setup incorrectly or am I completely wrong?










share|improve this question
















I have been following Heroku's guide to getting started with Ruby on Heroku, and have gotten stuck trying to connect to the postgres database.



When I run:



bundle exec rake db:create db:migrate


I am left with this error:



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


And:



Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"garrett", "username"=>"ruby-getting-started"}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


I have tried editing my database.yml file but I'm not sure if I am changing the correct parameters:



default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5

development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started

test:
<<: *default
database: ruby-getting-started_test

production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>


Do I have my database.yml setup incorrectly or am I completely wrong?







ruby-on-rails ruby postgresql heroku






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 11:33









Cœur

17.5k9104145




17.5k9104145










asked Feb 2 '15 at 1:11









GarrettGGarrettG

1918




1918













  • try this command pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start , then do the db:migrate

    – Ahmad Al-kheat
    Feb 2 '15 at 2:08











  • Hey man, I tried running that command and ended up with this: garrett@garrett-virtual-machine:~/ruby-getting-started$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start pg_ctl: Coordinator or Datanode option not specified (-Z) Try "pg_ctl --help" for more information.

    – GarrettG
    Feb 2 '15 at 18:46













  • The Coordinator or Datanode option part of the message reveals that you don't have postgresql but postgres-xc. Presumably you've chosen the wrong packages at some point of your install. Ubuntu has an unfortunate error message when psql is not found that can lead to that mistake.

    – Daniel Vérité
    Feb 2 '15 at 20:57













  • Thanks for the reply, Daniel. I removed Postgres-xc and ran: sudo apt-get install postgresql-9.3 Now, I receive this error after running bundle exec rake db:create db:migrate could not connect to server: no such file or directory Is the server running locally and accepting connections on unix domain socket "/var/run/postgresql/.s.PSQL.5432

    – GarrettG
    Feb 5 '15 at 4:16





















  • try this command pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start , then do the db:migrate

    – Ahmad Al-kheat
    Feb 2 '15 at 2:08











  • Hey man, I tried running that command and ended up with this: garrett@garrett-virtual-machine:~/ruby-getting-started$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start pg_ctl: Coordinator or Datanode option not specified (-Z) Try "pg_ctl --help" for more information.

    – GarrettG
    Feb 2 '15 at 18:46













  • The Coordinator or Datanode option part of the message reveals that you don't have postgresql but postgres-xc. Presumably you've chosen the wrong packages at some point of your install. Ubuntu has an unfortunate error message when psql is not found that can lead to that mistake.

    – Daniel Vérité
    Feb 2 '15 at 20:57













  • Thanks for the reply, Daniel. I removed Postgres-xc and ran: sudo apt-get install postgresql-9.3 Now, I receive this error after running bundle exec rake db:create db:migrate could not connect to server: no such file or directory Is the server running locally and accepting connections on unix domain socket "/var/run/postgresql/.s.PSQL.5432

    – GarrettG
    Feb 5 '15 at 4:16



















try this command pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start , then do the db:migrate

– Ahmad Al-kheat
Feb 2 '15 at 2:08





try this command pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start , then do the db:migrate

– Ahmad Al-kheat
Feb 2 '15 at 2:08













Hey man, I tried running that command and ended up with this: garrett@garrett-virtual-machine:~/ruby-getting-started$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start pg_ctl: Coordinator or Datanode option not specified (-Z) Try "pg_ctl --help" for more information.

– GarrettG
Feb 2 '15 at 18:46







Hey man, I tried running that command and ended up with this: garrett@garrett-virtual-machine:~/ruby-getting-started$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start pg_ctl: Coordinator or Datanode option not specified (-Z) Try "pg_ctl --help" for more information.

– GarrettG
Feb 2 '15 at 18:46















The Coordinator or Datanode option part of the message reveals that you don't have postgresql but postgres-xc. Presumably you've chosen the wrong packages at some point of your install. Ubuntu has an unfortunate error message when psql is not found that can lead to that mistake.

– Daniel Vérité
Feb 2 '15 at 20:57







The Coordinator or Datanode option part of the message reveals that you don't have postgresql but postgres-xc. Presumably you've chosen the wrong packages at some point of your install. Ubuntu has an unfortunate error message when psql is not found that can lead to that mistake.

– Daniel Vérité
Feb 2 '15 at 20:57















Thanks for the reply, Daniel. I removed Postgres-xc and ran: sudo apt-get install postgresql-9.3 Now, I receive this error after running bundle exec rake db:create db:migrate could not connect to server: no such file or directory Is the server running locally and accepting connections on unix domain socket "/var/run/postgresql/.s.PSQL.5432

– GarrettG
Feb 5 '15 at 4:16







Thanks for the reply, Daniel. I removed Postgres-xc and ran: sudo apt-get install postgresql-9.3 Now, I receive this error after running bundle exec rake db:create db:migrate could not connect to server: no such file or directory Is the server running locally and accepting connections on unix domain socket "/var/run/postgresql/.s.PSQL.5432

– GarrettG
Feb 5 '15 at 4:16














1 Answer
1






active

oldest

votes


















1














This is a common Postgres error that is basically telling you it can’t find the server. This can be caused by various reasons from not having it installed to a broken path from an OS update.



If you do have the server installed you could re install it through Homebrew or the GUI windows installer found at postgres.org.



Either way the fastest fix is to use a single package installer like Postgres.app for mac.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28269848%2ffirst-heroku-ruby-postgres-app-local-postgres-error%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    This is a common Postgres error that is basically telling you it can’t find the server. This can be caused by various reasons from not having it installed to a broken path from an OS update.



    If you do have the server installed you could re install it through Homebrew or the GUI windows installer found at postgres.org.



    Either way the fastest fix is to use a single package installer like Postgres.app for mac.






    share|improve this answer




























      1














      This is a common Postgres error that is basically telling you it can’t find the server. This can be caused by various reasons from not having it installed to a broken path from an OS update.



      If you do have the server installed you could re install it through Homebrew or the GUI windows installer found at postgres.org.



      Either way the fastest fix is to use a single package installer like Postgres.app for mac.






      share|improve this answer


























        1












        1








        1







        This is a common Postgres error that is basically telling you it can’t find the server. This can be caused by various reasons from not having it installed to a broken path from an OS update.



        If you do have the server installed you could re install it through Homebrew or the GUI windows installer found at postgres.org.



        Either way the fastest fix is to use a single package installer like Postgres.app for mac.






        share|improve this answer













        This is a common Postgres error that is basically telling you it can’t find the server. This can be caused by various reasons from not having it installed to a broken path from an OS update.



        If you do have the server installed you could re install it through Homebrew or the GUI windows installer found at postgres.org.



        Either way the fastest fix is to use a single package installer like Postgres.app for mac.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 2 '15 at 2:23









        Jose TorresJose Torres

        835816




        835816






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28269848%2ffirst-heroku-ruby-postgres-app-local-postgres-error%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python