使用 edeliver 和 distillery 构建升级版本
Build upgrade release with edeliver and distillery
版本:(构建和生产系统都相同)
长生不老药:1.4.0
OS:Ubuntu 14.04 LTS
酿酒厂配置:
use Mix.Releases.Config,
default_release: :default,
default_environment: :prod
environment :dev do
set dev_mode: true
set include_erts: false
set cookie: :"cookie"
end
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"cookie"
end
release :my_app do
set version: current_version(:my_app)
end
交付配置:
APP="my_app"
AUTO_VERSION=git-revision+build-date
BUILD_HOST="my_build_host"
BUILD_USER="deployer"
BUILD_AT="/tmp/my_app"
PRODUCTION_HOSTS="same_as_build_host"
PRODUCTION_USER="deployer"
DELIVER_TO="/home/my_app"
# For *Phoenix* projects, symlink prod.secret.exs to our tmp source
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/xxx/config/prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}
我的初始版本成功 mix edeliver update production --branch=development --start-deploy
,应用程序运行良好。当我尝试热代码重新加载时,
mix edeliver build upgrade --branch=development
命令失败
build command requires --from= or --with argument.
当有 AUTO_VERSION
或我错过任何配置时,edeliver
不应该处理这个问题吗?
另外,执行命令mix edeliver upgrade production --branch=development --verbose
,导致错误
==> Upgrade from 0.0.1+297b4ff-20170221 to 0.0.1+f9ffa04-20170222 failed:
0.0.1+297b4ff-20170221 does not exist at _build/prod/rel/my_app/releases/0.0.1+297b4ff-20170221
==> Failed to build release:
:bad_upgrade_spec
A remote command failed on:
deployer@my_host
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/jn
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="jn" AUTO_VERSION="git-revision+build-date" BRANCH="development" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do release.version --verbose, release --verbose --env="prod" --name="jn" --upgrade --upfrom="0.0.1+297b4ff-20170221"
fi
mix edeliver upgrade production --branch=development --verbose
上的那个错误看起来你的版本存储中没有以前的版本。
您可以尝试再次构建该版本,将其部署到您的服务器并尝试升级。
希望对您有所帮助:)
我前段时间研究过这个,但我无法让它开箱即用。我最终自己做了副本(符号 link):
.deliver/config
# Fix
# ==> Upgrade from 0.0.3+71-7a01b46 to 0.0.4+87-6c98597 failed:
# 0.0.3+71-7a01b46 does not exist at _build/prod/rel/...
pre_erlang_generate_release() {
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$REL_DIR' '$BUILD_AT/_build/prod/'
"
fi
}
这个钩子在版本构建之后和 erlang 生成升级之前执行。
糟糕。该问题与 https://github.com/boldpoker/edeliver/issues/182 有关。
版本:(构建和生产系统都相同)
长生不老药:1.4.0
OS:Ubuntu 14.04 LTS
酿酒厂配置:
use Mix.Releases.Config,
default_release: :default,
default_environment: :prod
environment :dev do
set dev_mode: true
set include_erts: false
set cookie: :"cookie"
end
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"cookie"
end
release :my_app do
set version: current_version(:my_app)
end
交付配置:
APP="my_app"
AUTO_VERSION=git-revision+build-date
BUILD_HOST="my_build_host"
BUILD_USER="deployer"
BUILD_AT="/tmp/my_app"
PRODUCTION_HOSTS="same_as_build_host"
PRODUCTION_USER="deployer"
DELIVER_TO="/home/my_app"
# For *Phoenix* projects, symlink prod.secret.exs to our tmp source
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/xxx/config/prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}
我的初始版本成功 mix edeliver update production --branch=development --start-deploy
,应用程序运行良好。当我尝试热代码重新加载时,
mix edeliver build upgrade --branch=development
命令失败
build command requires --from= or --with argument.
当有 AUTO_VERSION
或我错过任何配置时,edeliver
不应该处理这个问题吗?
另外,执行命令mix edeliver upgrade production --branch=development --verbose
,导致错误
==> Upgrade from 0.0.1+297b4ff-20170221 to 0.0.1+f9ffa04-20170222 failed:
0.0.1+297b4ff-20170221 does not exist at _build/prod/rel/my_app/releases/0.0.1+297b4ff-20170221
==> Failed to build release:
:bad_upgrade_spec
A remote command failed on:
deployer@my_host
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/jn
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="jn" AUTO_VERSION="git-revision+build-date" BRANCH="development" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do release.version --verbose, release --verbose --env="prod" --name="jn" --upgrade --upfrom="0.0.1+297b4ff-20170221"
fi
mix edeliver upgrade production --branch=development --verbose
上的那个错误看起来你的版本存储中没有以前的版本。
您可以尝试再次构建该版本,将其部署到您的服务器并尝试升级。
希望对您有所帮助:)
我前段时间研究过这个,但我无法让它开箱即用。我最终自己做了副本(符号 link):
.deliver/config
# Fix
# ==> Upgrade from 0.0.3+71-7a01b46 to 0.0.4+87-6c98597 failed:
# 0.0.3+71-7a01b46 does not exist at _build/prod/rel/...
pre_erlang_generate_release() {
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$REL_DIR' '$BUILD_AT/_build/prod/'
"
fi
}
这个钩子在版本构建之后和 erlang 生成升级之前执行。
糟糕。该问题与 https://github.com/boldpoker/edeliver/issues/182 有关。