Search Postgresql Archives

Re: Ubuntu and Rails postgresql setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/24/2016 12:34 AM, Marco Lobbia wrote:
I am on a Ubuntu 14.04 LTS machine.

I thought I'd chime in since I work with Rails and Postgres on Ubuntu all day long. :-) 14.04 LTS is fine for both production and development. (Sounds like you're using Heroku for production in any case.)

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|

This is the "normal" way to do it for Rails. It wants a superuser so it can drop and recreate the database before running tests (`rake test`). Personally I prefer to give each project a separate non-superuser Postgres account and start tests with just `rspec spec`, but if you're new to Rails I recommend going with the approved method.

Also, Rails wants to use Postgres "ident" authentication, which does not require a password because it trusts that the OS has already authenticated you. You can avoid this too if you like by adding `host: localhost` to your `database.yml`, but then you'll need to use a password.

Btw since this is not the Rails mailing list, feel free to email me personally if you have more Rails-specific questions.

> 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)|

That is if you want to connect to the *remote* database on Heroku (i.e. probably your *production* database). If you want to connect to your locally-installed Postgres, you should not set DATABASE_URL.

> 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.

Either is fine.

Good luck!
Paul



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux