Deploy an application locally

Follow these steps to deploy a Vespa application on your own machine.

Alternative versions of this guide:

This is tested with vespaengine/vespa:8.599.6 container image.


Steps:

  1. Validate the environment:

    $ docker info | grep "Total Memory"
    or
    $ podman info | grep "memTotal"
    

    Make sure you see at minimum 4 GB.

  2. Install the Vespa CLI using Homebrew:

    $ brew install vespa-cli
    

    Windows/No Homebrew? See the Vespa CLI page to download directly.

  3. Set local target:

    $ vespa config set target local
    
  4. 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 search and feed interfaces accessible from outside the docker container, 19071 is the config server endpoint. Only one docker container named vespa can run at a time so change the name if needed. See Docker containers for more insights.

  5. Clone a sample application:

    $ vespa clone album-recommendation myapp && cd myapp
    
  6. Deploy the application:

    $ vespa deploy --wait 300 ./app
    
  7. Feed documents:

    $ vespa feed dataset/documents.jsonl
    
  8. 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}"
    
  9. Get documents:

    $ vespa document get id:mynamespace:music::a-head-full-of-dreams
    
    $ vespa visit
    

    Get a document by ID, or export all documents - see /document/v1 and vespa visit.


Congratulations, you have deployed your first Vespa application!

Next steps