commerce-demo / run.sh
bergum's picture
bump maven
a2ab32c
#!/bin/bash
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
set -e
export VESPA_CONFIGSERVERS=$(hostname)
export VESPA_CLI_HOME=/tmp/.vespa
export VESPA_CLI_CACHE_DIR=/tmp/.cache/vespa
trap cleanup TERM INT
cleanup() {
/opt/vespa/bin/vespa-stop-services
exit $?
}
VESPA_CONFIGSERVER_JVMARGS="-Xms32M -Xmx128M" /opt/vespa/bin/vespa-start-configserver
VESPA_CONFIGPROXY_JVMARGS="-Xms32M -Xmx32M" /opt/vespa/bin/vespa-start-services
MVN_VERSION="3.9.4"
export HOME=/tmp/
cd $HOME
/opt/vespa/bin/vespa clone use-case-shopping myapp && cd myapp
cat src/main/application/services.xml|sed 's/<redundancy>2<\/redundancy>/<redundancy>2<\/redundancy><tuning><resource-limits><disk>0.95<\/disk><\/resource-limits><\/tuning>/' > src/main/application/services.xml.new
mv src/main/application/services.xml.new src/main/application/services.xml
wget https://dlcdn.apache.org/maven/maven-3/$MVN_VERSION/binaries/apache-maven-$MVN_VERSION-bin.tar.gz && tar zxvpf apache-maven-$MVN_VERSION-bin.tar.gz
export JAVA_HOME=/usr/
./apache-maven-$MVN_VERSION/bin/mvn -ntp clean package -U
/opt/vespa/bin/vespa deploy --wait 300
# Create products and reviews
curl -L -o meta_sports_20k_sample.json.zst https://data.vespa.oath.cloud/sample-apps-data/meta_sports_20k_sample.json.zst
zstd -d meta_sports_20k_sample.json.zst
cat meta_sports_20k_sample.json | ./convert_meta.py > feed_items.json
rm meta_sports_20k_sample.json meta_sports_20k_sample.json.zst
curl -L -o reviews_sports_24k_sample.json.zst https://data.vespa.oath.cloud/sample-apps-data/reviews_sports_24k_sample.json.zst
zstd -d reviews_sports_24k_sample.json.zst
cat reviews_sports_24k_sample.json | ./convert_reviews.py |zstd > feed_reviews.json.zstd
rm reviews_sports_24k_sample.json reviews_sports_24k_sample.json.zst
# Create query suggestions
./create_suggestions.py feed_items.json > feed_suggestions.json
# Download feed client
echo "Disk usage "
df -h /opt/vespa/var
FEED_CLI_REPO="https://repo1.maven.org/maven2/com/yahoo/vespa/vespa-feed-client-cli" \
&& FEED_CLI_VER=$(curl -Ss "${FEED_CLI_REPO}/maven-metadata.xml" | sed -n 's/.*<release>\(.*\)<.*>/\1/p') \
&& curl -SsLo vespa-feed-client-cli.zip ${FEED_CLI_REPO}/${FEED_CLI_VER}/vespa-feed-client-cli-${FEED_CLI_VER}-zip.zip \
&& unzip -o vespa-feed-client-cli.zip
chmod +x ./vespa-feed-client-cli/vespa-feed-client
echo "Start feeding data"
./vespa-feed-client-cli/vespa-feed-client \
--verbose --file feed_items.json --show-errors --endpoint http://localhost:8080
zstdcat feed_reviews.json.zstd|./vespa-feed-client-cli/vespa-feed-client \
--verbose --stdin --show-errors --endpoint http://localhost:8080
./vespa-feed-client-cli/vespa-feed-client \
--verbose --file feed_suggestions.json --show-errors --endpoint http://localhost:8080
echo "Done feeding data"
echo "Starting proxy server"
/opt/vespa/vespa/bin/proxy.py
echo "Proxy server died"
FORMAT="${VESPA_LOG_FORMAT:-vespa}"
/opt/vespa/bin/vespa-logfmt --follow --format "$FORMAT" ${VESPA_LOGFMT_ARGUMENTS} &
wait