Re: Ubuntu and Rails postgresql setup - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Ubuntu and Rails postgresql setup
Date
Msg-id 56CDC8EF.5080504@aklaver.com
Whole thread Raw
In response to Ubuntu and Rails postgresql setup  (Marco Lobbia <ml.mailists@gmail.com>)
List pgsql-general
On 02/24/2016 12:34 AM, Marco Lobbia wrote:
> I am on a Ubuntu 14.04 LTS machine.
>
> I found useful information on how to configure PostgreSQL in Ubuntu for
> Rails development at help.ubuntu.com
> <https://help.ubuntu.com/community/PostgreSQL>, at Heroku
> <https://devcenter.heroku.com/articles/heroku-postgresql#local-setup>
> and at digitalocean.com
>
<https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-ruby-on-rails-application-on-ubuntu-14-04>.
>
> In the PostgreSQL documentation I could not find instructions related to
> setup after installation with PPA and about configuration for Rails, but
> only setup instructions after installation from souce code.
>
> Putting everything together, all the information seems to converge on
> the necessity of creating a database superuser with login name that
> match my Ubuntu user name with:
>
> |sudo -u postgres createuser --superuser $USER|
>
> When time arrives to create a password for the new superuser with |sudo
> -u postgres psql| , I am wondering if Rails can use PostgreSQL without
> setting the password, if this password can and should be different from
> my Ubuntu account password and also whether |database.yml| could be a
> security concern when pushing to Git repository hosting web sites and to
> Heroku.
> In|database.yml| in fact is recorded exactly this kind of sensitive
> information.

Do not know if the pg gem uses libpq to make its connections. I suspect
it does:

https://bitbucket.org/ged/ruby-pg/wiki/Home

Requirements

     Ruby 1.9.3+ or Rubinius 2.0+ .
     PostgreSQL 9.0.x (with headers, -dev packages, etc).

If that is the case, the you can use .pgpass to keep sensitive
information out of the *.yml file:

http://www.postgresql.org/docs/9.5/static/libpq-pgpass.html

>
> According to Heroku
> <https://devcenter.heroku.com/articles/heroku-postgresql#local-setup> it
> is necessary "to export the DATABASE_URL environment variable for your
> app to connect to it when running locally", with: |
> |
>
> |export DATABASE_URL=postgres:///$(whoami)|
>
> Is that really necessary? At help.ubuntu.com
> <https://help.ubuntu.com/community/PostgreSQL> and digitalocean.com
>
<https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-ruby-on-rails-application-on-ubuntu-14-04>
> this information is not reported.

See here:

http://guides.rubyonrails.org/configuring.html#configuring-a-database

Since a good bit of the above deals with Rails specifically, you might
want to also ask on the Rails list:

https://groups.google.com/forum/#!forum/rubyonrails-talk

>
> Finally I am wondering whether the choice of installing PostgreSQL
> through the PostgreSQL apt repository would be safe enough or it would
> be preferable to install the LTS version of Ubuntu.
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: json function question
Next
From: Andrew Dunstan
Date:
Subject: Re: json function question