Skip to content

Commit e5888e7

Browse files
mobileoverlordJosé Valim
authored andcommitted
Add RELEASE_BOOT_SCRIPT and RELEASE_BOOT_SCRIPT_CLEAN (#9132)
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent 13af842 commit e5888e7

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

lib/mix/lib/mix/tasks/release.ex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,18 @@ defmodule Mix.Tasks.Release do
667667
not running on Erlang/OTP 22 or later, you must set `RELEASE_NODE`
668668
to `RELEASE_NAME@127.0.0.1` with an IP or a known host
669669
670+
* `RELEASE_BOOT_SCRIPT` - the name of the boot script to use when starting
671+
the release. This script is used when running commands such as `start` and
672+
`daemon`. The boot script is expected to be located at the
673+
path `releases/RELEASE_VSN/RELEASE_BOOT_SCRIPT.boot`. Defaults to `start`
674+
675+
* `RELEASE_BOOT_SCRIPT_CLEAN` - the name of the boot script used when
676+
starting the release clean, without your application or its dependencies.
677+
This script is used by commands such as `eval`, `rpc`, and `remote`.
678+
The boot script is expected to be located at the path
679+
`releases/RELEASE_VSN/RELEASE_BOOT_SCRIPT_CLEAN.boot`. Defaults
680+
to `start_clean`
681+
670682
## Umbrellas
671683
672684
Releases are well integrated with umbrella projects, allowing you to

lib/mix/lib/mix/tasks/release.init.ex

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ defmodule Mix.Tasks.Release.Init do
9494
export RELEASE_TMP="${RELEASE_TMP:-"$RELEASE_ROOT/tmp"}"
9595
export RELEASE_VM_ARGS="${RELEASE_VM_ARGS:-"$REL_VSN_DIR/vm.args"}"
9696
export RELEASE_DISTRIBUTION="${RELEASE_DISTRIBUTION:-"sname"}"
97+
export RELEASE_BOOT_SCRIPT="${RELEASE_BOOT_SCRIPT:-"start"}"
98+
export RELEASE_BOOT_SCRIPT_CLEAN="${RELEASE_BOOT_SCRIPT_CLEAN:-"start_clean"}"
9799
98100
rand () {
99101
od -t xS -N 2 -A n /dev/urandom | tr -d " \n"
@@ -103,7 +105,7 @@ defmodule Mix.Tasks.Release.Init do
103105
exec "$REL_VSN_DIR/elixir" \
104106
--hidden --cookie "$RELEASE_COOKIE" \
105107
--$RELEASE_DISTRIBUTION "rpc-$(rand)-$RELEASE_NODE" \
106-
--boot "$REL_VSN_DIR/start_clean" \
108+
--boot "$REL_VSN_DIR/$RELEASE_BOOT_SCRIPT_CLEAN" \
107109
--boot-var RELEASE_LIB "$RELEASE_ROOT/lib" \
108110
--rpc-eval "$RELEASE_NODE" "$1"
109111
}
@@ -117,7 +119,7 @@ defmodule Mix.Tasks.Release.Init do
117119
--$RELEASE_DISTRIBUTION "$RELEASE_NODE" \
118120
--erl "-mode $RELEASE_MODE" \
119121
--erl-config "$RELEASE_SYS_CONFIG" \
120-
--boot "$REL_VSN_DIR/start" \
122+
--boot "$REL_VSN_DIR/$RELEASE_BOOT_SCRIPT" \
121123
--boot-var RELEASE_LIB "$RELEASE_ROOT/lib" \
122124
--vm-args "$RELEASE_VM_ARGS" "$@"
123125
}
@@ -164,7 +166,7 @@ defmodule Mix.Tasks.Release.Init do
164166
exec "$REL_VSN_DIR/elixir" \
165167
--cookie "$RELEASE_COOKIE" \
166168
--erl-config "$RELEASE_SYS_CONFIG" \
167-
--boot "$REL_VSN_DIR/start_clean" \
169+
--boot "$REL_VSN_DIR/$RELEASE_BOOT_SCRIPT_CLEAN" \
168170
--boot-var RELEASE_LIB "$RELEASE_ROOT/lib" \
169171
--vm-args "$RELEASE_VM_ARGS" --eval "$2"
170172
;;
@@ -173,7 +175,7 @@ defmodule Mix.Tasks.Release.Init do
173175
exec "$REL_VSN_DIR/iex" \
174176
--werl --hidden --cookie "$RELEASE_COOKIE" \
175177
--$RELEASE_DISTRIBUTION "rem-$(rand)-$RELEASE_NODE" \
176-
--boot "$REL_VSN_DIR/start_clean" \
178+
--boot "$REL_VSN_DIR/$RELEASE_BOOT_SCRIPT_CLEAN" \
177179
--boot-var RELEASE_LIB "$RELEASE_ROOT/lib" \
178180
--remsh "$RELEASE_NODE"
179181
;;
@@ -256,6 +258,8 @@ defmodule Mix.Tasks.Release.Init do
256258
if not defined RELEASE_TMP (set RELEASE_TMP=!RELEASE_ROOT!\tmp)
257259
if not defined RELEASE_VM_ARGS (set RELEASE_VM_ARGS=!REL_VSN_DIR!\vm.args)
258260
if not defined RELEASE_DISTRIBUTION (set RELEASE_DISTRIBUTION=sname)
261+
if not defined RELEASE_BOOT_SCRIPT (set RELEASE_BOOT_SCRIPT=start)
262+
if not defined RELEASE_BOOT_SCRIPT (set RELEASE_BOOT_SCRIPT_CLEAN=start_clean)
259263
set RELEASE_SYS_CONFIG=!REL_VSN_DIR!\sys
260264
261265
if "%~1" == "start" (set "REL_EXEC=elixir" && set "REL_EXTRA=--no-halt" && set "REL_GOTO=start")
@@ -321,7 +325,7 @@ defmodule Mix.Tasks.Release.Init do
321325
--!RELEASE_DISTRIBUTION! "!RELEASE_NODE!" ^
322326
--erl "-mode !RELEASE_MODE!" ^
323327
--erl-config "!RELEASE_SYS_CONFIG!" ^
324-
--boot "!REL_VSN_DIR!\start" ^
328+
--boot "!REL_VSN_DIR!\!RELEASE_BOOT_SCRIPT!" ^
325329
--boot-var RELEASE_LIB "!RELEASE_ROOT!\lib" ^
326330
--vm-args "!RELEASE_VM_ARGS!"
327331
goto end
@@ -331,7 +335,7 @@ defmodule Mix.Tasks.Release.Init do
331335
--eval "%~2" ^
332336
--cookie "!RELEASE_COOKIE!" ^
333337
--erl-config "!RELEASE_SYS_CONFIG!" ^
334-
--boot "!REL_VSN_DIR!\start_clean" ^
338+
--boot "!REL_VSN_DIR!\!RELEASE_BOOT_SCRIPT_CLEAN!" ^
335339
--boot-var RELEASE_LIB "!RELEASE_ROOT!\lib" ^
336340
--vm-args "!RELEASE_VM_ARGS!"
337341
goto end
@@ -340,7 +344,7 @@ defmodule Mix.Tasks.Release.Init do
340344
"!REL_VSN_DIR!\iex.bat" ^
341345
--werl --hidden --cookie "!RELEASE_COOKIE!" ^
342346
--!RELEASE_DISTRIBUTION! "rem-!RANDOM!-!RELEASE_NODE!" ^
343-
--boot "!REL_VSN_DIR!\start_clean" ^
347+
--boot "!REL_VSN_DIR!\!RELEASE_BOOT_SCRIPT_CLEAN!" ^
344348
--boot-var RELEASE_LIB "!RELEASE_ROOT!\lib" ^
345349
--remsh "!RELEASE_NODE!"
346350
goto end
@@ -349,7 +353,7 @@ defmodule Mix.Tasks.Release.Init do
349353
"!REL_VSN_DIR!\elixir.bat" ^
350354
--hidden --cookie "!RELEASE_COOKIE!" ^
351355
--!RELEASE_DISTRIBUTION! "rpc-!RANDOM!-!RELEASE_NODE!" ^
352-
--boot "!REL_VSN_DIR!\start_clean" ^
356+
--boot "!REL_VSN_DIR!\!RELEASE_BOOT_SCRIPT_CLEAN!" ^
353357
--boot-var RELEASE_LIB "!RELEASE_ROOT!\lib" ^
354358
--rpc-eval "!RELEASE_NODE!" "!REL_RPC!"
355359
goto end

0 commit comments

Comments
 (0)