Merge pull request #45 from confio/speedup-chain-start

Improve chain start speed
This commit is contained in:
Ethan Frey 2020-02-05 10:21:20 +01:00 committed by GitHub
commit 4f3bbb8001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View File

@ -70,7 +70,8 @@ jobs:
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run: # wait until cosm scripts have fully started (this includes time for docker pull)
- run:
name: Wait for blockchain and REST server to be ready (started in background)
command: timeout 60 bash -c "until curl -s http://localhost:1317/node_info > /dev/null; do sleep 1; done"
- run:
environment:

View File

@ -15,10 +15,6 @@ echo "Using temporary dir $TMP_DIR"
WASMD_LOGFILE="$TMP_DIR/wasmd.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
docker volume rm -f wasmd_data
docker run --rm \
@ -35,12 +31,10 @@ docker run --rm \
echo "wasmd running and logging into $WASMD_LOGFILE"
# Debug chain start
sleep 3
cat "$WASMD_LOGFILE"
# sleep 3 && cat "$WASMD_LOGFILE"
sleep 10
if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME")" != "true" ]; then
# 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
echo "Container named '$CONTAINER_NAME' not running. We cannot continue." \
"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."
@ -57,6 +51,10 @@ docker exec "$CONTAINER_NAME" \
echo "rest server running on http://localhost:1317 and logging into $REST_SERVER_LOGFILE"
# Give REST server some time to come alive. No idea why this helps. Needed for CI.
if [ -n "${CI:-}" ]; then
sleep 0.5
fi
# Debug rest server start
sleep 3
cat "$REST_SERVER_LOGFILE"
# sleep 3 && cat "$REST_SERVER_LOGFILE"