Follow these steps to deploy a Vespa application having Java components on your own machine.
Alternative versions of this guide:
This is tested with vespaengine/vespa:8.599.6 container image.
Prerequisites:
NO_SPACE - the vespaengine/vespa container image + headroom for data requires disk space.
Read more.
Steps:
Validate the environment:
$ docker info | grep "Total Memory" or $ podman info | grep "memTotal"
Make sure you see at minimum 4 GB.
Install the Vespa CLI using Homebrew:
$ brew install vespa-cli
Windows/No Homebrew? See the Vespa CLI page to download directly.
Set local target:
$ vespa config set target local
Start a Vespa Docker container:
$ docker run --detach --name vespa --hostname vespa-container \ --publish 8080:8080 --publish 19071:19071 \ vespaengine/vespa
The port 8080 is published to make the query and feed endpoints
accessible from outside the docker container,
19071 is the config server endpoint.
Only one docker container named vespa can run at a time, change the name as needed.
See Docker containers for more insights.
Clone a sample application:
$ vespa clone album-recommendation-java myapp && cd myapp
Build it:
$ mvn install
Deploy the application:
$ vespa deploy --wait 300
$ vespa feed src/test/resources/*.json
Run queries:
$ vespa query "select * from music where album contains 'head'"
$ vespa query \
"select * from music where true" \
"ranking=rank_albums" \
"ranking.features.query(user_profile)={{cat:pop}:0.8,{cat:rock}:0.2,{cat:jazz}:0.1}"
Congratulations, you have deployed your first Vespa application!
$ docker rm -f vespa