diff --git a/Dockerfile b/Dockerfile index cecd711..72d4487 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:8-alpine WORKDIR /home/node -RUN apk add --no-cache curl git && \ +RUN apk add --no-cache curl git jq && \ git clone https://github.com/GPII/universal.git && \ cd universal && \ rm -f package-lock.json && \ diff --git a/loadData.sh b/loadData.sh index 0c521f7..f48b0a9 100755 --- a/loadData.sh +++ b/loadData.sh @@ -7,6 +7,16 @@ log() { echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" } +warm_indices(){ + log "Warming indices..." + + for view in $(curl -s $COUCHDB_URL/_design/views/ | jq -r '.views | keys[]'); do + curl -fsS $COUCHDB_URL/_design/views/_view/$view >/dev/null + done + + log "Finished warming indices..." +} + loadData() { log "Loading data from $1" @@ -47,3 +57,6 @@ fi # Submit data loadData $STATIC_DATA_DIR loadData $BUILD_DATA_DIR + +# Warm Data +warm_indices