Postgresql连接错误tcp connect(localhost:5432):连接被拒绝

时间:2017-11-16 08:02:53

标签: postgresql tcp elixir phoenix-framework nanoboxio

我第一次玩Nanobox,尝试推出Elixir应用程序。我已经能够在本地运行应用程序,但是我没有使用nanobox deploy dry-run启动“干运行”,我收到以下错误:

! FAILED TO BEFORE_LIVE1: MIX ECTO.CREATE --QUIET !

    Exit
     1

    Command
     su - gonano -c "cd /app; siphon --prefix '' -- bash -i -l -c \"mix ecto.create --quiet\""

    Output

     07:43:15.795 [error] GenServer #PID<0.189.0> terminating
     ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
         (db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
         (connection) lib/connection.ex:622: Connection.enter_connect/5
         (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
     Last message: nil
     ** (Mix) The database for Codsonline.Repo couldn't be created: an exception was raised:
         ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
             (db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
             (connection) lib/connection.ex:622: Connection.enter_connect/5
             (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3


Error   : failed to execute hook (before_live) on e528aa7c36b4da40466b9d1d81154f3cbbcb785a278e8435dd20e71eb7f1974c: util:Exec:/opt/nanobox/hooks/before_live: bad exit code(1):
Context : failed to finalize deploy -> failed to run before deploy hooks

最初运行mix ecto.create时没有问题。

config/dev.exs看起来像:

config :codsonline, Codsonline.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: System.get_env("DATA_DB_USER"),
  password: System.get_env("DATA_DB_PASS"),
  hostname: System.get_env("DATA_DB_HOST"),
  database: "app_dev",
  pool_size: 10

Psql在本地运行。

我还设置了端口nanobox evar add dry-run PORT=8080

我在这个问题上看到了其他一些问题,有些评论表明我可能需要更改Postrges正在运行的端口,或者至少将配置更改为端口:5432,虽然我不确定我会在哪里做那。

0 个答案:

没有答案