File size: 3,033 Bytes
8bd7be8
 
 
 
 
24d6cbb
8bd7be8
 
 
 
 
 
 
 
 
 
 
24d6cbb
 
8bd7be8
 
 
 
 
522862b
182f186
 
e72c3bc
8bd7be8
b74040e
ac44c9a
8bd7be8
 
ac44c9a
8bd7be8
 
ac44c9a
0d71d26
8bd7be8
 
 
0d71d26
 
 
ac44c9a
 
 
 
 
0d71d26
8bd7be8
 
 
 
 
 
182f186
 
ac44c9a
 
 
 
8bd7be8
182f186
0d71d26
8bd7be8
ac44c9a
 
 
 
139660c
cdd9ba7
139660c
8bd7be8
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/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

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/3.9.0/binaries/apache-maven-3.9.0-bin.tar.gz && tar zxvpf apache-maven-3.9.0-bin.tar.gz
export JAVA_HOME=/usr/

./apache-maven-3.9.0/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