当我使用edeliver为Elixir/Phoenix应用程序设置Ubuntu16.04服务器时,edeliver失败并返回错误消息** (Mix) The task "release" could not be found和退出代码1。如果我转到我的构建服务器,git拉出我的应用程序并在获取依赖项后运行MIX_ENV=prod mix release或mix release,我得到了相同的错误。
但是,相同的应用程序在本地运行时没有任何问题。
在服务器和本地计算机上,我的erlang版本是erts-9.0,而elixir版本是1.5.5。十六进制版本在0.16.1上也是一样的。
Phoenix是使用以下命令安装的:mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez。
这是我的mix.exs文件。
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[
app: :MyApp,
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {MyApp.Application, []},
extra_applications: [:comeonin, :logger, :runtime_tools, :earmark, :distillery, :edeliver]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.3.0"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:mariaex, ">= 0.0.0"},
{:phoenix_html, "~> 2.10"},
{:comeonin, "~> 4.0"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:earmark, "~> 1.2.3"},
{:cowboy, "~> 1.0"},
{:edeliver, "~> 1.4.4"},
{:distillery, "~> 1.5.1"}
]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to create, migrate and run the seeds file at once:
#
# $ mix ecto.setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"test": ["ecto.create --quiet", "ecto.migrate", "test"]
]
end
end我的edeliver配置文件.deliver/config如下:
APP="MyApp"
BUILD_HOST="1.1.1.1"
BUILD_USER="ubuntu"
BUILD_AT="/home/ubuntu/app_build"
PRODUCTION_HOSTS="1.1.1.1"
PRODUCTION_USER="ubuntu"
DELIVER_TO="/home/ubuntu/app_release"
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/ubuntu/app_config/prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}发布于 2018-12-28 04:03:25
TLDR:明确指出分支,并确保git下/rel/文件夹已提交:
$ mix edeliver build release --branch=feature/deploy我也有过类似的错误:** (Mix) The task "release" could not be found,当我试图找到解决方案时,这个未解决的讨论多次引起了我的注意。我意识到,混合任务release在/rel/config.exs中。如果您使用所有教程中提到的命令$ mix edeliver build release,edeliver将获得master分支版本(无论您尝试从哪个分支构建)。
发布于 2017-08-22 21:33:07
据我所知,您正在使用edeliver将应用程序交付到服务器。那你为什么要从服务器上运行任何东西呢?
另外,release任务应该从哪里来?我相信,你的意思是这样的:
mix edeliver build release
mix edeliver deploy release to production
mix edeliver restart production这是使用edeliver构建、部署和重启生产的标准流程。不幸的是,上面的三个命令不能直接使用,你需要为phoenix项目显式地设置edeliver (有很多很好的教程)。
发布于 2017-08-28 18:27:13
我遇到的问题是我忘了把最新的修改推到git上,它确实是从git获取源代码的。所以在添加edeliver之后,它找不到它生成的任何文件。通过将其推送到git,它现在对我起作用了。
https://stackoverflow.com/questions/45818589
复制相似问题