0

I'm trying to upload a rails app to dotcloud.

I'm getting this error:

PG::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"?
):
  activerecord (3.2.5) lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `initialize'

I'm guessing it's because I haven't set up a postgres database. How do I do that? The docs don't appear to say.

My dotcloud.yml file looks like this:

www:
  type: ruby
  exclude_bundler_groups:
    - development
data:
  type: postgresql

My database.yml looks like this:

production:
  adapter: postgresql
  database: my_app_production # have not set this up on dotcloud yet as I can't find any docs on how to do it
  username: root
  password: mypassword

Do I have to run migrations? How do I do that, again the docs don't say.

Is there an idiots guide to setting up a rails app on dotcloud? I'm coming over from Heroku, where you just push your code and run your migrations. I've spent a good few hours struggling with the dotcloud docs and can't get this app to run.

stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189

1 Answers1

1

After you create your app with that yaml file, like "dotcloud push APPNAME app-on-dotcloud/", you should run this line "dotcloud APPNAME.data info" and you get all info for connect to database that you can add to database.yml

UPDATE

You've obtained all info for access to postgresql terminal: user, password, port and host. You need run "dotcloud ssh APPNAME.www", for you connect to postgresql with "psql -h myapp-myname.dotcloud.com -p 29876 -U root", then put your password. Finally, create your database with "CREATE DATABASE 'dbname';" and update your database.yml.

Marco Godínez
  • 3,440
  • 2
  • 21
  • 30
  • thanks, but running `dotcloud APPNAME.data info` doesn't display the name of the db. I get a json formatted hash with stuff like `config: postgresql_password: xyz, ports: url: pgsql://root:mypassword@myapp-myname.dotcloud.com:29876, type: postgresql` but no mention of db name. Am I missing something? – stephenmurdoch Jun 13 '12 at 15:24
  • 1
    @stephenmurdoch you need to create the database yourself, and you can specify whatever name you want. The info from the dotcloud info command gives you what you need to connect to the database and create the database. If you follow the steps on this page it will show you how to create your database. http://docs.dotcloud.com/services/postgresql/ – Ken Cochrane Jun 13 '12 at 23:33
  • ah, thanks, that makes sense, I will sort that out tonight, thanks again. Cheers – stephenmurdoch Jun 13 '12 at 23:36
  • If you don't want to go through the hassle of creating a database, you could use "template1", but that's only for very lazy people :-) – jpetazzo Jun 20 '12 at 23:29