我无法让我的Phoenix 1.2应用程序在Heroku CI上运行。
似乎它正在尝试创建一个新数据库,即使我配置了一个别名,它仍在执行ecto.create
。
这是Heroku CI输出:
-----> Running Elixir buildpack tests... 10:25:25.751 [warn] Warning: No valid AppSignal configuration found, continuing with AppSignal metrics disabled. 10:25:26.071 [error] GenServer #PID<0.903.0> terminating
** (Postgrex.Error) FATAL (insufficient_privilege): permission denied for database "template1" User does not have CONNECT privilege.
(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 PhenixDisplays.Repo couldn't be created: FATAL (insufficient_privilege): permission denied for database "template1" User does not have CONNECT privilege.
-----> Elixir buildpack tests failed with exit status 1
我的mix.exs
别名功能
defp aliases do
[
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"test": ["ecto.migrate", "test"]
]
end
我的回购设置在test.exs
config :phenix_displays, PhenixDisplays.Repo,
adapter: Ecto.Adapters.Postgres,
url: System.get_env("DATABASE_URL") || "postgres://postgres:postgres@localhost:5432/phenix_displays_test",
pool: Ecto.Adapters.SQL.Sandbox,
extensions: [{Geo.PostGIS.Extension, library: Geo}, {PhenixDisplays.Postgrex.Box2D, []}]
答案 0 :(得分:0)
可能是mix ecto.setup
被调用作为运行测试的准备工作的一部分。 HerokuCI似乎使用app.json
文件来配置您的测试。这是我在https://devcenter.heroku.com/articles/heroku-ci
{
"environments": {
"test": {
"scripts": {
"test-setup": "gem install rubocop",
"test": "rubocop ."
}
}
}
}
确保配置了正确的test-setup
并确保它只运行您希望它运行的命令。