Quick Start

This guide describes how to install and run Vespa on a single machine using Docker. Once you have completed the steps in this guide, you have a running Vespa instance with searchable documents in it and will have run some search queries against them.

Also try the CentOS / Vagrant or Windows guide.

Prerequisites:

  • Docker installed.
  • Git installed.
  • Operating system: macOS or Linux
  • Architecture: x86_64
  • Minimum 6GB memory dedicated to Docker (the default is 2GB on Macs).
This guide is tested with Docker for Mac, Community Edition-18.06.1-ce-mac73 (26764) and vespaengine/vespa Docker image built 2018-10-01.

Running Vespa in Docker

  1. Clone the Vespa sample apps from github:

    $ git clone https://github.com/vespa-engine/sample-apps.git
    $ export VESPA_SAMPLE_APPS=`pwd`/sample-apps
    
  2. Start a Vespa Docker container:

    $ docker run --detach --name vespa --hostname vespa-container --privileged \
      --volume $VESPA_SAMPLE_APPS:/vespa-sample-apps --publish 8080:8080 vespaengine/vespa
    

    The volume option makes the previously downloaded source code available as /vespa-sample-apps inside the docker container. The port 8080 is published to make the search and feed interfaces accessible outside of the docker container. Only one docker container named vespa can run at a time so change the name if needed.

    If you're interested in the exact steps performed by the above command, please see the Dockerfile and the startup script.

  3. Wait for the configuration server to start - signified by a 200 OK response:

    $ docker exec vespa bash -c 'curl -s --head http://localhost:19071/ApplicationStatus'
    
  4. Deploy and activate a sample application:

    $ docker exec vespa bash -c '/opt/vespa/bin/vespa-deploy prepare /vespa-sample-apps/basic-search/src/main/application/ && \
        /opt/vespa/bin/vespa-deploy activate'
    

    More sample applications can be found in sample-apps. Read more on applications in Application packages.

  5. Ensure the application is active - wait for a 200 OK response:

    $ curl -s --head http://localhost:8080/ApplicationStatus
    
  6. Feed documents into Vespa:

    $ curl -s -H "Content-Type:application/json" --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 -H "Content-Type:application/json" --data-binary @${VESPA_SAMPLE_APPS}/basic-search/music-data-2.json \
        http://localhost:8080/document/v1/music/music/docid/2 | python -m json.tool
    

    This uses the document API. Use the Vespa HTTP client to feed large amounts of data fast.

  7. Make a query POST or GET request:

    $ curl -s -H "Content-Type: application/json" --data '{"query" : "bad"}' http://localhost:8080/search/ | python -m json.tool
    
    $ curl -s http://localhost:8080/search/?query=bad | python -m json.tool
    

    You can also view query results in a browser with the query builder UI at http://localhost:8080/querybuilder/, or have a look at raw query results at http://localhost:8080/search/?query=bad. The query builder can be used to develop search queries as it offers guided queries and YQL autocompletion.

    Read more in the Search API.

  8. Run a document GET request:

    $ curl -s http://localhost:8080/document/v1/music/music/docid/2 | python -m json.tool
    
  9. Optional: Clean up when you're done

    Stop the running container when you no longer need it:

    $ docker stop vespa
    

    You can then also remove the stopped container entirely:

    $ docker rm vespa
    

Troubleshooting

If you encounter any problems see troubleshooting.

Next Steps