Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何在Dotcloud上设置postgresql数据库?_Ruby On Rails_Postgresql_Dotcloud - Fatal编程技术网

Ruby on rails 如何在Dotcloud上设置postgresql数据库?

Ruby on rails 如何在Dotcloud上设置postgresql数据库?,ruby-on-rails,postgresql,dotcloud,Ruby On Rails,Postgresql,Dotcloud,我正在尝试将rails应用程序上载到dotcloud 我得到了这个错误: 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

我正在尝试将rails应用程序上载到dotcloud

我得到了这个错误:

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'
我猜这是因为我还没有建立postgres数据库。我该怎么做?医生似乎没有说

我的dotcloud.yml文件如下所示:

www:
  type: ruby
  exclude_bundler_groups:
    - development
data:
  type: postgresql
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
My database.yml如下所示:

www:
  type: ruby
  exclude_bundler_groups:
    - development
data:
  type: postgresql
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
我必须运行迁移吗?我该怎么做,医生也没说


有没有关于在dotcloud上设置rails应用程序的白痴指南?我是从Heroku过来的,在那里你只需推送代码并运行迁移。我花了好几个小时与dotcloud文档进行斗争,无法运行此应用程序。

在使用该yaml文件创建应用程序后,如“dotcloud push APPNAME app on dotcloud/”,您应该运行此行“dotcloud APPNAME.data info”,并获得可添加到database.yml的连接到数据库的所有信息

更新


您已获得访问postgresql终端的所有信息:用户、密码、端口和主机。您需要运行“dotcloud ssh APPNAME.www”,以便使用“psql-h myapp-myname.dotcloud.com-p 29876-U root”连接到postgresql,然后输入密码。最后,使用“create database'dbname';”创建您的数据库,并更新您的database.yml。

谢谢,但是运行
dotcloud APPNAME.data info
不会显示数据库的名称。我得到一个json格式的散列,其中包含
config:postgresql\u密码:xyz,端口:url:pgsql://root:mypassword@myapp myname.dotcloud.com:29876,键入:postgresql
,但未提及数据库名称。我遗漏了什么吗?@stephenmurdoch你需要自己创建数据库,你可以指定你想要的任何名称。dotcloud info命令中的信息提供了连接数据库和创建数据库所需的信息。如果您按照本页上的步骤操作,它将向您展示如何创建数据库。啊,谢谢,这很有道理,我今晚会解决的,再次谢谢。谢谢如果你不想经历创建数据库的麻烦,你可以使用“template1”,但这只适用于非常懒惰的人:-)