Elixir 使用蒸馏器使用单个文件部署? 背景
我现在需要部署一个OTP应用程序。为了实现这一点,我使用了酿酒厂。我的目标是向PROD机器传递一个自给自足的文件,该文件包含所有内容,不需要提取 通常的路线 大多数使用酿酒厂的人都知道通常的路线:Elixir 使用蒸馏器使用单个文件部署? 背景,elixir,distillery,Elixir,Distillery,我现在需要部署一个OTP应用程序。为了实现这一点,我使用了酿酒厂。我的目标是向PROD机器传递一个自给自足的文件,该文件包含所有内容,不需要提取 通常的路线 大多数使用酿酒厂的人都知道通常的路线: 运行MIX\u ENV=prod MIX release 将build/prod/rel//releases//.tar.gz中的tarball复制到部署服务器 拔跗骨 运行代码 客观的 我的目标是消除步骤3。我不想提取任何东西,我只想复制发行版并运行它,就像sudo可执行文件一样 –可执行文件 根据
MIX\u ENV=prod MIX release
build/prod/rel//releases//.tar.gz
中的tarball复制到部署服务器MIX\u ENV=prod MIX release--executable
或MIX\u ENV=prod MIX release--transient
。这将创建一个不需要提取的伪可执行文件
问题:
但是,在运行MIX\u ENV=prod MIX release--executable
命令后,我通常搜索文件build/prod/rel//releases//.run
。理论上,这应该是我需要复制到部署服务器中的文件,但我在任何地方都找不到它
- 我需要将哪个文件复制到部署服务器中,它在哪里
mix new test_executable --sup
mix.exs
mix release.init
env MIX_ENV=prod mix release --executable
获得以下输出:
==> Assembling release..
==> Building release test_executable:0.1.0 using environment prod
==> Including ERTS 10.2 from /usr/local/Cellar/erlang/21.2/lib/erlang/erts-10.2
==> Packaging release..
Release successfully built!
To start the release you have built, you can use one of the following tasks:
# start a shell, like 'iex -S mix'
> _build/prod/rel/test_executable/bin/test_executable.run console
# start in the foreground, like 'mix run --no-halt'
> _build/prod/rel/test_executable/bin/test_executable.run foreground
# start in the background, must be stopped with the 'stop' command
> _build/prod/rel/test_executable/bin/test_executable.run start
If you started a release elsewhere, and wish to connect to it:
# connects a local shell to the running node
> _build/prod/rel/test_executable/bin/test_executable.run remote_console
# connects directly to the running node's console
> _build/prod/rel/test_executable/bin/test_executable.run attach
For a complete listing of commands and their use:
> _build/prod/rel/test_executable/bin/test_executable.run help
cp _build/prod/rel/test_executable/bin/test_executable.run /tmp
cd /tmp
./test_executable.run console
Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]
Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(test_executable@127.0.0.1)1>
试着仔细检查你在做什么。作为参考,我刚刚试过这个,效果很好。我使用的是Elixir1.7.4和Dillery2.0.12 以下是我所做的:
mix new test_executable --sup
mix.exs
mix release.init
env MIX_ENV=prod mix release --executable
获得以下输出:
==> Assembling release..
==> Building release test_executable:0.1.0 using environment prod
==> Including ERTS 10.2 from /usr/local/Cellar/erlang/21.2/lib/erlang/erts-10.2
==> Packaging release..
Release successfully built!
To start the release you have built, you can use one of the following tasks:
# start a shell, like 'iex -S mix'
> _build/prod/rel/test_executable/bin/test_executable.run console
# start in the foreground, like 'mix run --no-halt'
> _build/prod/rel/test_executable/bin/test_executable.run foreground
# start in the background, must be stopped with the 'stop' command
> _build/prod/rel/test_executable/bin/test_executable.run start
If you started a release elsewhere, and wish to connect to it:
# connects a local shell to the running node
> _build/prod/rel/test_executable/bin/test_executable.run remote_console
# connects directly to the running node's console
> _build/prod/rel/test_executable/bin/test_executable.run attach
For a complete listing of commands and their use:
> _build/prod/rel/test_executable/bin/test_executable.run help
cp _build/prod/rel/test_executable/bin/test_executable.run /tmp
cd /tmp
./test_executable.run console
Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]
Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(test_executable@127.0.0.1)1>