Buddy継続的インテグレーションサーバー上でビルドを実行していて、mix test
がpostgrex/ectoに到達するとエラーが発生します部分:DBConnection.ConnectionError)接続が拒否されました - :econnrefused
==> postgrex
Compiling 61 files (.ex)
Compiling lib/postgrex/protocol.ex (it's taking more than 10s)
Compiling lib/postgrex/default_types.ex (it's taking more than 10s)
Generated postgrex app
==> ecto
Compiling 69 files (.ex)
Compiling lib/ecto/query/builder/lock.ex (it's taking more than 10s)
Compiling lib/ecto/repo/queryable.ex (it's taking more than 10s)
Compiling lib/ecto/query/inspect.ex (it's taking more than 10s)
Compiling lib/mix/tasks/ecto.drop.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/filter.ex (it's taking more than 10s)
Compiling lib/ecto/repo/preloader.ex (it's taking more than 10s)
Compiling lib/mix/tasks/ecto.gen.repo.ex (it's taking more than 10s)
Compiling lib/ecto/adapters/mysql.ex (it's taking more than 10s)
Compiling lib/ecto/schema.ex (it's taking more than 10s)
Compiling lib/ecto/migration/runner.ex (it's taking more than 10s)
Compiling lib/ecto/repo/schema.ex (it's taking more than 10s)
Compiling lib/ecto/embedded.ex (it's taking more than 10s)
Compiling lib/ecto/migration/schema_migration.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/preload.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/order_by.ex (it's taking more than 10s)
Compiling lib/ecto/uuid.ex (it's taking more than 10s)
Compiling lib/ecto/type.ex (it's taking more than 10s)
Compiling lib/ecto/association.ex (it's taking more than 10s)
Compiling lib/ecto/adapters/postgres/connection.ex (it's taking more than 10s)
Compiling lib/mix/tasks/ecto.gen.migration.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/join.ex (it's taking more than 10s)
Compiling lib/ecto/query/planner.ex (it's taking more than 10s)
Compiling lib/ecto/log_entry.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/select.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/distinct.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/limit_offset.ex (it's taking more than 10s)
Compiling lib/ecto/changeset.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/group_by.ex (it's taking more than 10s)
Compiling lib/ecto/changeset/relation.ex (it's taking more than 10s)
Compiling lib/ecto/multi.ex (it's taking more than 10s)
Compiling lib/ecto.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder.ex (it's taking more than 10s)
Compiling lib/ecto/adapters/postgres.ex (it's taking more than 10s)
Generated ecto app
==> phoenix_ecto
Compiling 4 files (.ex)
Generated phoenix_ecto app
==> phoenix_chat
Compiling 19 files (.ex)
Generated phoenix_chat app
08:49:48.868 [error] GenServer #PID<0.3296.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
** (Mix) The database for PhoenixChat.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
Build failed !!!.
私は、ビルドサーバが(localhost:5432)
のようですので、それはだと思うし、私はそれが、この解決策は何ですかポート4000 See this answer for my coming to that conclusion.
にusallyであるフェニックスとよく果たしているとは思いませんか?
私は、この設定を持っているdev.exを変更:
config :phoenix_chat, PhoenixChat.Endpoint,
http: [port: {:system, "PORT"}],
その後、私はPORT=4000 mix test
にタスクを設定するが、私はまだ同じエラーを取得します。
EDIT:それは私がポートを設定することが表示されないエラーがまだあるので、働いていた:
PORT=4000 mix test
09:18:34.884 [error] GenServer #PID<0.183.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
** (Mix) The database for PhoenixChat.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
Build failed !!!.
だから私は今、解決策がthisかもしれないと思います。私はsshキーを追加することについてたくさん知りません。
これはPhoenixのHTTPポートには問題ありません。これは、PostgreSQLがCIサーバのlocalhost:5432上で実行されていないためです。おそらく、別のポートでPostgreSQLを実行する場合は、CIのどこかで有効にするか、設定を変更する必要があります。コンフィグ 'にdev.exs''で設定を変更する – Dogbert
@Dogbertう:phoenix_chat、PhoenixChat.Repo、 アダプタ:Ecto.Adapters.Postgres、 ユーザ名: "のpostgres"、 パスワード: "postgresの"、 データベース: " phoenix_chat_dev "、 ホスト名:" localhost:5432 "、 pool_size:10'は正しい方向にありますか? (それは違いはありません - 同じエラー) - ホスト名は – BeniaminoBaggins
でした。これは 'hostname:" localhost "、port:5432、...'でなければなりませんが、5432がデフォルトで、PostgreSQLは_not_ running localhost:5432で。 PostgreSQLがCIサーバ上で実行されているホスト/ポートが見つかるはずです。デフォルトでは無効になっています(TravisなどでPostgreSQLを有効にするには、設定を追加する必要があります):https://docs.travis-ci.com/user/データベースセットアップ/#PostgreSQL)。 – Dogbert