docker: replace bash shells with last command

It is better to replace bash shell with potentially long-running
last script command. This way the running command will receive all
potential unix process signals directly.

A concrete example which motivated this change:
Exec of btcd is needed for graceful shutdown of btcd during
`docker-compose down`. Docker Compose properly sends this signal to our
start-btcd.sh bash shell but it is not further signalled to the running
btcd process. Docker Compose then kills whole container forcefully after
some timeout.

An alternative solution would be to trap SIGTERM in our bash script and
forward it to running btcd. Which would be IMO ugly and error prone.
This commit is contained in:
Antonin Hildebrand 2018-03-21 19:09:29 +01:00 committed by Olaoluwa Osuntokun
parent c8e0eeaa83
commit 132c67d414
5 changed files with 5 additions and 5 deletions

@ -43,7 +43,7 @@ RPCUSER=$(set_default "$RPCUSER" "devuser")
RPCPASS=$(set_default "$RPCPASS" "devpass")
NETWORK=$(set_default "$NETWORK" "simnet")
btcctl \
exec btcctl \
"--$NETWORK" \
--rpccert="/rpc/rpc.cert" \
--rpcuser="$RPCUSER" \

@ -67,5 +67,5 @@ PARAMS="$PARAMS $@"
# Print command and start bitcoin node.
echo "Command: btcd $PARAMS"
btcd $PARAMS
exec btcd $PARAMS

@ -49,7 +49,7 @@ if [[ "$CHAIN" == "litecoin" ]]; then
BACKEND="ltcd"
fi
lnd \
exec lnd \
--noencryptwallet \
--logdir="/data" \
"--$CHAIN.active" \

@ -43,7 +43,7 @@ RPCUSER=$(set_default "$RPCUSER" "devuser")
RPCPASS=$(set_default "$RPCPASS" "devpass")
NETWORK=$(set_default "$NETWORK" "simnet")
ltcctl \
exec ltcctl \
"--$NETWORK" \
--rpccert="/rpc/rpc.cert" \
--rpcuser="$RPCUSER" \

@ -67,5 +67,5 @@ PARAMS="$PARAMS $@"
# Print command and start bitcoin node.
echo "Command: ltcd $PARAMS"
ltcd $PARAMS
exec ltcd $PARAMS