mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Improve chain start speed
On a dev machine, this reduces a chain restart (./scripts/cosm/stop.sh && ./scripts/cosm/start.sh) from 18.5 seconds to 2.7 seconds.
This commit is contained in:
parent
82447e8afe
commit
fa1a9671db
@ -15,10 +15,6 @@ echo "Using temporary dir $TMP_DIR"
|
|||||||
WASMD_LOGFILE="$TMP_DIR/wasmd.log"
|
WASMD_LOGFILE="$TMP_DIR/wasmd.log"
|
||||||
REST_SERVER_LOGFILE="$TMP_DIR/rest-server.log"
|
REST_SERVER_LOGFILE="$TMP_DIR/rest-server.log"
|
||||||
|
|
||||||
# pull the newest copy of the docker image
|
|
||||||
# this is important as the sleep timeout below will fail on first run (downloading entire docker stack usually > 10s)
|
|
||||||
docker pull "$REPOSITORY:$VERSION"
|
|
||||||
|
|
||||||
# This starts up wasmd
|
# This starts up wasmd
|
||||||
docker volume rm -f wasmd_data
|
docker volume rm -f wasmd_data
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
@ -35,12 +31,10 @@ docker run --rm \
|
|||||||
echo "wasmd running and logging into $WASMD_LOGFILE"
|
echo "wasmd running and logging into $WASMD_LOGFILE"
|
||||||
|
|
||||||
# Debug chain start
|
# Debug chain start
|
||||||
sleep 3
|
# sleep 3 && cat "$WASMD_LOGFILE"
|
||||||
cat "$WASMD_LOGFILE"
|
|
||||||
|
|
||||||
sleep 10
|
# Use a large timeout because of potentially long image download in `docker run`
|
||||||
|
if ! timeout 120 bash -c "until docker inspect -f '{{.State.Running}}' '$CONTAINER_NAME' &> /dev/null; do sleep 0.5; done"; then
|
||||||
if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME")" != "true" ]; then
|
|
||||||
echo "Container named '$CONTAINER_NAME' not running. We cannot continue." \
|
echo "Container named '$CONTAINER_NAME' not running. We cannot continue." \
|
||||||
"This can happen when 'docker run' needs too long to download and start." \
|
"This can happen when 'docker run' needs too long to download and start." \
|
||||||
"It might be worth retrying this step once the image is in the local docker cache."
|
"It might be worth retrying this step once the image is in the local docker cache."
|
||||||
@ -58,5 +52,4 @@ docker exec "$CONTAINER_NAME" \
|
|||||||
echo "rest server running on http://localhost:1317 and logging into $REST_SERVER_LOGFILE"
|
echo "rest server running on http://localhost:1317 and logging into $REST_SERVER_LOGFILE"
|
||||||
|
|
||||||
# Debug rest server start
|
# Debug rest server start
|
||||||
sleep 3
|
# sleep 3 && cat "$REST_SERVER_LOGFILE"
|
||||||
cat "$REST_SERVER_LOGFILE"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user