我正在研究几个不同的How(该项目的主要部分加上几个通过谷歌搜索)来部署代码,但我找不到解决这个Could not invoke task "distillery.release": 1 error found!问题的解决方案:
$ mix edeliver build release
BUILDING RELEASE OF HELLO_WORLD APP ON BUILD HOST
-----> Authorizing hosts
-----> Ensuring hosts are ready to accept git pushes
-----> Pushing new commits with git to: abc@company.com
-----> Resetting remote hosts to b8a7e8d2098b228f693352a0ebc59fa5c708f7a3
-----> Cleaning generated files from last build
-----> Updating git submodules
-----> Fetching / Updating dependencies
-----> Compiling sources
-----> Generating release
using mix to generate release
** (Mix) Could not invoke task "distillery.release": 1 error found!
--verbosity : Unknown option
A remote command failed on:
abc@company.com
Output of the command is shown above and the command executed
on that host is printed below for debugging purposes:
FAILED with exit status 1:
[ -f ~/.profile ] && source ~/.profile
set -e
cd /tmp/erlang/hello-world/builds
if [ "mix" = "rebar" ]; then
echo "using rebar to generate release"
./rebar -f generate
elif [ "mix" = "relx" ]; then
echo "using relx to generate release"
./relx release
elif [ "mix" = "mix" ]; then
echo "using mix to generate release"
MIX_ENV="prod" LINK_SYS_CONFIG="" LINK_VM_ARGS="" APP="hello_world" AUTO_VERSION="commit-count+git-revision+branch-unless-master" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="" mix do release.version , distillery.release --verbosity=verbose
fi设置
$ mix phx.new hello_world --no-ectomix.exs
...
def application do
[
mod: {HelloWorld.Application, []},
extra_applications: [:logger, :runtime_tools, :edeliver]
]
end
...
defp deps do
[
{:phoenix, "~> 1.4.16"},
{:phoenix_pubsub, "~> 1.1"},
{:phoenix_html, "~> 2.11"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:gettext, "~> 0.11"},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},
{:edeliver, ">= 1.8.0"},
{:distillery, "~> 2.1", warn_missing: false}
]
end
....deliver/config
APP="hello_world" # name of your release
# The applicationis build here:
BUILD_HOST="www.hello-world.de" # host where to build the release
BUILD_USER="deployer" # local user at build host
BUILD_AT="/tmp/erlang/hello-world/builds" # build directory on build host
# Staging
STAGING_HOSTS=""
STAGING_USER=""
# This is the place where it's going to be hosted:
PRODUCTION_HOSTS="www.hello-world.de" # deploy / production hosts separated by space
PRODUCTION_USER="deployer" # local user at deploy hosts
DELIVER_TO="/home/deployer/phoenix-systems" # deploy directory on production hosts
AUTO_VERSION=commit-count+git-revision+branch-unless-master # https://github.com/edeliver/edeliver/wiki/Auto-Versioning
# For *Phoenix* projects, symlink prod.secret.exs to our tmp source
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/deployer/hello-world.prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}其他:
$ mix do deps.get, compile
$ echo ".deliver/releases/" >> .gitignore
$ git init
$ git add -a
$ git commit -m "Setting up edeliver"我将/home/deployer/hello-world.prod.secret.exs复制到生成和生产服务器。
$ mix release.init
* creating rel/vm.args.eex
* creating rel/env.sh.eex
* creating rel/env.bat.eex
$ git add .
$ git commit -m "release config"而不是启动mix edeliver build release并得到错误。
发布于 2020-03-16 09:31:43
有关项目如下:
** (Mix) Could not invoke task "distillery.release": 1 error found!
--verbosity : Unknown option因为--verbosity选项是已弃用 in v2。
每家酿酒厂文件:
--verbosity标志不再存在,请使用--silent、--quiet或--verbose。
它会看到未被识别的选项,但失败了。不幸的是,它恰好出现在delivery本身提供的shell脚本中(对吗?或者是你的?)。
MIX_ENV="prod" [...] mix do release.version , distillery.release --verbosity=verbose无论如何,构建服务器上似乎有些混乱。我不知道为什么这是不一致的,但也许全面清理会有帮助。
发布于 2020-03-27 01:33:44
解决办法很简单:
mix distillery.initAPP变量在.deliver/config中必须与rel/config.exs中的释放原子相同。发布于 2020-03-16 09:41:55
添加这个文件后加上一个git add . && git commit -m "test"解决了这个问题。
解决=是一项工作。
rel/config
# Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))
use Distillery.Releases.Config,
# This sets the default release built by `mix distillery.release`
default_release: :hello_world,
# This sets the default environment used by `mix distillery.release`
default_environment: Mix.env()
# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/config/distillery.html
# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile
environment :dev do
# If you are running Phoenix, you should make sure that
# server: true is set and the code reloader is disabled,
# even in dev mode.
# It is recommended that you build with MIX_ENV=prod and pass
# the --env flag to Distillery explicitly if you want to use
# dev mode.
set dev_mode: true
set include_erts: false
set cookie: :"BNCsY8N!n{HeSZ[e_;mefm[~h>}|cU)0e6gJvkV5oh;Die$e:UC/O>Uh*6hG|<k("
end
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"?4t`!aFwp]@4zosVIBfaIG.^u(BX^nS=Rq}v2u&v0;mRvABjI.TdP*QLKo$rYpa="
end
# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix distillery.release`, the first release in the file
# will be used by default
release :hello_world do
set version: current_version(:hello_world)
set applications: [
:runtime_tools
]
endhttps://stackoverflow.com/questions/60703154
复制相似问题