Vespa basic search example on Docker Swarm
Please refer to Vespa quick start using Docker for more information on the basic single container example.
This example assumes that a Docker Swarm is up and running and that you have console access to one of the masters.
Play with Docker is a free service that will provide a Docker Swarm cluster if you do not have access to one. To create Swarm, hit the green start button, click on the wrench in the top left and choose one of the templates. This should give you 5 nodes.
The example below needs to be executed on one of the master nodes.
Check-out the example repository:
$ git clone https://github.com/vespa-engine/sample-apps.git $ export VESPA_SAMPLE_APP=`pwd`/sample-apps/basic-search-on-docker-swarm
Deploy the Vespa stack:
$ docker stack deploy -c $VESPA_SAMPLE_APP/docker-compose.yml vespa
Wait for successful deployment of the stack:
Generate the hosts.xml file based on running containers:
$ $VESPA_SAMPLE_APP/scripts/generate_hosts_xml.sh | tee $VESPA_SAMPLE_APP/src/main/application/hosts.xml
Wait for the configuration server to start (should return 200 OK):
$ curl -s --head $(hostname):19071/ApplicationStatus
Deploy the application:
Wait for the application to start (should return 200 OK):
$ curl -s --head http://$(hostname):8080/ApplicationStatus
Feed data to the application:
Do a search:
$ curl -s "http://$(hostname):8080/search/?query=michael" | python -m json.tool
Congratulations. You have now deployed and tested a Vespa application on a multinode cluster. After you have finished testing the Vespa appplication excute the following step to delete the services:
$ docker stack rm vespa