-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ac069e
commit 6025ee5
Showing
4 changed files
with
62 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ CONTRIBUTING.md | |
schema1.svg | ||
.github | ||
|
||
/scripts | ||
/examples | ||
|
||
# test & debug files | ||
|
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ARG from | ||
FROM $from | ||
|
||
COPY ./dev-chain/cli /root/.mesg-cli | ||
COPY ./dev-chain/validator /root/.mesg-node | ||
COPY ./scripts/dev-cli.sh . | ||
|
||
CMD ["bash", "dev-cli.sh"] |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# turn on bash's job control | ||
set -m | ||
|
||
# start daemon | ||
mesg-daemon start & | ||
daemon=$! | ||
|
||
# wait 5 sec for the daemon to start rpc server | ||
sleep 5 & | ||
wait $! | ||
|
||
# start lcd | ||
mesg-cli rest-server --laddr tcp://0.0.0.0:1317 & | ||
lcd=$! | ||
|
||
# start orchestrator | ||
mesg-cli orchestrator start & | ||
orchestrator=$! | ||
|
||
# this variable is used to control the monitoring of the child process | ||
monitoring=true | ||
|
||
# function that stop child processes | ||
function stop { | ||
monitoring=false | ||
echo "stopping all child processes" | ||
kill $daemon $lcd $orchestrator | ||
wait $daemon $lcd $orchestrator | ||
} | ||
|
||
# trap both sigint (ctrl+c) and sigterm (OS ask process to be stopped) | ||
trap stop SIGINT | ||
trap stop SIGTERM | ||
|
||
# start the monitoring loop | ||
while $monitoring | ||
do | ||
# check if all sub processes are running correctly | ||
if [[ -n "$(ps -p $daemon -o pid=)" ]] && [[ -n "$(ps -p $lcd -o pid=)" ]] && [[ -n "$(ps -p $orchestrator -o pid=)" ]]; then | ||
sleep 2 & | ||
wait $! | ||
else | ||
# if one child process is not running, stopping all of them and exit with error code 1 | ||
echo "one child process is not running" | ||
stop | ||
exit 1 | ||
fi | ||
done |