forked from 2600hz/kazoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rel-migrate: test release migration function (2600hz#3666)
* rel-migrate: test release migration function * rel-migrate: check return values * rel-migrate: more checks * show sup command as it is run * error when error.log is non-empty * rel-migrate: use the real sup * rel-migrate: introduce sup:in_kazoo * rel-migrate: pass normal errors
Showing
10 changed files
with
101 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
{lib_dirs, ["../../deps", "../../core"]}. | ||
{escript_incl_apps, [getopt, kazoo, kazoo_stdlib, kazoo_config, zucchini, lager]}. | ||
{xref_checks, [ | ||
undefined_function_calls, | ||
deprecated_function_calls, | ||
locals_not_used | ||
]}. | ||
{erl_opts, [warn_export_all | ||
,warn_missing_spec | ||
,warnings_as_errors | ||
,debug_info | ||
,{parse_transform, lager_transform} | ||
]}. | ||
{xref_checks, [undefined_function_calls | ||
,deprecated_function_calls | ||
,locals_not_used | ||
]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
{application, sup, | ||
[ {description, "Accept RPC requests & push them into a running Kazoo VM"} | ||
, {vsn, "4.0.0"} | ||
, {modules, []} | ||
, {registered, []} | ||
, {applications, [ kernel | ||
, stdlib | ||
]} | ||
, {env, []} | ||
[{description, "Accept RPC requests & push them into a running Kazoo VM"} | ||
,{vsn, "4.0.0"} | ||
,{modules, []} | ||
,{registered, []} | ||
,{applications, [kernel | ||
,stdlib | ||
,getopt | ||
,kazoo | ||
,kazoo_stdlib | ||
,kazoo_config | ||
,zucchini | ||
,lager | ||
]} | ||
,{env, []} | ||
]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
[ | ||
{lager, [ | ||
{handlers, [ | ||
{lager_console_backend, [debug, | ||
{lager_default_formatter, | ||
[time, color, " [", severity, "] |", {callid,<<"0000000000">>}, "|", module,":",line, " (",pid,") ", "\e[0m", message, "\n"]}]} | ||
]} | ||
,{colored, true} | ||
,{error_logger_hwm, 5000} | ||
]} | ||
{lager, [ | ||
{handlers, [ | ||
{lager_console_backend, [debug, | ||
{lager_default_formatter, | ||
[time, color, " [", severity, "] |", {callid,<<"0000000000">>}, "|", module,":",line, " (",pid,") ", "\e[0m", message, "\n"]}]} | ||
,{lager_file_backend, [{file, "log/error.log"}, {level, error}, {size, 10485760}, {date, "$D0"}, {count, 5} | ||
,{formatter, lager_default_formatter} | ||
,{formatter_config, [time," [",severity,"] ", "|", {callid, <<"0000000000">>}, "|", module, ":", line, " (",pid, ") ", message, "\n"]} | ||
]} | ||
]} | ||
,{colored, true} | ||
,{error_logger_hwm, 5000} | ||
]} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
|
||
[[ ! -d _rel ]] && echo 'Cannot find _rel/ Is the release built?' && exit -1 | ||
|
||
echo 'Checking the startup of the release...' | ||
|
||
rel=${REL:-kazoo_apps} # kazoo_apps | ecallmgr | ... | ||
[[ $rel != *@* ]] && rel=$rel@127.0.0.1 | ||
|
||
[[ $rel != *@* ]] && rel=$rel@$(hostname -f) | ||
[[ $rel != kazoo_apps* ]] && export KAZOO_APPS='ecallmgr' | ||
|
||
function sup_() { | ||
local M=$1; shift | ||
local F=$1; shift | ||
declare -a a=() | ||
for arg in "$@"; do a+=( '<<"'"$arg"'">>' ); done | ||
IFS=, eval 'A=${a[*]}' | ||
erl -noshell -setcookie change_me -name sup_$RANDOM@${rel##*@} -eval "ok = rpc:call('$rel', $M, $F, [$A])." -s init stop | ||
echo "Checking release startup with node $rel..." | ||
|
||
sup_() { | ||
RELX_REPLACE_OS_VARS=true KZname="-name $rel" $PWD/_rel/kazoo/bin/kazoo escript lib/sup-*/priv/sup.escript "$*" | ||
} | ||
|
||
sleep 360 && sup_ crossbar_maintenance create_account 'compte_maitre' 'royaume' 'superduperuser' 'pwd!' & | ||
sleep 440 && sup_ init stop & | ||
script() { | ||
sup_ crossbar_maintenance create_account 'compte_maitre' 'royaume' 'superduperuser' 'pwd!' | ||
sleep 3 | ||
sup_ kapps_maintenance migrate | ||
sleep 3 | ||
sup_ kapps_maintenance migrate_to_4_0 | ||
sleep 3 | ||
sup_ init stop | ||
} | ||
|
||
sleep 240 && script & | ||
export KAZOO_CONFIG=$PWD/rel/ci-config.ini | ||
REL=$rel make release | ||
code=$? | ||
|
||
if [[ -f erl_crash.dump ]]; then | ||
echo A crash dump was generated! | ||
code=3 | ||
fi | ||
error_log=$PWD/_rel/kazoo/log/error.log | ||
if [[ $(grep -c -v -F 'exit with reason shutdown' $error_log) -gt 0 ]]; then | ||
echo | ||
echo Error log: | ||
cat $error_log | ||
code=4 | ||
fi | ||
exit $code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
Kazoo development scripts | ||
========================= | ||
# Kazoo development scripts | ||
|
||
```sh | ||
# Starts Kazoo and provide Erlang console | ||
scripts/dev/kazoo.sh | ||
## Starts Kazoo and provide Erlang console | ||
|
||
# Runs Kazoo sup wrapper | ||
scripts/dev/sup.sh | ||
```shell | ||
./scripts/dev/kazoo.sh | ||
``` | ||
|
||
Hot load code | ||
============= | ||
## Runs Kazoo sup wrapper | ||
|
||
```shell | ||
./scripts/dev/sup.sh | ||
``` | ||
|
||
## Hot load code | ||
|
||
In Kazoo Erlang shell: | ||
|
||
```erlang | ||
> lager:set_loglevel(lager_console_backend, info). | ||
> sync:go(). | ||
lager:set_loglevel(lager_console_backend, info). | ||
sync:go(). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters