我第一次玩 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,尽管我不确定我会在哪里这样做。