This guide describes how to install and run Vespa on a single machine using Virtualbox and Vagrant. Also try the Docker guide.
Clone sample-apps repository
$ git clone https://github.com/vespa-engine/sample-apps.git
Start CentOS VM using Vagrant and Virtualbox
Navigate into the cloned repository and start the CentOS VM using Vagrant. This may take a couple of minutes.
Installing the Vagrant VirtualBox guest plugin is required to mount the sample application directory inside the VM.
Docker note: if you have completed the Docker guide, please stop the running Vespa container before proceeding. Otherwise you will receive conflicts due to the same port being forwarded from the host.
$ cd sample-apps $ vagrant plugin install vagrant-vbguest $ vagrant upSee the Vagrantfile in the sample-apps directory for exact configuration of the CentOS based VM.
SSH into the VM
$ vagrant ssh
Start the Vespa configuration server
$ sudo service vespa-configserver start
$ curl -s --head http://localhost:19071/ApplicationStatus
Deploy a sample application:The sample apps are located at /vespa-sample-apps inside the VM.
$ cd /vespa-sample-apps/basic-search $ vespa-deploy prepare src/main/application && vespa-deploy activate
$ sudo service vespa start
$ curl -s --head http://localhost:8080/ApplicationStatus
$ curl -s -X POST --data-binary @/vespa-sample-apps/basic-search/music-data-1.json \ http://localhost:8080/document/v1/music/music/docid/1 | python -m json.tool $ curl -s -X POST --data-binary @/vespa-sample-apps/basic-search/music-data-2.json \ http://localhost:8080/document/v1/music/music/docid/2 | python -m json.tool
Run a query and a document get request :
$ curl -s http://localhost:8080/search/?query=bad | python -m json.tool $ curl -s http://localhost:8080/document/v1/music/music/docid/2 | python -m json.tool
Clean up when you're done
Once you're done with the VM you can choose how to dispose of it. First exit the Vagrant SSH session
If you want to continue working on the VM later, suspend it:
$ vagrant suspend
Then continue later by navigating to the sample-apps directory and launching the VM again with vagrant up
If you want to remove the VM and its resources from your system, destroy it:
$ vagrant destroy